Re: Can't cache image
Re: Can't cache image
- Subject: Re: Can't cache image
- From: Ben Mackin <email@hidden>
- Date: Fri, 21 Mar 2003 11:25:37 -0800
On 3/21/03 9:22 AM, "Brock Brandenberg" <email@hidden> wrote:
>
The error is because you have told the NSImage to never cache. Because you
>
are telling it not to cache, it's responding that it can't create the
>
offscreen window buffer in which to capture and cache your subsequent
>
drawing after the lockFocus.
>
>
If you're trying to capture your drawing as a bitmap, you do this as covered
>
under "Caching Representations" in "Drawing and Imaging". You can then use
>
the NSBitmapImageRep for whatever you want:
>
>
NSImage* image = [[NSImage alloc] initWithSize:size];
>
[image lockFocus];
>
>
// draw draw draw
>
>
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc]
>
initWithFocusedViewRect:
>
NSMakeRect(0,0,size.width,size.height)];
>
[image unlockFocus];
I tried that first (I should have mentioned that). I didn't have the
setCacheMode line in my code. But when I started getting the "Can't cache
image" error, I figured I need to set the NSImage to not cache (I guess I
understood the error wrong).
So any other thoughts on what could be the issue? Could it be that init my
NSImage with just a size is not good enough to then lockFocus on? Sorry I am
pretty new to Cocoa, so I hope this isn't obvious (I tried searching the
archives).
Thanks,
Ben
http://www.shayufilms.com
_______________________________________________
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.