mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-07 03:38:06 -05:00
MML/Core: FindBitmapToleranceIn is nearly finished.
Speed is nice, results are not accurate yet. I probably missed something when pre-loading the data.
This commit is contained in:
parent
0422f0eb5a
commit
3b939443e8
@ -423,7 +423,7 @@ end;
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
function Create_CTSInfo(cts: integer; Color, Tol: Integer;
|
function Create_CTSInfo(cts: integer; Color, Tol: Integer;
|
||||||
hueMod, satMod: extended): Pointer;
|
hueMod, satMod: extended): Pointer; overload;
|
||||||
var
|
var
|
||||||
R, G, B: Integer;
|
R, G, B: Integer;
|
||||||
H, S, L: Integer;
|
H, S, L: Integer;
|
||||||
@ -456,6 +456,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function Create_CTSInfo(cts: integer; R, G, B, Tol: Integer;
|
||||||
|
hueMod, satMod: extended): Pointer; overload;
|
||||||
|
|
||||||
|
var Color: Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Color := RGBToColor(R, G, B);
|
||||||
|
Result := Create_CTSInfo(cts, Color, Tol, hueMod, satMod);
|
||||||
|
end;
|
||||||
procedure Free_CTSInfo(i: Pointer);
|
procedure Free_CTSInfo(i: Pointer);
|
||||||
begin
|
begin
|
||||||
if assigned(i) then
|
if assigned(i) then
|
||||||
@ -473,16 +483,14 @@ var
|
|||||||
begin
|
begin
|
||||||
setlength(result,h+1,w+1);
|
setlength(result,h+1,w+1);
|
||||||
|
|
||||||
|
w := bmp.width;
|
||||||
data := bmp.fdata;
|
data := bmp.fdata;
|
||||||
|
|
||||||
for y := 0 to h do
|
for y := 0 to h do
|
||||||
for x := 0 to w do
|
for x := 0 to w do
|
||||||
begin
|
begin
|
||||||
{ This is kinda ugly. We call RGBToColor() here only to call ColorToRGB()
|
|
||||||
later again in Create_CTSInfo) }
|
|
||||||
result[y][x] := Create_CTSInfo(cts,
|
result[y][x] := Create_CTSInfo(cts,
|
||||||
rgbtocolor(data[y*w+x].R, data[y*w+x].G,
|
data[y*w+x].R, data[y*w+x].G, data[y*w+x].B,
|
||||||
data[y*w+x].B),
|
|
||||||
Tolerance, hueMod, satMod);
|
Tolerance, hueMod, satMod);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1676,6 +1684,25 @@ begin
|
|||||||
Tolerance, self.hueMod, self.satMod);
|
Tolerance, self.hueMod, self.satMod);
|
||||||
compare := Get_CTSCompare(Self.CTS);
|
compare := Get_CTSCompare(Self.CTS);
|
||||||
|
|
||||||
|
// for yBmp := 0 to BmpH do
|
||||||
|
// begin
|
||||||
|
// tmpY := yBmp + yy;
|
||||||
|
// for xBmp := 0 to BmpW do
|
||||||
|
// begin
|
||||||
|
// writeln('BmpRowData: ' + IntToStr(BmpRowData[yBmp][xBmp].R) + ', ' +
|
||||||
|
// IntToStr(BmpRowData[yBmp][xBmp].G)
|
||||||
|
// + ', ' + IntToStr(BmpRowData[yBmp][xBmp].B));
|
||||||
|
//
|
||||||
|
// case self.cts of
|
||||||
|
// 0, 1: writeln('ctsinfo: ' +
|
||||||
|
// IntToStr(TCTS1Info(ctsinfoarray[yBmp][xBmp]).R) + ', ' +
|
||||||
|
// IntToStr(TCTS1Info(ctsinfoarray[yBmp][xBmp]).G) + ', ' +
|
||||||
|
// IntToStr(TCTS1Info(ctsinfoarray[yBmp][xBmp]).B));
|
||||||
|
// end;
|
||||||
|
//
|
||||||
|
// end;
|
||||||
|
// end;
|
||||||
|
|
||||||
//Get the "skip coords".
|
//Get the "skip coords".
|
||||||
CalculateBitmapSkipCoords(Bitmap,SkipCoords);
|
CalculateBitmapSkipCoords(Bitmap,SkipCoords);
|
||||||
for yy := 0 to dY do
|
for yy := 0 to dY do
|
||||||
|
Loading…
Reference in New Issue
Block a user