Revision: 40713
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 5, 2011 18:47 by bronenos
Initial Code
void RGBtoCMYK(float color[4]) { if (color[0]==0 && color[1]==0 && color[2]==0) { color[0] = 0; color[1] = 0; color[2] = 0; color[3] = 1.0; } else if (color[0]==1.0 && color[1]==1.0 && color[2]==1.0) { color[0] = 0; color[1] = 0; color[2] = 0; color[3] = 0; } else { color[0] = 1.0 - color[0]; color[1] = 1.0 - color[1]; color[2] = 1.0 - color[2]; float minK = MIN(color[0], MIN(color[1], color[2])); color[0] = (color[0] - minK) / (1.0 - minK); color[1] = (color[1] - minK) / (1.0 - minK); color[2] = (color[2] - minK) / (1.0 - minK); color[3] = minK; } } void CMYKtoRGB(float color[4]) { color[0] = 1.0 - (color[0] * (1.0 - color[3]) + color[3]); color[1] = 1.0 - (color[1] * (1.0 - color[3]) + color[3]); color[2] = 1.0 - (color[2] * (1.0 - color[3]) + color[3]); color[3] = 1.0; }
Initial URL
Initial Description
Initial Title
RGB/CMYK Conversion
Initial Tags
Initial Language
C++