• 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
CIImage (TIFFRepresentation) memory leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CIImage (TIFFRepresentation) memory leak


  • Subject: CIImage (TIFFRepresentation) memory leak
  • From: email@hidden
  • Date: Mon, 10 Mar 2008 17:33:54 +0100

Hi,

I'm applying a Core Image filter to an image in a NSImageView
subclass. The drawing works fine, except it leaks memory, not sure
why. This is my drawRect method. Anything wrong with it? Thanks.


- (void) drawRect:(NSRect)rect
{

        [[self image] setFlipped:YES];
	CIImage *image = [CIImage imageWithData:[[self image] TIFFRepresentation]];
	if (image !=nil) {
		CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
		[filter setDefaults];
		[filter setValue: image forKey: @"inputImage"];
		[filter setValue: [NSNumber numberWithFloat:0.7] forKey: @"inputRadius"];
		image = [filter valueForKey: @"outputImage"];

		filter = [CIFilter filterWithName:@"CIPerspectiveTransform"];
		[filter setDefaults];
		[filter setValue: image forKey: @"inputImage"];
		[filter setValue:[CIVector vectorWithX:NSMinX(rect) Y:NSMinY(rect) +
bLeft ] forKey:@"inputBottomLeft"];
		[filter setValue:[CIVector vectorWithX:NSMaxX(rect) Y:NSMinY(rect) +
bRight ] forKey:@"inputBottomRight"];
		[filter setValue:[CIVector vectorWithX:NSMinX(rect) Y:NSMaxY(rect) +
tLeft ] forKey:@"inputTopLeft"];
		[filter setValue:[CIVector vectorWithX:NSMaxX(rect) Y:NSMaxY(rect) +
tRight ] forKey:@"inputTopRight"];
		image = [filter valueForKey: @"outputImage"];

		CGRect cg;
		CIContext *context = [[NSGraphicsContext currentContext] CIContext];
		cg = CGRectMake(NSMinX(rect), NSMinY(rect), NSWidth(rect), NSHeight(rect));
		[context drawImage:image
					atPoint:cg.origin
					fromRect:cg];

	}
}
_______________________________________________

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

  • Follow-Ups:
    • Re: CIImage (TIFFRepresentation) memory leak
      • From: email@hidden
  • Prev by Date: Re: fileExistsAtPath with * to indicate random
  • Next by Date: Re: force NSTextField to accept only Roman, or the other character codes
  • Previous by thread: Re: fileExistsAtPath with * to indicate random
  • Next by thread: Re: CIImage (TIFFRepresentation) memory leak
  • Index(es):
    • Date
    • Thread