1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-24 02:02:17 -05:00

FindBitmapToleranceIn now works.

This commit is contained in:
Merlijn Wajer 2011-06-16 15:11:17 +02:00
parent 58ea6021cd
commit 2e1e786d0e
2 changed files with 12 additions and 10 deletions

View File

@ -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;

View File

@ -357,7 +357,7 @@ function ColorSame_cts2(Tolerance: Integer; H1,S1,L1,H2,S2,L2, hueMod, satMod: e
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;
@ -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;