How do you set inputTransform for CIAffineTransform in iOS 5

I looked for time to answer this question, but found nothing. I am trying to use CIAffineTransform besides iOS 5 Beta, and have encountered a problem. The documentation says that the 'inputTransform' property accepts NSAffineTransform, but as far as I can tell, there is no way to instantiate one of them in iOS, all the studies that I have done tell me that this class is for MacOS (correct me if I I am mistaken).

If so, then what value do I put in inputTransform?

Here is some simple code to explain what I'm trying to execute.

CIImage* result = "Some CIImage"; CIFilter* filter = [CIFilter filterWithName:@"CIAffineTransform"]; [filter setValue:result forKey:kCIInputImageKey]; [filter setValue:transform forKey:@"inputTransform"]; //What type/class of value do I set here if I can't use an NSAffineTransform result = [filter outputImage]; 

Any help would be greatly appreciated.

+8
ios core-graphics core-image
source share
2 answers

I found a solution, I was just looking for the wrong place.

Instead of using the CIAffineTransform filter on CIImage, CIImage actually provides a method called:

 -(CIImage*) imageByApplyingTransform:(CGAffineTransform)transform 

This method returns the image to which the CGAffineTransform argument applies.

Hope someone helped :)

+21
source share

The Link to the filter of the main image .

 CGAffineTransform xForm = whatever; [myFilter setValue:[NSValue valueWithBytes:&xForm objCType:@encode(CGAffineTransform)] forKey:@"inputTransform"]; 
+1
source share

All Articles