• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Rendering an NSControl into a NSImage? (resolved)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rendering an NSControl into a NSImage? (resolved)


  • Subject: Re: Rendering an NSControl into a NSImage? (resolved)
  • From: Mark Alldritt <email@hidden>
  • Date: Wed, 02 Apr 2003 11:44:46 -0800

Hi,

Great thanks to John Randolph, Carl Norum, and Peter Mark. It was Peter
Mark's code that finally cracked the problem. The following code correctly
renders an NSControl into an NSImage. In the end, the only change from my
original code was to call [snapshot setFlipped:YES].

- (NSImage*) proxyImage
{
NSRect sourceRect = [self frame];
NSImage *snapshot = [[NSImage alloc] initWithSize:sourceRect.size];

[snapshot setFlipped:YES];
[snapshot lockFocus];
[self drawRect:sourceRect];
[snapshot unlockFocus];

return [snapshot autorelease];
}

For those that care, I've created a sample project that illustrates what
I've learned about how to use drag and drop to copy controls:

http://www.latenightsw.com/archives/ControlDragAndDrop.hqx

Cheers
-Mark

---------------------------------------------------------------------
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 333 Moss Street
FAX: 250-383-3204 Victoria, B.C.
WEB: http://www.latenightsw.com/ CANADA V8V-4M9
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Rendering an NSControl into a NSImage? (resolved)
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: Charting solutions
  • Next by Date: SummaryService API?
  • Previous by thread: Re: Negative Integer in Red in IB
  • Next by thread: Re: Rendering an NSControl into a NSImage? (resolved)
  • Index(es):
    • Date
    • Thread