• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding text to NSImage using lockFocus/unlockFocus not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Adding text to NSImage using lockFocus/unlockFocus not working (From: "Ashish Tiwari" <email@hidden>)

  • Prev by Date: Subclassing with more restrictive initializers
  • Next by Date: Re: do i need to create autorelease pool?
  • Previous by thread: RE: Adding text to NSImage using lockFocus/unlockFocus not working
  • Next by thread: how to modify 'PictureSharing' example?
  • Index(es):
    • Date
    • Thread