To use this practically you'd have to do it like this:
{.include SRL/SRL.scar}
{.include SRL/SRL/misc/debug.scar}
type
TColorPointArray = record
Points: TPointArray;
Colors: TIntegerArray;
end;
function FindTCPA(var TCPA: TColorPointArray; Color, xs, ys, xe, ye, Tol: Integer): Boolean;
begin
Result := FindColorsTolerance(TCPA.Points, Color, xs, ys, xe, ye, Tol);
if (not (Result)) then
Exit;
TCPA.Colors := GetColors(TCPA.Points);
end;
function RemoveColorsInTPA(TCPA: TColorPointArray; Color: LongInt): TColorPointArray;
var
H, I, L: LongInt;
begin
H := High(TCPA);
for I := 0 to H do
if (TCPA.Colors[I] <> Color) then
begin
Inc(L);
SetLength(Result, L);
Result.Points[L - 1] := TCPA.Points[I];
Result.Colors[L - 1] := TCPA.Colors[I];
end;
end;
function RemoveColorsInTPATol(TCPA: TColorPointArray; Color, Tol: LongInt): TColorPointArray;
var
H, I, L: LongInt;
begin
H := High(TCPA);
for I := 0 to H do
if (not (SimilarColors(TCPA.Colors[I], Color, Tol))) then
begin
Inc(L);
SetLength(Result, L);
Result.Points[L - 1] := TCPA.Points[I];
Result.Colors[L - 1] := TCPA.Colors[I];
end;
end;
var
TCPA: TColorPointArray;
begin
SetUpSRL;
ActivateClient;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.2, 0.2);
FindTCPA(TCPA, 12344556, MSX1, MSY1, MSX2, MSY2, 5);
RemoveColorsInTPATol(TCPA, 1235932, 5);
SetColorspeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
DebugTPA(TCPA.Points, '');
end.