Re: CIImage drawAtPoint: ...... retains image??
Re: CIImage drawAtPoint: ...... retains image??
- Subject: Re: CIImage drawAtPoint: ...... retains image??
- From: Nik Youdale <email@hidden>
- Date: Sun, 16 Dec 2007 00:29:41 +1100
Thanks a lot for the tip - it works a treat! =]
- Nik
On 15/12/2007, at 11:07 PM, Rob Keniger wrote:
I had this exact problem and it seems to occur if you are drawing to
a context that is not on-screen. I was leaking HUGE amounts of
memory until I found a fix.
I used this workaround which renders the CIImage to the context of
the application's main window (you can use any on-screen context)
and grabs a CGImageRef which is then drawn to the current context:
//outputImage is the CIImage you want to draw
CIContext *ciContext = [[[NSApp mainWindow] graphicsContext]
CIContext];
//render the CIIimage into a CGImageRef in the on-screen context
CGImageRef cgImage = [ciContext createCGImage:outputImage fromRect:
[outputImage extent]];
// Draw the CGImageRef into the current context
if (cgImage != NULL)
{
CGContextDrawImage ([[NSGraphicsContext currentContext]
graphicsPort], [outputImage extent], cgImage);
CGImageRelease (cgImage);
}
This eliminates the problem for me.
--
Rob Keniger
_______________________________________________
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