I am trying to apply the CIPerspectiveTransform to a CoreAnimation Layer. But for some reason I am getting this debugger output and nothing gets displayed:

CoreImage: ROI is not tilable:
APPLY perspective DOD [118,140 528x367] ROI [258,296 22x24] RGBA_14
AFFINE [1 -0 -0 1 -16384 -16384] DOD [-16384,-16384 32768x32768] ROI [-7087,10 1667x2312] ARGB_8
  IMAGE CIImage:0x9de20 DOD [0,0 32768x32768] ARGB_8


Any ideas what could be happening?

This is the code:

        [[self window] makeFirstResponder:self];
        [self becomeFirstResponder];
        
        NSImage *img = [[NSImage alloc] initWithContentsOfFile:
                [[NSBundle mainBundle] pathForResource:@"Picture 2" 
ofType:@"png"]
        ];
        
NSBitmapImageRep *bitmap = [NSBitmapImageRep imageRepWithData:[img TIFFRepresentation]];
        CIImage * ciImage = [[CIImage alloc] initWithBitmapImageRep:bitmap];

        rootLayer = [[CALayer layer] retain];
        rootLayer.name = @"myRootLayer";
        rootLayer.contents = ciImage;
        
        rootLayer.cornerRadius = 50.0;
        rootLayer.borderWidth = 3.0;
        rootLayer.masksToBounds = YES;

        [self setLayer:rootLayer];
        [self setWantsLayer:YES];


        // Setpu the filer to scale down the image
CIFilter *filter = [CIFilter filterWithName:@"CILanczosScaleTransform"];
        [filter setDefaults];
        [filter setValue:ciImage forKey:@"inputImage"];
        [filter setValue:[NSNumber numberWithFloat:1.5] forKey:@"inputScale"];

        // Setup the filter     
CIFilter *filter2 = [CIFilter filterWithName:@"CIPerspectiveTransform"];
        [filter2 setDefaults];
        [filter2 setValue:ciImage forKey:@"inputImage"];
//[filter2 setValue:[CIVector vectorWithX:100 Y:500 ] forKey:@"inputTopLeft"]; //[filter2 setValue:[CIVector vectorWithX:600 Y:500 ] forKey:@"inputTopRight"]; //[filter2 setValue:[CIVector vectorWithX:600 Y:0 ] forKey:@"inputBottomLeft"]; //[filter2 setValue:[CIVector vectorWithX:0 Y:0 ] forKey:@"inputBottomRight"];
        [filter2 setName:@"myPulseFilter"];
        CIImage *ciImageOut = [filter2 valueForKey:@"outputImage"];
        NSImage *i3 = [self imageFromCIImage: ciImageOut];
        [[i3 TIFFRepresentation] writeToFile:@"myimage.tif" atomically:YES];
        [rootLayer setFilters:[NSArray arrayWithObject: filter2]];

"myimage.tff" has the a good image. If I comment the last line where i set the filters, the code works and I can see the image. But if I Apply the filter, then nothing is displayed.

Thank you
Vance

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to