颜色是一个长整数
下面是对其值的变换//在Windows单元中
{ Translated from WINGDI.H }
function MakeROP4(fore, back: DWORD): DWORD;
begin
Result := ((back shl 8) and DWORD($FF000000)) or fore;
end;
function GetKValue(cmyk: COLORREF): Byte;
begin
Result := Byte(cmyk);
end;
function GetYValue(cmyk: COLORREF): Byte;
begin
Result := Byte(cmyk shr 8);
end;
function GetMValue(cmyk: COLORREF): Byte;
begin
Result := Byte(cmyk shr 16);
end;
function GetCValue(cmyk: COLORREF): Byte;
begin
Result := Byte(cmyk shr 24);
end;
function CMYK(c, m, y, k: Byte): COLORREF;
begin
Result := (k or (y shl 8) or (m shl 16) or (c shl 24));
end;
function RGB(r, g, b: Byte): COLORREF;
begin
Result := (r or (g shl 8) or (b shl 16));
end;
function PaletteRGB(r, g, b: Byte): COLORREF;
begin
Result := $02000000 or RGB(r,g,b);
end;
function PaletteIndex(i: Word): COLORREF;
begin
Result := $01000000 or i;
end;
function GetRValue(rgb: DWORD): Byte;
begin
Result := Byte(rgb);
end;
function GetGValue(rgb: DWORD): Byte;
begin
Result := Byte(rgb shr 8);
end;
function GetBValue(rgb: DWORD): Byte;
begin
Result := Byte(rgb shr 16);
end;