iOS - CoreImage - 为部分图像添加效果 [英] iOS - CoreImage - Add an effect to partial of image
本文介绍了iOS - CoreImage - 为部分图像添加效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是看看iOS 5上的CoreImage框架,发现很容易为整个图像添加效果。
我想知道是否可以在图像的特殊部分(矩形)上添加效果。例如在图像的部分上添加灰度效果/
I just have a look on CoreImage framework on iOS 5, found that it's easy to add an effect to whole image. I wonder if possible to add an effect on special part of image (a rectangle). for example add gray scale effect on partial of image/
我期待着你的帮助。
谢谢,
Huy
Thanks, Huy
推荐答案
观看WWDC 2012视频中的会话510。他们提出了一种如何将掩码应用于 CIImage
的技术。您需要了解如何将过滤器链接在一起。特别要看一下:
Watch session 510 from the WWDC 2012 videos. They present a technique how to apply a mask to a CIImage
. You need to learn how to chain the filters together. In particular take a look at:
-
CICrop
,CILinearGradient
,CIRadialGradient
(可用于创建掩码) -
CISourceOverCompositing
(将掩码图像放在一起) -
CIBlendWithMask
(创建最终图像)
CICrop
,CILinearGradient
,CIRadialGradient
(could be used to create the mask)CISourceOverCompositing
(put mask images together)CIBlendWithMask
(create final image)
此处记录过滤器:
这篇关于iOS - CoreImage - 为部分图像添加效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文