Simba Code:
Program CTS3;
{.include SRL\SRL.scar}
{.Include SRL\SRL\Misc\Debug.SCAR}
Procedure ReturnValues(colors: TIntegerArray; var HueMods, SatMods: Extended; var color, Tolerance: Integer);
Var
h, s, t: Extended;
I,II : integer;
HSLColor : Array[1..3] of Extended;
HSL : Array[0..1] of Array[1..3] of Extended;
begin;
For I:= 1 to 3 do
begin;
HSL[0][i] := 255;
end;
For I:= 0 to High(Colors) do
begin;
ColortoHSL(Colors[i],HSLColor[1],HSLColor[2],HSLColor[3]);
For II:= 1 to 3 do
begin;
HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
end;
end;
H := (HSL[1][1] - HSL[0][1]);
S := (HSL[1][2] - HSL[0][2]);
T := (HSL[1][3] - HSL[0][3]);
try
HueMods := (H/T);
SatMods := (S/T);
Tolerance := Round(t);
except
HueMods := 0;
SatMods := 0;
Tolerance := Round(0.0);
end;
Color := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
end;
Procedure DoitBro;
var
HMod, SMod:Extended;
Col, Tol: Integer;
TPA:TPointArray;
Begin
ReturnValues([2322763, 2455375, 2720856, 2388812, 2521938], Hmod, Smod, Col, Tol);
ColorToleranceSpeed(3); //CTS3
SetColorSpeed2Modifiers(Hmod, SMod);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Col, MSX1, MSY1, MSX2, MSY2, Tol);
DebugTPA(TPA,'');
End;
Begin
DoitBro;
End.
Is that all good?
Make sense?
Should work?