jvcllaz: Fix compilation with Laz 2.0.x

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8163 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-12-01 21:54:20 +00:00
parent 5d293d70c8
commit 8faf907fa5

View File

@ -904,6 +904,46 @@ begin
Result := Application.Handle;
end;
{$IF LCL_FullVersion < 2010000}
// THESE ROUTINES ARE BORROWED FROM LAZARUS v2.1+ GRAPHUTILS
{ Assumes R, G, B to be in range 0..255. Calculates H, S, V in range 0..1
From: http://axonflux.com/handy-rgb-to-hsl-and-rgb-to-hsv-color-model-c }
procedure RGBToHSV(R, G, B: Integer; out H, S, V: Double);
var
rr, gg, bb: Double;
cmax, cmin, delta: Double;
begin
rr := R / 255;
gg := G / 255;
bb := B / 255;
cmax := MaxValue([rr, gg, bb]);
cmin := MinValue([rr, gg, bb]);
delta := cmax - cmin;
if delta = 0 then
begin
H := 0;
S := 0;
end else
begin
if cmax = rr then
H := (gg - bb) / delta + IfThen(gg < bb, 6, 0)
else if cmax = gg then
H := (bb - rr) / delta + 2
else if (cmax = bb) then
H := (rr -gg) / delta + 4;
H := H / 6;
S := delta / cmax;
end;
V := cmax;
end;
procedure ColorToHSV(c: TColor; out H, S, V: Double);
begin
RGBToHSV(GetRValue(c), GetGValue(c), GetBValue(c), H, S, V);
end;
{$IFEND}
(***************** NOT CONVERTED ***
type
TWaitCursor = class(TInterfacedObject, IInterface)