[英]Changing color space on and image
我正在创建一个基于DeviceGray颜色空间的图像的蒙版。
基本上我想要做的是将各种灰色(黑色旁边)像素更改为白色并保留黑色像素。
所以我希望我的图像由黑白像素组成。
任何想法如何使用CoreGraphics实现这意味着什么?
请不要在循环中提供遍布像素的运行
像这样使用CGImageCreateWithMaskingColors
和CGContextSetRGBFillColor
:
CGImageRef myMaskedImage;
const CGFloat myMaskingColors[6] = { 0, 124, 0, 68, 0, 0 };
myColorMaskedImage = CGImageCreateWithMaskingColors (image,
myMaskingColors);
CGContextSetRGBFillColor (myContext, 0.6373,0.6373, 0, 1);
CGContextFillRect(context, rect);
CGContextDrawImage(context, rect, myColorMaskedImage);
顺便说一句,填充颜色在CGImageCreateWithMaskingColors讨论中提到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.