这位朋友是否要用来对图象进行四色分色啊?^_^
// R, G, B, C, M, Y each IN [0.0 .. 1.0]
PROCEDURE CMYtoRGB(CONST C,M,Y: TReal; VAR R,G,B: TReal);
BEGIN
R := 1.0 - C;
G := 1.0 - M;
B := 1.0 - Y
END {CMYtoRGB};
// R, G, B, C, M, Y each IN [0.0 .. 1.0]
PROCEDURE RGBtoCMY(CONST R,G,B: TReal; VAR C,M,Y: TReal);
BEGIN
C := 1.0 - R;
M := 1.0 - G;
Y := 1.0 - B
END {RGBtoCMY};
// == CMYK / RGB ======================================================
// R, G, B, C, M, Y, K each IN [0.0 .. 1.0]
PROCEDURE CMYKtoRGB(CONST C,M,Y,K: TReal; VAR R,G,B: TReal);
BEGIN
R := 1.0 - (C + K);
G := 1.0 - (M + K);
B := 1.0 - (Y + K)
END {CMYtoRGB};
// R, G, B, C, M, Y each IN [0.0 .. 1.0]
PROCEDURE RGBToCMYK(CONST R,G,B: TReal; VAR C,M,Y,K: TReal);
BEGIN
RGBtoCMY(R,G,B, C,M,Y);
K := MinValue([C, M, Y]);
C := C - K;
M := M - K;
Y := Y - K
END {RGBtoCMYK};