mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-23 17:52:16 -05:00
FindBitmapToleranceIn now works.
This commit is contained in:
parent
58ea6021cd
commit
2e1e786d0e
@ -884,13 +884,13 @@ var
|
|||||||
begin
|
begin
|
||||||
ValidatePoint(xs,ys);
|
ValidatePoint(xs,ys);
|
||||||
ValidatePoint(xe,ye);
|
ValidatePoint(xe,ye);
|
||||||
setlength(result,xe-xs+1,ye-ys+1);
|
setlength(result,ye-ys+1,xe-xs+1);
|
||||||
for y := ys to ye do
|
for y := ys to ye do
|
||||||
for x := xs to xe do
|
for x := xs to xe do
|
||||||
begin
|
begin { REWRITE THIS }
|
||||||
RGBToHSL(FData[y*w+x].R, FData[y*w+x].G, FData[y*w+x].B,
|
RGBToHSL(FData[y*w+x].R, FData[y*w+x].G, FData[y*w+x].B,
|
||||||
Result[x-xs][y-ys].H, Result[x-xs][y-ys].S,
|
Result[y-ys][x-xs].H, Result[y-ys][x-xs].S,
|
||||||
Result[x-xs][y-ys].L);
|
Result[y-ys][x-xs].L);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -353,12 +353,12 @@ begin
|
|||||||
Result := (Sqrt(sqr(R1-R2) + sqr(G1-G2) + sqr(B1-B2)) <= Tolerance);
|
Result := (Sqrt(sqr(R1-R2) + sqr(G1-G2) + sqr(B1-B2)) <= Tolerance);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ColorSame_cts2(Tolerance: Integer; H1,S1,L1,H2,S2,L2, hueMod, satMod: extended):
|
function ColorSame_cts2(Tolerance: Integer; H1, S1, L1, H2,S2,L2, hueMod, satMod: extended):
|
||||||
boolean; inline;
|
boolean; inline;
|
||||||
begin
|
begin
|
||||||
result := ((abs(H1 - H2) <= (hueMod * Tolerance)) and
|
result := ((abs(H1 - H2) <= (hueMod * Tolerance)) and
|
||||||
(abs(S2-S1) <= (satMod * Tolerance))
|
(abs(S1 - S2) <= (satMod * Tolerance))
|
||||||
and (abs(L1-L2) <= Tolerance));
|
and (abs(L1 - L2) <= Tolerance));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMFinder.UpdateCachedValues(NewWidth, NewHeight: integer);
|
procedure TMFinder.UpdateCachedValues(NewWidth, NewHeight: integer);
|
||||||
@ -1657,14 +1657,14 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function cts2: tpoint;
|
function cts2: tpoint;
|
||||||
var H1, S1, L1, H2, S2, L2, HMod, SMod: extended;
|
var H2, S2, L2, HMod, SMod: extended;
|
||||||
xx, yy, xBmp, yBmp, tmpY: integer;
|
xx, yy, xBmp, yBmp, tmpY: integer;
|
||||||
|
|
||||||
HSLRows: T2DHSLArray;
|
HSLRows: T2DHSLArray;
|
||||||
|
|
||||||
label NotFoundBmp;
|
label NotFoundBmp;
|
||||||
begin
|
begin
|
||||||
HSLRows := bitmap.GetHSLValues(0, 0, BmpW - 1, BmpH - 1);
|
HSLRows := bitmap.GetHSLValues(0, 0, BmpW, BmpH);
|
||||||
|
|
||||||
for yy := 0 to dY do
|
for yy := 0 to dY do
|
||||||
for xx := 0 to dX do
|
for xx := 0 to dX do
|
||||||
@ -1678,7 +1678,9 @@ var
|
|||||||
RGBToHSL(MainRowdata[tmpY][xBmp + xx].R, MainRowdata[tmpY][xBmp + xx].G,
|
RGBToHSL(MainRowdata[tmpY][xBmp + xx].R, MainRowdata[tmpY][xBmp + xx].G,
|
||||||
MainRowdata[tmpY][xBmp + xx].B, H2, S2, L2);
|
MainRowdata[tmpY][xBmp + xx].B, H2, S2, L2);
|
||||||
|
|
||||||
if not ColorSame_cts2(Tolerance, HSLRows[yBmp][xBmp].H, HSLRows[yBmp][xBmp].S, HSLRows[yBmp][xBmp].L,
|
if not ColorSame_cts2(Tolerance, HSLRows[yBmp][xBmp].H,
|
||||||
|
HSLRows[yBmp][xBmp].S, HSLRows[yBmp][xBmp].L,
|
||||||
|
//if not ColorSame_cts2(Tolerance, HSLRows[yBmp][xBmp].H, HSLRows[yBmp][xBmp].S, HSLRows[yBmp][xBmp].L,
|
||||||
H2, S2, L2, hueMod, satMod) then
|
H2, S2, L2, hueMod, satMod) then
|
||||||
goto NotFoundBmp;
|
goto NotFoundBmp;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user