Re: Lock/unlock focus does not draw image in Snow Leopard
Christiaan Hofman <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Aug 29, 2009, at 6:18, Adam R. Maxwell wrote: > > On Aug 28, 2009, at 7:48 PM, Michael McCulloch wrote: > >> Actually lockFocus on an image is perfectly reasonable and legit. >> My situation is that I have a bunch of smaller "master" images that >> are used to build bigger composited images based on program >> context, so my draw selector does all that work. It basically >> selects rects from the masters and builds a composite image result. >> Keeping the master images small at design time considerably reduces >> the size of my distribution. > > It's not clear what you expect to happen here, since what you're > doing seems at best undefined. If you want to draw the > NSCustomImageRep in an NSImage, send lockFocus to the NSImage and > then draw the rep without adding it. You are adding the > NSCustomImageRep to an NSImage, then drawing that same rep to the > same NSImage. That draws into some internal image rep of the image > (likely an NSCachedImageRep, at least in 10.5 and earlier), and > probably does various other odd things. What are you doing with > that NSImage? > Michael, I think what you want is something like lockFocusOnRepresentation:, right? You should definitely read the Snow Leopard AppKit release notes about this now deprecated (because rather confusing) method, I think it might give you the insight you need. Christiaan