uses Math;
function RGBtoCMYK(const rgbColor : TRGBColor) : TCMYKColor;
begin
with Result do
begin
Cyan := 1 - rgbColor.Red;
Magenta := 1 - rgbColor.Green;
Yellow := 1 - rgbColor.Blue;
KeyPlate := Min(Min(Cyan, Magenta), Yellow) ;
Cyan := Cyan - KeyPlate;
Magenta := Magenta - KeyPlate;
Yellow := Yellow - KeyPlate;
end;
end;
var
rgbColor : TRGBColor;
cmykColor : TCMYKColor;
begin
rgbColor.Red := 128;
rgbColor.Green := 64;
rgbColor.Blue := 192;
cmykColor := RGBtoCMYK(rgbColor) ;
Caption := Format('%d-%d-%d-%d',[cmykColor.Cyan, cmykColor.Magenta, cmykColor.Yellow, cmykColor.KeyPlate])
end;
No comments:
Post a Comment