• 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: Putting an image on a CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Putting an image on a CALayer


  • Subject: Re: Putting an image on a CALayer
  • From: glenn andreas <email@hidden>
  • Date: Tue, 21 Oct 2008 11:39:35 -0500


On Oct 21, 2008, at 10:54 AM, Josh Abernathy wrote:

Scott Stevenson uses an NSImage category with:

- (CGImageRef)cgImage
{
	// I'm open to better ideas. :)

	NSData* data = [self TIFFRepresentation];
	return CreateCGImageFromData(data);
}

So create an NSImage and use that.


Unfortunately, that will leak a CGImageRef, which can be a potentially very bad thing (since they can become large)


At the very least the method should be renamed to "createCGImage" (to indicate that the object is created and the caller needs to release it) and then explicitly call CGImageRelease in the caller after setting the CGImageRef property of the CALayer (since the CALayer will have retained it).



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next generation of fractal art




_______________________________________________

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: 
 >Putting an image on a CALayer (From: DKJ <email@hidden>)
 >Re: Putting an image on a CALayer (From: Josh Abernathy <email@hidden>)

  • Prev by Date: Modifying NSDatePicker for automatically generated predicate row templates
  • Next by Date: Automatically generated predicate row templates for to-many key?
  • Previous by thread: Re: Putting an image on a CALayer
  • Next by thread: looking for reference to a dictionary
  • Index(es):
    • Date
    • Thread