Re: Random image problem has me stumped :(
Re: Random image problem has me stumped :(
- Subject: Re: Random image problem has me stumped :(
- From: Serge Meynard <email@hidden>
- Date: Wed, 23 Mar 2005 18:16:24 -0500
On Mar 23, 2005, at 17:54, John C. Randolph wrote:
On Mar 23, 2005, at 1:28 PM, Serge Meynard wrote:
But if I run the test code below...
[cachedImage lockFocus];
NSBitmapImageRep* bmrep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect:NSMakeRect(0, 0, width, height)];
...the returned bmrep is nil.
Probably because there's no view that has focus. Remember that
NSImage is not an NSView subclass.
I'm not sure I understand your point... Using lockFocus is how you draw
into, or read back from, an arbitrary NSImage, isn't it? Your own post
from 2 years ago at
(http://lists.apple.com/archives/cocoa-dev/2002/Dec/msg00447.html) does
exactly the same thing. The code above isn't a prelude to drawing the
image, it's just a couple of lines of test code I added right after I'm
done creating the image, to check the image's validity using the
debugger.
The call to initWithFocusedViewRect: works as expected for the 99% of
images that aren't broken; I just don't get what's different about the
last 1% of cases, especially given the randomness.
Serge
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden