与 [CIContext drawImage:…]
最后两行有什么区别?
CIImage *outputImage = [compositingFilter valueForKey:@"outputImage"];
[[[NSGraphicsContext currentContext] CIContext] drawImage:outputImage atPoint:point fromRect:fromRect];
[outputImage drawAtPoint:point fromRect:fromRect operation:op fraction:delta];
最后一个生成一个扭曲的图像,其矩形小于[outputImage范围];
在某些情况下,drawImage: 行会崩溃。
What is the difference between the last two lines?
CIImage *outputImage = [compositingFilter valueForKey:@"outputImage"];
[[[NSGraphicsContext currentContext] CIContext] drawImage:outputImage atPoint:point fromRect:fromRect];
[outputImage drawAtPoint:point fromRect:fromRect operation:op fraction:delta];
The last one produces a distorted image with a rect that is smaller than [outputImage extent];
The drawImage: line crashes on some occasions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 -drawAtPoint 上的文档:...
如果您想要绘制整个图像,则 fromRect 应该是图像的整个大小。此外,在许多情况下,不同绘图方法之间的翻转处理方式也不同。
最后,关于 -drawImage:… 的文档有些神秘地仅指出:
希望这会有所帮助。
From the docs on -drawAtPoint:…
fromRect should be the entire size of the image if you're wanting the whole thing drawn. Also in many cases flippedness is handled differently between different drawing methods.
Lastly, the docs on -drawImage:… somewhat cryptically only state:
Hope this helps.