Re: Putting an image on a CALayer
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