Re: Adding text to NSImage using lockFocus/unlockFocus not working
Re: Adding text to NSImage using lockFocus/unlockFocus not working
- Subject: Re: Adding text to NSImage using lockFocus/unlockFocus not working
- From: Michael Ash <email@hidden>
- Date: Wed, 25 Feb 2009 11:41:29 -0500
On Tue, Feb 24, 2009 at 5:50 AM, Ashish Tiwari
<email@hidden> wrote:
> //NSImage *img = [[NSImage
> alloc]initWithContentsOfFile:@"/Users/ashisht/Desktop/downloads.png"];
...
> [img lockFocus];
Don't try to create an image and then draw into it in this way. You're
likely to end up with multiple NSImageReps only one of which contains
your drawing, and then it'll be a crapshoot as to whether the one with
your drawing is the one that's used to display later on.
Instead, create a second NSImage. Lock focus on that one, draw both
the original image and your other stuff into it. Then use the second
image.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden