Changing color space on and image

前端 未结 1 722
迷失自我
迷失自我 2021-01-26 16:01

I\'m creating a mask based on DeviceGray color space based image.

What basically I want to do is to change all sorts of gray (beside black) pixels into white and leave

相关标签:
1条回答
  • 2021-01-26 16:35

    Use CGImageCreateWithMaskingColors and CGContextSetRGBFillColor together like this:

    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);
    

    By the way, the fill color is mentioned at the CGImageCreateWithMaskingColors discussion.

    0 讨论(0)
提交回复
热议问题