1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-27 11:32:18 -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
ValidatePoint(xs,ys);
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 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,
Result[x-xs][y-ys].H, Result[x-xs][y-ys].S,
Result[x-xs][y-ys].L);
Result[y-ys][x-xs].H, Result[y-ys][x-xs].S,
Result[y-ys][x-xs].L);
end;
end;

View File

@ -357,7 +357,7 @@ function ColorSame_cts2(Tolerance: Integer; H1,S1,L1,H2,S2,L2, hueMod, satMod: e
boolean; inline;
begin
result := ((abs(H1 - H2) <= (hueMod * Tolerance)) and
(abs(S2-S1) <= (satMod * Tolerance))
(abs(S1 - S2) <= (satMod * Tolerance))
and (abs(L1 - L2) <= Tolerance));
end;
@ -1657,14 +1657,14 @@ var
end;
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;
HSLRows: T2DHSLArray;
label NotFoundBmp;
begin
HSLRows := bitmap.GetHSLValues(0, 0, BmpW - 1, BmpH - 1);
HSLRows := bitmap.GetHSLValues(0, 0, BmpW, BmpH);
for yy := 0 to dY do
for xx := 0 to dX do
@ -1678,7 +1678,9 @@ var
RGBToHSL(MainRowdata[tmpY][xBmp + xx].R, MainRowdata[tmpY][xBmp + xx].G,
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
goto NotFoundBmp;
end;