mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-21 16:55:01 -05:00
Added some new types, just made the hueXMod and satXMod variables for speeding up the tolerance finding procedures.
First commit. HA! git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@161 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
4157568bde
commit
892e09abc8
@ -30,83 +30,195 @@
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="5">
|
||||
<Units Count="9">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<CursorPos X="53" Y="63"/>
|
||||
<TopLine Value="35"/>
|
||||
<CursorPos X="20" Y="10"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="28"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="../../../../../../usr/lib64/fpc/2.2.4/source/packages/fcl-base/src/custapp.pp"/>
|
||||
<Filename Value="../../../../../usr/lib64/fpc/2.2.4/source/packages/fcl-base/src/custapp.pp"/>
|
||||
<UnitName Value="CustApp"/>
|
||||
<CursorPos X="15" Y="51"/>
|
||||
<TopLine Value="32"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<UnitName Value="Client"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
|
||||
<UnitName Value="windowutil"/>
|
||||
<CursorPos X="110" Y="30"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
<TopLine Value="3"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<UnitName Value="Window"/>
|
||||
<CursorPos X="40" Y="125"/>
|
||||
<TopLine Value="98"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../../Units/MMLCore/colour_conv.pas"/>
|
||||
<UnitName Value="colour_conv"/>
|
||||
<CursorPos X="24" Y="7"/>
|
||||
<TopLine Value="37"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<UnitName Value="finder"/>
|
||||
<CursorPos X="44" Y="632"/>
|
||||
<TopLine Value="621"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<UnitName Value="Input"/>
|
||||
<CursorPos X="20" Y="226"/>
|
||||
<TopLine Value="206"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
|
||||
<UnitName Value="MufasaTypes"/>
|
||||
<CursorPos X="40" Y="52"/>
|
||||
<TopLine Value="41"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
</Units>
|
||||
<JumpHistory Count="8" HistoryIndex="7">
|
||||
<JumpHistory Count="29" HistoryIndex="28">
|
||||
<Position1>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="77" Column="17" TopLine="42"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="64" Column="178" TopLine="52"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="10" Column="7" TopLine="3"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="769" Column="37" TopLine="745"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="763" Column="27" TopLine="746"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="167" Column="38" TopLine="157"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="766" Column="21" TopLine="751"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="12" Column="46" TopLine="3"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="792" Column="11" TopLine="777"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="88" Column="1" TopLine="51"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="796" Column="8" TopLine="790"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="11" Column="3" TopLine="1"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="865" Column="64" TopLine="786"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="59" Column="18" TopLine="40"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="66" Column="18" TopLine="63"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="797" Column="19" TopLine="797"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="846" Column="17" TopLine="822"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="820" Column="3" TopLine="807"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="824" Column="21" TopLine="800"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="799" Column="38" TopLine="796"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="66" Column="46" TopLine="43"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="869" Column="48" TopLine="857"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="895" Column="22" TopLine="874"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="904" Column="21" TopLine="892"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="879" Column="12" TopLine="876"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="911" Column="33" TopLine="900"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="956" Column="62" TopLine="930"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="67" Column="61" TopLine="55"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="916" Column="35" TopLine="906"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="991" Column="53" TopLine="979"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1007" Column="1" TopLine="994"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1035" Column="35" TopLine="1022"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1080" Column="24" TopLine="1057"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="64" Column="35" TopLine="46"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="688" Column="19" TopLine="676"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="461" Column="20" TopLine="451"/>
|
||||
</Position29>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -236,7 +236,7 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="MufasaTypes"/>
|
||||
<CursorPos X="26" Y="37"/>
|
||||
<TopLine Value="55"/>
|
||||
<TopLine Value="37"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="201"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -402,7 +402,7 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="bitmaps"/>
|
||||
<CursorPos X="22" Y="61"/>
|
||||
<TopLine Value="32"/>
|
||||
<TopLine Value="33"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="200"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -667,7 +667,7 @@
|
||||
<Unit90>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/math.inc"/>
|
||||
<CursorPos X="14" Y="17"/>
|
||||
<TopLine Value="3"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -829,7 +829,7 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="mmath"/>
|
||||
<CursorPos X="32" Y="42"/>
|
||||
<TopLine Value="47"/>
|
||||
<TopLine Value="42"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="125"/>
|
||||
<Loaded Value="True"/>
|
||||
|
@ -458,6 +458,7 @@ var
|
||||
PtrInc: Integer;
|
||||
dX, dY, clR, clG, clB, xx, yy: Integer;
|
||||
H1, S1, L1, H2, S2, L2: Extended;
|
||||
HueXTol, SatXTol: Extended;
|
||||
|
||||
label Hit;
|
||||
label Miss;
|
||||
@ -512,17 +513,18 @@ begin
|
||||
end;
|
||||
2:
|
||||
// Can be optimized a lot... RGBToHSL isn't really inline,
|
||||
// and hueMod * tol is also calculated every time.
|
||||
begin
|
||||
for yy := ys to ye do
|
||||
for xx := xs to xe do
|
||||
begin
|
||||
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,H2,S2,L2);
|
||||
if ((abs(H1 - H2) <= (hueMod * tol)) and (abs(S1 - S2) <= (satMod * tol)) and (abs(L1 - L2) <= Tol)) then
|
||||
HueXTol := hueMod * Tol;
|
||||
SatXTol := satMod * Tol;
|
||||
for yy := ys to ye do
|
||||
for xx := xs to xe do
|
||||
begin
|
||||
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,H2,S2,L2);
|
||||
if ((abs(H1 - H2) <= HueXTol) and (abs(S1 - S2) <= SatXTol) and (abs(L1 - L2) <= Tol)) then
|
||||
goto Hit;
|
||||
inc(Ptr);
|
||||
end;
|
||||
Inc(Ptr, PtrInc);
|
||||
inc(Ptr);
|
||||
end;
|
||||
Inc(Ptr, PtrInc);
|
||||
end;
|
||||
end;
|
||||
Result := False;
|
||||
@ -543,7 +545,7 @@ var
|
||||
Ptr: PRGB32;
|
||||
PtrInc,C: Integer;
|
||||
dX, dY, clR, clG, clB, xx, yy: Integer;
|
||||
H1, S1, L1, H2, S2, L2: Extended;
|
||||
H1, S1, L1, H2, S2, L2, hueXTol, satXTol: Extended;
|
||||
begin
|
||||
Result := false;
|
||||
DefaultOperations(xs,ys,xe,ye);
|
||||
@ -593,20 +595,23 @@ begin
|
||||
end;
|
||||
Inc(Ptr, PtrInc);
|
||||
end;
|
||||
|
||||
2:
|
||||
begin
|
||||
for yy := ys to ye do
|
||||
for xx := xs to xe do
|
||||
begin
|
||||
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,H2,S2,L2);
|
||||
if ((abs(H1 - H2) <= (hueMod * tol)) and (abs(S1 - S2) <= (satMod * tol)) and (abs(L1 - L2) <= Tol)) then
|
||||
begin;
|
||||
ClientTPA[c].x := xx;
|
||||
ClientTPA[c].y := yy;
|
||||
inc(c);
|
||||
end;
|
||||
inc(Ptr);
|
||||
end;
|
||||
HueXTol := hueMod * Tol;
|
||||
SatXTol := satMod * Tol;
|
||||
for yy := ys to ye do
|
||||
for xx := xs to xe do
|
||||
begin
|
||||
RGBToHSL(Ptr^.R,Ptr^.G,Ptr^.B,H2,S2,L2);
|
||||
if ((abs(H1 - H2) <= HueXTol) and (abs(S1 - S2) <= SatXTol) and (abs(L1 - L2) <= Tol)) then
|
||||
begin;
|
||||
ClientTPA[c].x := xx;
|
||||
ClientTPA[c].y := yy;
|
||||
Inc(c);
|
||||
end;
|
||||
Inc(Ptr);
|
||||
end;
|
||||
Inc(Ptr, PtrInc);
|
||||
end;
|
||||
end;
|
||||
@ -624,7 +629,7 @@ var
|
||||
c : integer;
|
||||
RowData : TPRGB32Array;
|
||||
dX, dY, clR, clG, clB, i,SpiralHi: Integer;
|
||||
H1, S1, L1, H2, S2, L2: Extended;
|
||||
H1, S1, L1, H2, S2, L2, HueXTol, SatXTol: Extended;
|
||||
begin
|
||||
Result := false;
|
||||
DefaultOperations(xs,ys,xe,ye);
|
||||
@ -669,16 +674,21 @@ begin
|
||||
end;
|
||||
|
||||
2:
|
||||
for i := 0 to SpiralHi do
|
||||
begin;
|
||||
RGBToHSL(RowData[ClientTPA[i].y][ClientTPA[i].x].R,
|
||||
RowData[ClientTPA[i].y][ClientTPA[i].x].G,
|
||||
RowData[ClientTPA[i].y][ClientTPA[i].x].B,H2,S2,L2);
|
||||
if ((abs(H1 - H2) <= (hueMod * Tolerance)) and (abs(S1 - S2) <= (satMod * Tolerance)) and (abs(L1 - L2) <= Tolerance)) then
|
||||
HueXTol := hueMod * Tolerance;
|
||||
SatXTol := satMod * Tolerance;
|
||||
for i := 0 to SpiralHi do
|
||||
begin;
|
||||
ClientTPA[c].x := ClientTPA[i].x + xs;
|
||||
ClientTPA[c].y := ClientTPA[i].y + ys;
|
||||
inc(c);
|
||||
RGBToHSL(RowData[ClientTPA[i].y][ClientTPA[i].x].R,
|
||||
RowData[ClientTPA[i].y][ClientTPA[i].x].G,
|
||||
RowData[ClientTPA[i].y][ClientTPA[i].x].B,
|
||||
H2,S2,L2);
|
||||
if ((abs(H1 - H2) <= (HueXTol)) and (abs(S1 - S2) <= (satXTol)) and (abs(L1 - L2) <= Tolerance)) then
|
||||
begin;
|
||||
ClientTPA[c].x := ClientTPA[i].x + xs;
|
||||
ClientTPA[c].y := ClientTPA[i].y + ys;
|
||||
inc(c);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -49,9 +49,11 @@ type
|
||||
TClickType = (mouse_Left, mouse_Right, mouse_Middle);
|
||||
TMousePress = (mouse_Down, mouse_Up);
|
||||
TPointArray = array of TPoint;
|
||||
T2DPointArray = array of TPointArray;
|
||||
TVariantArray = Array of Variant;
|
||||
TIntegerArray = Array of Integer;
|
||||
T2DIntArray = array of TIntegerArray;
|
||||
T2DIntegerArray = T2DIntArray;
|
||||
TBoolArray = array of boolean;
|
||||
T2DBoolArray = Array of TBoolArray;
|
||||
TExtendedArray = Array of Extended;
|
||||
|
Loading…
Reference in New Issue
Block a user