hej
słuchajcie jak uzyskać barwę dopełniającą ? tak jak na kole kolorów np http://colorschemedesigner.com/
kliknijcie complementary color. jeśli wybieram czerwone tło dla tshape to chciałbym aby tekst labela na nim był zielony
RGBtoTColor - wygooglałem
ColorRGBToHLS i ColorHLSToRGB - moduł graphutil
colorToRGB - moduł graphics
mam tyle - pytanie ile trzeba dodać lub odjąć do hue żebym uzyskał przeciwną wartość ? albo może coś w kodzie robię źle ?
uses graphutil, graphics
Function RGBtoTColor(const r,g,b:byte):Tcolor;
begin
Result:=B Shl 16 Or
G Shl 8 Or
R;
//Result := ((R and $FF) shl 16) +
//((G and $FF) shl 8) + (B and $FF);
end;
Function TfrmGlowna.ComplementaryColor(ksztalt:tshape):Tcolor;
var
rgb : Longint;
h,l,s : word;
gotowy : tcolor;
Begin
RGB:=colorToRGB(ksztalt.Brush.Color);
ColorRGBToHLS(rgb,h,l,s);
h:=h+180;
//if h>360 then dec(h,360);
rgb:=ColorHLSToRGB(h,l,s);
gotowy:=rgbtotcolor(GetRValue(rgb),GetGValue(rgb),GetBValue(rgb));
result:=gotowy;
End;