如何在 iOS 5 中设置 CIAffineTransform 的 inputTransform
我已经四处寻找这个问题的答案有一段时间了,但没有找到任何东西。我正在尝试使用 iOS 5 Beta 之外的 CIAffineTransform,但遇到了问题。文档说“inputTransform”属性接受 NSAffineTransform,但据我所知,无法在 iOS 中实例化其中一个,我所做的所有研究都告诉我这个特定的类适用于 MacOS(纠正我)如果我错了)。
如果是这样,那么我应该在 inputTransform 中放入什么值?
这是一些简单的代码来解释我想要完成的任务。
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];
任何帮助将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了解决方案,我只是找错了地方。
CIImage 实际上提供了一个方法,而不是在 CIImage 上使用 CIAffineTransform 过滤器:
该方法返回一个应用了 CGAffineTransform 参数的图像。
希望对某人有帮助:)
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:
This method returns an image that has the CGAffineTransform argument applied to it.
Hope that helps somebody :)
根据核心图像过滤器参考。
Per the Core Image Filter Reference.