| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I've only been using Affine transforms for a few days and CIFilters for about a week, but this seems like a bug in the "CIAffineTransform" filter. // Load an image NSImage *sourceImage = [[NSImage alloc] initWithContentsOfFile: @"path to an image file"]; // Convert to a CIImage CIImage *ciImage = [[CIImage alloc] initWithData: [sourceImage TIFFRepresentation]]; // Create an affine transform NSAffineTransform *transform = [NSAffineTransform transform]; [transform translateXBy: 50 yBy: 50]; // Create a "CIAffineTransform" filter and add the transform above CIFilter *filter = [CIFilter filterWithName: @"CIAffineTransform"]; [filter setDefaults]; [filter setValue: ciImage forKey: @"inputImage"]; [filter setValue: transform forKey: @"inputTransform"]; // Get the result ciImage = [filter valueForKey: @"outputImage"]; // Put result in an image rep, add to an image NSCIImageRep *imgRep = [NSCIImageRep imageRepWithCIImage: ciImage]; NSImage *resultImage = [[NSImage alloc] initWithSize: sourceImage.size]; [resultImage addRepresentation: imgRep]; // display resultImage in a window. Result: Image appears in the same location it would if none of the above had happened. Other affine transforms work fine with the "CIAffineTransform" filter (rotate and scale) but not translate. I thought I'd run it by a few more sets of eyes, in case I'm making an obvious error, before submitting a bug report. Ken |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.