如何在 iOS 5 中设置 CIAffineTransform 的 inputTransform

发布于 2024-11-29 00:17:11 字数 626 浏览 1 评论 0原文

我已经四处寻找这个问题的答案有一段时间了,但没有找到任何东西。我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

颜漓半夏 2024-12-06 00:17:11

我找到了解决方案,我只是找错了地方。

CIImage 实际上提供了一个方法,而不是在 CIImage 上使用 CIAffineTransform 过滤器:

-(CIImage*) imageByApplyingTransform:(CGAffineTransform)transform

该方法返回一个应用了 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:

-(CIImage*) imageByApplyingTransform:(CGAffineTransform)transform

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

Hope that helps somebody :)

卖梦商人 2024-12-06 00:17:11

根据核心图像过滤器参考

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

Per the Core Image Filter Reference.

CGAffineTransform xForm = whatever;
[myFilter setValue:[NSValue valueWithBytes:&xForm objCType:@encode(CGAffineTransform)] forKey:@"inputTransform"];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文