Re: Rendering an NSControl into a NSImage? (resolved)
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.