开发者

iphone: How can I remove the red colors from an image? (RGB colors)

Let's say I have an UIImageView, and I wanna show only blue and开发者_StackOverflow green colore from it, (RGB colors). Like in Photoshop, I can choose what colors to show, red, blue, and green, so in the image to delete the red color.

So how can I do it? I really new in Objective-c and all :)


There are many ways to do this. If you have access to the image bitmap data, you can just set the red channel to zero on all the pixels. You might need to draw the image into a CGBitmapContext, get the pointer to the bitmap data, and then create a new CGImage that gets turned into a UIImage.

Or you can create a UIView subclass with a custom drawRect: method which first draws the image normally, and then draws a color set to RGB (0, 1, 1) with the blend mode (set by CGContextSetBlendMode) to kCGBlendModeMultiply.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜