• 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: Rendering a View into an Image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rendering a View into an Image


  • Subject: Re: Rendering a View into an Image
  • From: James DiPalma <email@hidden>
  • Date: Mon, 15 Oct 2001 09:01:52 -0700

[image lockFocus] might help to cache views.

I use lock focus to cache cell images for dragging and think views can also be cached with lockFocus.

[dragImage lockFocus];
[cell drawWithFrame:NSMakeRect(0, 0, cellFrame.size.width, cellFrame.size.height) inView:self];
[dragImage unlockFocus];

If there is a better way, I'd be interested in hearing about it.


-jim

On Wednesday, October 10, 2001, at 07:55 AM, Charles Jolley wrote:
NSBitmapImageRep *myBitmap = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[myView bounds]];

That's not an NSImage, but you can turn it into one, something like this:


My experience has shown this to work only if the view is visible in the window. In fact, if a view is only partially visible, then it will only render the visible portion into the image.


References: 
 >Re: Rendering a View into an Image (From: Charles Jolley <email@hidden>)

  • Prev by Date: Re: Q's about Obj-C
  • Next by Date: Re: NSBrowser
  • Previous by thread: Re: Rendering a View into an Image
  • Next by thread: two level namespace q
  • Index(es):
    • Date
    • Thread