Re: Image of a window
Re: Image of a window
- Subject: Re: Image of a window
- From: Roarke Lynch <email@hidden>
- Date: Wed, 21 Aug 2002 07:31:08 -0400
On Tuesday, August 20, 2002, at 08:17 PM, Adam Atlas wrote:
Is it possible to get the image of a window (or its content view) and
put it into a NSImage? Carbon or CG stuff is also OK, as long as it can
be accessed from Cocoa.
Thanks,
Adam Atlas
Get the contentView from the window whose image you want to
capture, and then I would assume you can:
[[NSImage alloc] initWithData: [yourWindowsContentView
dataWithPDFInsideRect:[yourWindowsContentView frame]]];
It's untested on my part, but I don't see why I wouldn't work.
//edit
I just looked at the docs real quick and you don't even have to
grab the contentView if you don't want to. You could do the above, with
the same methods, but pass the window object itself instead of the the
window's contentView. I'm pretty sure this second option would also
capture the window's title bar, which the first should not do. There is
also NSWindow's miniWindowImage method, but i'm guessing you don't want
that.
Roarke Lynch
-------------------------------
email@hidden
_______________________________________________
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.