How to get the real RGBA or ARGB color values without premultiplied alpha?
问题 I'm creating an bitmap context using CGBitmapContextCreate with the kCGImageAlphaPremultipliedFirst option. I made a 5 x 5 test image with some major colors (pure red, green, blue, white, black), some mixed colors (i.e. purple) combined with some alpha variations. Every time when the alpha component is not 255, the color value is wrong. I found that I could re-calculate the color when I do something like: almostCorrectRed = wrongRed * (255 / alphaValue); almostCorrectGreen = wrongGreen * (255