• 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: Drawing a view and its subviews to an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing a view and its subviews to an NSImage


  • Subject: Re: Drawing a view and its subviews to an NSImage
  • From: "Mark A. Stratman" <email@hidden>
  • Date: Sat, 5 Jun 2004 04:30:24 -0500

On Jun 5, 2004, at 1:08 AM, Mark Alldritt wrote:

Hi Folks,

I'm looking for some clues on how to draw a view and all of its subviews to
an NSImage.

In searching the archives I found a reference to something called
BTOffscreenView, but the download link is no longer valid.

If I'm understanding correctly, you'll probably want to use NSView's dataWithEPSInsideRect:
Example:
NSData *eps = [aView dataWithEPSInsideRect:[aView bounds]];
NSImage *image = [[NSImage alloc] initWithData:eps];

This produces an image that looks exactly like what you see on the screen.

HTH
- Mark A. Stratman
_______________________________________________
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: Drawing a view and its subviews to an NSImage
      • From: Shawn Erickson <email@hidden>
References: 
 >Drawing a view and its subviews to an NSImage (From: Mark Alldritt <email@hidden>)

  • Prev by Date: Drawing a view and its subviews to an NSImage
  • Next by Date: Re: Representing UTC time in a readable format
  • Previous by thread: Drawing a view and its subviews to an NSImage
  • Next by thread: Re: Drawing a view and its subviews to an NSImage
  • Index(es):
    • Date
    • Thread