RGB
The most famous color encoding is an
aditive system with 3 components, Red, Green and Blue. Computer monitors emit color as RGB.
CMY
The complement of RGB, it’s a subtractive systems with 3 components: Cyan, Magenta and Yellow. The conversion from RGB is a simple
subtraction, since they complement each other.
When painting on a paper you are subtracting colors, meaning they will
be reflected.
RGB and CMY
values from 0 to 1
Implementation:
void
CMYtoRGB(double c, double m, double y, double* r, double* g, double* b)
{
assert(r &&
g && b);
assert(c >= 0
&& c <= 1);
assert(m >= 0
&& m <= 1);
assert(y >= 0 && y <= 1);
*r = ( 1 - c );
*g = ( 1 - m );
*b = ( 1 - y );
}