mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-07 03:38:06 -05:00
Finder: More fixes. :-)
This commit is contained in:
parent
e6b005b61f
commit
733a8cbf32
@ -386,12 +386,9 @@ var
|
|||||||
begin
|
begin
|
||||||
C1 := PRGB32(ctsInfo)^;
|
C1 := PRGB32(ctsInfo)^;
|
||||||
b := C1.B - C2^.B;
|
b := C1.B - C2^.B;
|
||||||
b := b * b;
|
|
||||||
g := C1.G - C2^.G;
|
g := C1.G - C2^.G;
|
||||||
g := g * g;
|
|
||||||
r := C1.R - C2^.R;
|
r := C1.R - C2^.R;
|
||||||
r := r * r;
|
Result := (b*b + g*g + r*r) <= ToleranceSqr;
|
||||||
Result := (b + g + r) <= ToleranceSqr;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ColorSame_cts2(Tolerance: Integer; ctsInfo: Pointer; C2: PRGB32): boolean;
|
function ColorSame_cts2(Tolerance: Integer; ctsInfo: Pointer; C2: PRGB32): boolean;
|
||||||
@ -403,8 +400,8 @@ begin
|
|||||||
i := PCTS2Info(ctsInfo)^;
|
i := PCTS2Info(ctsInfo)^;
|
||||||
RGBToHSL(C2^.R, C2^.G, C2^.B, h, s, l); // Inline this later.
|
RGBToHSL(C2^.R, C2^.G, C2^.B, h, s, l); // Inline this later.
|
||||||
|
|
||||||
Result := (abs(h - i.H) <= (i.hueMod * Tolerance))
|
Result := (abs(h - i.H) <= (i.hueMod))
|
||||||
and (abs(s - i.S) <= (i.satMod * Tolerance))
|
and (abs(s - i.S) <= (i.satMod))
|
||||||
and (abs(l - i.L) <= Tolerance);
|
and (abs(l - i.L) <= Tolerance);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -838,7 +835,6 @@ begin
|
|||||||
Ptr := Before;
|
Ptr := Before;
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
Inc(Ptr, PtrInc);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Inc(Ptr);
|
Inc(Ptr);
|
||||||
@ -1177,49 +1173,6 @@ var
|
|||||||
compare: TCTSCompareFunction;
|
compare: TCTSCompareFunction;
|
||||||
ctsinfo: Pointer;
|
ctsinfo: Pointer;
|
||||||
|
|
||||||
procedure cts1;
|
|
||||||
var xx, yy: integer;
|
|
||||||
begin
|
|
||||||
for yy := ys to ye do
|
|
||||||
begin
|
|
||||||
for xx := xs to xe do
|
|
||||||
begin
|
|
||||||
if (Sqrt(sqr(clR-Ptr^.R) + sqr(clG - Ptr^.G) + sqr(clB - Ptr^.B)) <= Tol) then
|
|
||||||
begin
|
|
||||||
ClientTPA[c].x := xx;
|
|
||||||
ClientTPA[c].y := yy;
|
|
||||||
inc(c);
|
|
||||||
end;
|
|
||||||
inc(ptr);
|
|
||||||
end;
|
|
||||||
Inc(Ptr, PtrInc);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure cts2;
|
|
||||||
var xx, yy: integer;
|
|
||||||
H1, S1, L1, H2, S2, L2, hueXTol, satXTol: Extended;
|
|
||||||
begin
|
|
||||||
ColorToHSL(color,H1,S1,L1);
|
|
||||||
HueXTol := hueMod * Tol;
|
|
||||||
SatXTol := satMod * Tol;
|
|
||||||
for yy := ys to ye do
|
|
||||||
begin
|
|
||||||
for xx := xs to xe do
|
|
||||||
begin
|
|
||||||
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,H2,S2,L2);
|
|
||||||
if ((abs(H1 - H2) <= HueXTol) and (abs(S1 - S2) <= SatXTol) and (abs(L1 - L2) <= Tol)) then
|
|
||||||
begin
|
|
||||||
ClientTPA[c].x := xx;
|
|
||||||
ClientTPA[c].y := yy;
|
|
||||||
Inc(c);
|
|
||||||
end;
|
|
||||||
Inc(Ptr)
|
|
||||||
end;
|
|
||||||
Inc(Ptr, PtrInc);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ procedure cts3;
|
{ procedure cts3;
|
||||||
begin
|
begin
|
||||||
RGBToXYZ(clR, clG, clB, X, Y, Z);
|
RGBToXYZ(clR, clG, clB, X, Y, Z);
|
||||||
@ -1261,6 +1214,9 @@ begin
|
|||||||
ctsinfo := Create_CTSInfo(Self.CTS, Color, Tol, hueMod, satMod);
|
ctsinfo := Create_CTSInfo(Self.CTS, Color, Tol, hueMod, satMod);
|
||||||
compare := Get_CTSCompare(Self.CTS);
|
compare := Get_CTSCompare(Self.CTS);
|
||||||
|
|
||||||
|
if cts = 1 then
|
||||||
|
tol := tol * tol;
|
||||||
|
|
||||||
for yy := ys to ye do
|
for yy := ys to ye do
|
||||||
begin
|
begin
|
||||||
for xx := xs to xe do
|
for xx := xs to xe do
|
||||||
|
Loading…
Reference in New Issue
Block a user