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
RGBtoCMY(double r, double g, double b, double* c, double* m, double* y)
{
assert(c && m && y);
*c = 1 - r;
*m = 1 - g;
*y = 1 - b;
}