如何逐像素操作 UIImage?
How to manipulate UIImage pixel by pixel?
我的 iOS 应用程序中有一个缩略图,我正在其上绘制一个云图标,所以基本上我有一个 UIImage。现在我想用一些颜色填充云,因为一些过程像进度条一样继续进行。
我的问题是
- How to access this UIImage and manipulate(pixelwise)?
- How to update only the cloud portion as the cloud is an irregular figure, what checks should be there to set the pixels inside the cloud only?
这是一篇很好的博客 post,它描述了如何检索和更新 UIImage 的像素值。
http://www.brandontreb.com/image-manipulation-retrieving-and-updating-pixel-values-for-a-uiimage/.
或者您也可以查看 GPUImage (https://github.com/BradLarson/GPUImage)。这将为您提供更好的性能,也非常适合处理静止图像。我认为用于完成您的任务的自定义过滤器会相当容易。
您可以使用背景颜色填充的 UIView,它在另一个使用 maskview 屏蔽的 UIView 中设置动画...
我的 iOS 应用程序中有一个缩略图,我正在其上绘制一个云图标,所以基本上我有一个 UIImage。现在我想用一些颜色填充云,因为一些过程像进度条一样继续进行。
我的问题是
- How to access this UIImage and manipulate(pixelwise)?
- How to update only the cloud portion as the cloud is an irregular figure, what checks should be there to set the pixels inside the cloud only?
这是一篇很好的博客 post,它描述了如何检索和更新 UIImage 的像素值。
http://www.brandontreb.com/image-manipulation-retrieving-and-updating-pixel-values-for-a-uiimage/.
或者您也可以查看 GPUImage (https://github.com/BradLarson/GPUImage)。这将为您提供更好的性能,也非常适合处理静止图像。我认为用于完成您的任务的自定义过滤器会相当容易。
您可以使用背景颜色填充的 UIView,它在另一个使用 maskview 屏蔽的 UIView 中设置动画...