1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-30 12:52:16 -05:00

CTS: Cleanups.

This commit is contained in:
Merlijn Wajer 2011-06-13 20:21:23 +02:00
parent 14474a84ab
commit 7a412d1670

View File

@ -30,14 +30,12 @@ interface
{$define CheckAllBackground}//Undefine this to only check the first white point against the background (in masks). {$define CheckAllBackground}//Undefine this to only check the first white point against the background (in masks).
uses uses
colour_conv, Classes, SysUtils,bitmaps,MufasaBase,DTM, MufasaTypes; // Types colour_conv, Classes, SysUtils, bitmaps, DTM, MufasaTypes; // Types
{ TMFinder Class } { TMFinder Class }
{ {
Should be 100% OS independant, Should be 100% OS independant, as all OS dependant code is in the IO Manager.
as all OS dependant code is in the IO Manager
Let's try not to use any OS-specific defines here? ;) Let's try not to use any OS-specific defines here? ;)
} }
@ -101,19 +99,16 @@ type
implementation implementation
uses uses
// colour_conv,// For RGBToColor, etc. Client, // For the Client casting.
Client, // For the Client Casts.
math, // min/max math, // min/max
mmath,
tpa, //TPABounds tpa, //TPABounds
dtmutil dtmutil;
;
procedure TMFinder.LoadSpiralPath(startX, startY, x1, y1, x2, y2: Integer); procedure TMFinder.LoadSpiralPath(startX, startY, x1, y1, x2, y2: Integer);
var var
i,c,Ring : integer; i,c,Ring : integer;
CurrBox : TBox; CurrBox : TBox;
begin; begin
i := 0; i := 0;
Ring := 1; Ring := 1;
c := 0; c := 0;
@ -126,7 +121,7 @@ begin;
ClientTPA[c] := Point(Startx, StartY); ClientTPA[c] := Point(Startx, StartY);
Inc(c); Inc(c);
end; end;
Repeat repeat
if (CurrBox.x2 >= x1) and (CurrBox.x1 <= x2) and (Currbox.y1 >= y1) and (Currbox.y1 <= y2) then if (CurrBox.x2 >= x1) and (CurrBox.x1 <= x2) and (Currbox.y1 >= y1) and (Currbox.y1 <= y2) then
for i := CurrBox.x1 + 1 to CurrBox.x2 do for i := CurrBox.x1 + 1 to CurrBox.x2 do
if (I >= x1) and ( I <= x2) then if (I >= x1) and ( I <= x2) then
@ -168,7 +163,7 @@ function CalculateRowPtrs(ReturnData : TRetData; RowCount : integer) : TPRGB32Ar
var var
I : integer; I : integer;
begin; begin;
setlength(result,RowCount); SetLength(result,RowCount);
for i := 0 to RowCount - 1 do for i := 0 to RowCount - 1 do
result[i] := ReturnData.Ptr + ReturnData.RowLen * i; result[i] := ReturnData.Ptr + ReturnData.RowLen * i;
end; end;
@ -1043,7 +1038,6 @@ var
Ptr: PRGB32; Ptr: PRGB32;
PtrInc,C: Integer; PtrInc,C: Integer;
dX, dY, clR, clG, clB: Integer; dX, dY, clR, clG, clB: Integer;
H1, S1, L1, H2, S2, L2, hueXTol, satXTol: Extended;
procedure cts0; procedure cts0;
var xx, yy: integer; var xx, yy: integer;
@ -1086,7 +1080,9 @@ var
procedure cts2; procedure cts2;
var xx, yy: integer; var xx, yy: integer;
H1, S1, L1, H2, S2, L2, hueXTol, satXTol: Extended;
begin begin
ColorToHSL(color,H1,S1,L1);
HueXTol := hueMod * Tol; HueXTol := hueMod * Tol;
SatXTol := satMod * Tol; SatXTol := satMod * Tol;
for yy := ys to ye do for yy := ys to ye do
@ -1105,6 +1101,7 @@ var
Inc(Ptr, PtrInc); Inc(Ptr, PtrInc);
end; end;
end; end;
begin begin
Result := false; Result := false;
DefaultOperations(xs,ys,xe,ye); DefaultOperations(xs,ys,xe,ye);
@ -1113,8 +1110,6 @@ begin
dY := ye - ys; dY := ye - ys;
//next, convert the color to r,g,b //next, convert the color to r,g,b
ColorToRGB(Color, clR, clG, clB); ColorToRGB(Color, clR, clG, clB);
if CTS = 2 then
ColorToHSL(color,H1,S1,L1);
PtrData := TClient(Client).IOManager.ReturnData(xs, ys, dX + 1, dY + 1); PtrData := TClient(Client).IOManager.ReturnData(xs, ys, dX + 1, dY + 1);