1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-27 19:42:22 -05:00

MML/Core: Fixes for FindBitmapToleranceIn.

This commit is contained in:
Merlijn Wajer 2011-07-30 15:53:48 +02:00
parent 65f4ae16ed
commit 0422f0eb5a

View File

@ -107,7 +107,6 @@ uses
tpa, //TPABounds tpa, //TPABounds
dtmutil; dtmutil;
type type
TCTS0Info = record TCTS0Info = record
B, G, R, A: byte; B, G, R, A: byte;
@ -466,21 +465,24 @@ begin
end; end;
function Create_CTSInfo2DArray(cts, xs, ys, xe, ye: integer; bmp: TMufasaBitmap; function Create_CTSInfo2DArray(cts, w, h: integer; bmp: TMufasaBitmap;
Tolerance: Integer; hueMod, satMod: Extended): TCTSInfo2DArray; Tolerance: Integer; hueMod, satMod: Extended): TCTSInfo2DArray;
var var
x, y, w: integer; x, y: integer;
data: PRGB32;
begin begin
setlength(result,ye-ys+1,xe-xs+1); setlength(result,h+1,w+1);
w := bmp.width;
for y := ys to ye do data := bmp.fdata;
for x := xs to xe do
for y := 0 to h do
for x := 0 to w do
begin begin
{ This is kinda ugly. We call RGBToColor() here only to call ColorToRGB() { This is kinda ugly. We call RGBToColor() here only to call ColorToRGB()
later again in Create_CTSInfo) } later again in Create_CTSInfo) }
result[y-ys][x-xs] := Create_CTSInfo(cts, result[y][x] := Create_CTSInfo(cts,
rgbtocolor(bmp.fdata[y*w+x].R, bmp.fdata[y*w+x].G, rgbtocolor(data[y*w+x].R, data[y*w+x].G,
bmp.fdata[y*w+x].B), data[y*w+x].B),
Tolerance, hueMod, satMod); Tolerance, hueMod, satMod);
end; end;
end; end;
@ -1670,7 +1672,7 @@ begin
dX := dX - bmpW; dX := dX - bmpW;
dY := dY - bmpH; dY := dY - bmpH;
ctsinfoarray := Create_CTSInfo2DArray(Self.CTS, xs, ys, xe, ye, bitmap, ctsinfoarray := Create_CTSInfo2DArray(Self.CTS, bmpW, bmpH, bitmap,
Tolerance, self.hueMod, self.satMod); Tolerance, self.hueMod, self.satMod);
compare := Get_CTSCompare(Self.CTS); compare := Get_CTSCompare(Self.CTS);