Re: Lock/unlock focus does not draw image in Snow Leopard
Michael McCulloch <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Aug 28, 2009, at 10:39 PM, Avi Drissman wrote: > The intended use of -lockFocus is a message to an object that you > are drawing into it. If you are using NSCustomImageRep, then it > makes little sense to call -lockFocus on it, since that means that > you're trying to modify the image by drawing into it. > > This code path may have accidentally worked in the past, but SL made > major behind-the-scenes changes to how images worked. While those > changes are invisible to most users of NSImages, I fear your code > may have accidentally been working. > > I'm not sure what you're trying to do. Are you trying to draw the > myImage image into a view? If so, send -lockFocus to the view in > which you want to draw, and then send -drawAtPoint... to the image > to get it to draw. 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. These larger images are used in turn in a NSView subclass to display information to the user. --- Michael McCulloch