• 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: Image of a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Image of a window (From: Adam Atlas <email@hidden>)

  • Prev by Date: Re: (Newbie)Missing Header Files, Please Help
  • Next by Date: Re: regenerate a nib file from the output of nibtool?
  • Previous by thread: Image of a window
  • Next by thread: Bundles and User Defaults
  • Index(es):
    • Date
    • Thread