Domanda

I've been looking around for a while for an answer to this, but haven't found anything. I'm trying to use the CIAffineTransform thats apart of iOS 5 Beta, and have come across an issue. The documentation says that the 'inputTransform' property accepts an NSAffineTransform, but near as I can tell, there is no way to instantiate one of these in iOS, all the research I've done tells me this particular class is for MacOS (correct me if I'm wrong).

If thats the case, then what value do I put into the inputTransform?

Here's some simple code to explain what I'm trying to accomplish.

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 will be greatly apprecriated.

È stato utile?

Soluzione

I found the solution, I was simply looking in the wrong place.

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

-(CIImage*) imageByApplyingTransform:(CGAffineTransform)transform

This method returns an image that has the CGAffineTransform argument applied to it.

Hope that helps somebody :)

Altri suggerimenti

Per the Core Image Filter Reference.

CGAffineTransform xForm = whatever;
[myFilter setValue:[NSValue valueWithBytes:&xForm objCType:@encode(CGAffineTransform)] forKey:@"inputTransform"];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top