Re: NSView to NSBitmapRep Without an NSWindow?
Re: NSView to NSBitmapRep Without an NSWindow?
- Subject: Re: NSView to NSBitmapRep Without an NSWindow?
- From: email@hidden
- Date: Sun, 11 Sep 2005 00:34:24 +0800
You might try
- (NSImage *)imageFromView:(NSView *)theView
{
NSRect viewBounds = [theView bounds];
NSImage *image = [[NSImage alloc] initWithSize:viewBounds.size];
[image setFlipped:YES]; // or maybe you won't need this
[image lockFocus];
NSEraseRect(viewBounds);
[theView drawRect: viewBounds ];
[image unlockFocus];
return [image autorelease];
}
And then extract the NSBitmapImageRep from the NSImage
HTH,
James
On Sep 8, 2005, at 12:36 PM, Seth Willits wrote:
Is there any way to get an NSBitmapRep of the contents in an NSView
*without* that view being in a window? Nothing I've tried works.
Even briefly placing the view in a window way of screen doesn't work.
Thanks,
--
Seth Willits
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden