mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-05 00:45:14 -05:00
More optimisations. Removed areashape for now.
One thing still needs to optimized - and that is the colour/tolerance matching. Not too hard, but LOTS of extra code. git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@263 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
e5fd4f2702
commit
481d3e3cd3
@ -11,7 +11,7 @@
|
||||
<TargetFileExt Value=""/>
|
||||
<Icon Value="0"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="2"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -35,10 +35,10 @@
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<CursorPos X="88" Y="89"/>
|
||||
<TopLine Value="61"/>
|
||||
<CursorPos X="40" Y="78"/>
|
||||
<TopLine Value="54"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="66"/>
|
||||
<UsageCount Value="70"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -54,7 +54,7 @@
|
||||
<CursorPos X="21" Y="51"/>
|
||||
<TopLine Value="35"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="28"/>
|
||||
<UsageCount Value="30"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
@ -70,7 +70,7 @@
|
||||
<CursorPos X="55" Y="251"/>
|
||||
<TopLine Value="236"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="27"/>
|
||||
<UsageCount Value="29"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
@ -83,10 +83,10 @@
|
||||
<Unit6>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<UnitName Value="finder"/>
|
||||
<CursorPos X="52" Y="1654"/>
|
||||
<TopLine Value="1645"/>
|
||||
<CursorPos X="18" Y="1692"/>
|
||||
<TopLine Value="1667"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="31"/>
|
||||
<UsageCount Value="33"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
@ -95,7 +95,7 @@
|
||||
<CursorPos X="56" Y="49"/>
|
||||
<TopLine Value="24"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="27"/>
|
||||
<UsageCount Value="29"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
@ -104,7 +104,7 @@
|
||||
<CursorPos X="1" Y="88"/>
|
||||
<TopLine Value="76"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<UsageCount Value="29"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
@ -113,7 +113,7 @@
|
||||
<CursorPos X="11" Y="361"/>
|
||||
<TopLine Value="330"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="28"/>
|
||||
<UsageCount Value="30"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
@ -142,7 +142,7 @@
|
||||
<CursorPos X="32" Y="835"/>
|
||||
<TopLine Value="850"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="26"/>
|
||||
<UsageCount Value="28"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
@ -177,25 +177,25 @@
|
||||
<CursorPos X="20" Y="5"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="24"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<UnitName Value="dtm"/>
|
||||
<CursorPos X="31" Y="74"/>
|
||||
<TopLine Value="123"/>
|
||||
<CursorPos X="33" Y="109"/>
|
||||
<TopLine Value="153"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="24"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="../../Units/MMLCore/dtmutil.pas"/>
|
||||
<UnitName Value="dtmutil"/>
|
||||
<CursorPos X="54" Y="196"/>
|
||||
<TopLine Value="173"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="201"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
@ -208,124 +208,124 @@
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1738" Column="59" TopLine="1718"/>
|
||||
<Filename Value="../../Units/MMLCore/dtmutil.pas"/>
|
||||
<Caret Line="39" Column="27" TopLine="24"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1743" Column="53" TopLine="1718"/>
|
||||
<Filename Value="../../Units/MMLCore/dtmutil.pas"/>
|
||||
<Caret Line="40" Column="27" TopLine="24"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1652" Column="33" TopLine="1643"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="90" Column="11" TopLine="64"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1661" Column="1" TopLine="1643"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="78" Column="19" TopLine="61"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1664" Column="17" TopLine="1637"/>
|
||||
<Caret Line="1796" Column="59" TopLine="1771"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1610" Column="19" TopLine="1594"/>
|
||||
<Caret Line="1789" Column="43" TopLine="1774"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../Units/MMLCore/dtmutil.pas"/>
|
||||
<Caret Line="41" Column="23" TopLine="26"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="707" Column="17" TopLine="697"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1607" Column="4" TopLine="1644"/>
|
||||
<Caret Line="51" Column="36" TopLine="36"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1420" Column="24" TopLine="1407"/>
|
||||
<Caret Line="1633" Column="15" TopLine="1619"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1603" Column="51" TopLine="1638"/>
|
||||
<Caret Line="51" Column="36" TopLine="36"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1609" Column="1" TopLine="1600"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="86" Column="19" TopLine="71"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1656" Column="123" TopLine="1644"/>
|
||||
<Caret Line="82" Column="26" TopLine="63"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1661" Column="42" TopLine="1651"/>
|
||||
<Caret Line="84" Column="26" TopLine="63"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1669" Column="49" TopLine="1654"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="79" Column="18" TopLine="61"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1664" Column="1" TopLine="1644"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="87" Column="42" TopLine="71"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="79" Column="40" TopLine="54"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1893" Column="47" TopLine="1868"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1620" Column="20" TopLine="1604"/>
|
||||
<Caret Line="1892" Column="27" TopLine="1877"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../Units/MMLCore/dtmutil.pas"/>
|
||||
<Caret Line="39" Column="27" TopLine="24"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1884" Column="45" TopLine="1877"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLCore/dtmutil.pas"/>
|
||||
<Caret Line="40" Column="27" TopLine="24"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1680" Column="83" TopLine="1669"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="90" Column="11" TopLine="64"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1892" Column="35" TopLine="1877"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="78" Column="19" TopLine="61"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1884" Column="19" TopLine="1869"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1796" Column="59" TopLine="1771"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="66" Column="18" TopLine="55"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1789" Column="43" TopLine="1774"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="88" Column="43" TopLine="61"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="707" Column="17" TopLine="697"/>
|
||||
<Caret Line="82" Column="26" TopLine="62"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="51" Column="36" TopLine="36"/>
|
||||
<Caret Line="84" Column="26" TopLine="62"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1633" Column="15" TopLine="1619"/>
|
||||
<Caret Line="1586" Column="16" TopLine="1571"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="51" Column="36" TopLine="36"/>
|
||||
<Caret Line="1794" Column="10" TopLine="1781"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="86" Column="19" TopLine="71"/>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="82" Column="88" TopLine="63"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="82" Column="26" TopLine="63"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="81" Column="16" TopLine="60"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="84" Column="26" TopLine="63"/>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<Caret Line="85" Column="17" TopLine="73"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
@ -336,13 +336,6 @@
|
||||
<OtherUnitFiles Value="$(ProjPath)/../../Units/MMLCore/;$(ProjPath)/../../Units/Misc/;$(ProjPath)/../../Units/MMLAddon/;$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)/;$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/;$(ProjPath)/../../Units/Linux/;$(LazarusDir)/components/mouseandkeyinput/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<VerifyObjMethodCallValidity Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
|
@ -61,13 +61,16 @@ begin
|
||||
C := TClient.Create;
|
||||
|
||||
bmp := TMufasaBitmap.Create;
|
||||
bmp.SetSize(10,10);
|
||||
FillChar(bmp.FData[0],sizeof(trgb32)*100, 0);
|
||||
bmp.FastSetPixel(8,8,255);
|
||||
bmp.SetSize(800,600);
|
||||
FillChar(bmp.FData[0],sizeof(trgb32)*800*600, 0);
|
||||
Randomize;
|
||||
for i := 0 to 200 do
|
||||
bmp.fastsetpixel(random(800), random(600), 255);
|
||||
{bmp.FastSetPixel(8,8,255);
|
||||
bmp.FastSetPixel(9,9,255);
|
||||
bmp.FastSetPixel(7,7,255);
|
||||
bmp.FastSetPixel(9,8,255);
|
||||
bmp.FastSetPixel(8,9,255);
|
||||
bmp.FastSetPixel(8,9,255); }
|
||||
C.MWindow.SetTarget(bmp);
|
||||
|
||||
|
||||
@ -75,19 +78,22 @@ begin
|
||||
dtm.p[0] := Point(2, 2);
|
||||
dtm.p[1] := Point(-3, -3);
|
||||
dtm.p[2] := Point(0, 0);
|
||||
dtm.c[0] := 255;
|
||||
dtm.asz[1] := 0;
|
||||
dtm.c[0] := 0;
|
||||
dtm.asz[1] := 1;
|
||||
dtm.ash[1] := dtm_Rectangle;
|
||||
|
||||
setlength(p, 0);
|
||||
setlength(p, 1);
|
||||
|
||||
time := GetTickCount;
|
||||
C.MFinder.FindDTMs(dtm, p, 0, 0,799, 599, 10);
|
||||
//C.MFinder.FindDTM(dtm, p[0].x, p[0].y, 0, 0,799, 599);
|
||||
writeln(inttostr(gettickcount - time));
|
||||
writeln(inttostr(length(p)));
|
||||
|
||||
C.MFinder.FindDTMs(dtm, p, 0, 0, 9, 9);
|
||||
for i := 0 to high(p) do
|
||||
writeln(format('%d: (%d, %d)', [i, p[i].x, p[i].y]));
|
||||
|
||||
|
||||
|
||||
|
||||
//bmp.OnDestroy:=nil;
|
||||
bmp.Free;
|
||||
C.Free;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="Mufasa Stand Alone"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="7"/>
|
||||
<ActiveEditorIndexAtStart Value="5"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -287,8 +287,8 @@
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="finder"/>
|
||||
<CursorPos X="108" Y="76"/>
|
||||
<TopLine Value="59"/>
|
||||
<CursorPos X="5" Y="1707"/>
|
||||
<TopLine Value="1673"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="201"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -380,7 +380,7 @@
|
||||
</Unit45>
|
||||
<Unit46>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
|
||||
<CursorPos X="1" Y="55"/>
|
||||
<CursorPos X="38" Y="47"/>
|
||||
<TopLine Value="38"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="100"/>
|
||||
@ -707,8 +707,8 @@
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="dtm"/>
|
||||
<CursorPos X="3" Y="74"/>
|
||||
<TopLine Value="59"/>
|
||||
<CursorPos X="3" Y="44"/>
|
||||
<TopLine Value="28"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="200"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -796,8 +796,8 @@
|
||||
</Unit106>
|
||||
<Unit107>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/>
|
||||
<CursorPos X="21" Y="75"/>
|
||||
<TopLine Value="50"/>
|
||||
<CursorPos X="33" Y="34"/>
|
||||
<TopLine Value="20"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="14"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -1828,124 +1828,124 @@
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="793" Column="11" TopLine="789"/>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="67" Column="43" TopLine="54"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="312" Column="29" TopLine="299"/>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="64" Column="40" TopLine="56"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="321" Column="17" TopLine="301"/>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="259" Column="57" TopLine="29"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="312" Column="1" TopLine="297"/>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="745" Column="34" TopLine="719"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="322" Column="54" TopLine="303"/>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="79" Column="44" TopLine="64"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="319" Column="60" TopLine="304"/>
|
||||
<Caret Line="329" Column="19" TopLine="309"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="320" Column="23" TopLine="309"/>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="177" Column="37" TopLine="159"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="461" Column="36" TopLine="452"/>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="210" Column="20" TopLine="195"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="67" Column="43" TopLine="54"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="304" Column="1" TopLine="290"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="64" Column="40" TopLine="56"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="28" Column="12" TopLine="13"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="259" Column="57" TopLine="29"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="33" Column="46" TopLine="23"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="745" Column="34" TopLine="719"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="43" Column="60" TopLine="28"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="79" Column="44" TopLine="64"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="46" Column="7" TopLine="31"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="329" Column="19" TopLine="309"/>
|
||||
<Caret Line="58" Column="41" TopLine="43"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="177" Column="37" TopLine="159"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="59" Column="3" TopLine="44"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="210" Column="20" TopLine="195"/>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="73" Column="65" TopLine="58"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="304" Column="1" TopLine="290"/>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="66" Column="20" TopLine="55"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="28" Column="12" TopLine="13"/>
|
||||
<Caret Line="75" Column="50" TopLine="60"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="33" Column="46" TopLine="23"/>
|
||||
<Caret Line="71" Column="39" TopLine="56"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="43" Column="60" TopLine="28"/>
|
||||
<Caret Line="72" Column="64" TopLine="57"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="46" Column="7" TopLine="31"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="58" Column="41" TopLine="43"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="59" Column="3" TopLine="44"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="73" Column="65" TopLine="58"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="66" Column="20" TopLine="55"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="75" Column="50" TopLine="60"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="71" Column="39" TopLine="56"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="72" Column="64" TopLine="57"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
|
||||
<Caret Line="258" Column="19" TopLine="245"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
|
||||
<Caret Line="16" Column="25" TopLine="1"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="82" Column="26" TopLine="59"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="84" Column="26" TopLine="59"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="82" Column="26" TopLine="61"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="83" Column="26" TopLine="61"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="85" Column="26" TopLine="61"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1696" Column="35" TopLine="1672"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="1682" Column="27" TopLine="1678"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="../../Units/MMLCore/dtm.pas"/>
|
||||
<Caret Line="74" Column="3" TopLine="59"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -40,7 +40,7 @@ var
|
||||
temp: pDTM;
|
||||
begin
|
||||
if CurrThread.Client.MDTM.GetDTM(DTM, temp) then
|
||||
Result := CurrThread.Client.MFinder.FindDTMs(temp, p, x1, y1, x2, y2)
|
||||
Result := CurrThread.Client.MFinder.FindDTMs(temp, p, x1, y1, x2, y2, 0)
|
||||
else
|
||||
begin
|
||||
setlength(p,0);
|
||||
|
@ -79,7 +79,7 @@ type
|
||||
function FindDeformedBitmapToleranceIn(bitmap: TMufasaBitmap; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean;
|
||||
|
||||
function FindDTM(DTM: pDTM; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
|
||||
function FindDTMs(DTM: pDTM; out Points: TPointArray; x1, y1, x2, y2: Integer): Boolean;
|
||||
function FindDTMs(DTM: pDTM; out Points: TPointArray; x1, y1, x2, y2, maxToFind: Integer): Boolean;
|
||||
function FindDTMRotated(DTM: pDTM; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;
|
||||
function FindDTMsRotated(DTM: pDTM; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean;
|
||||
|
||||
@ -1583,7 +1583,7 @@ function TMFinder.FindDTM(DTM: pDTM; out x, y: Integer; x1, y1, x2, y2: Integer)
|
||||
var
|
||||
P: TPointArray;
|
||||
begin
|
||||
Self.FindDTMs(DTM, P, x1, y1, x2, y2);
|
||||
Self.FindDTMs(DTM, P, x1, y1, x2, y2, 1);
|
||||
if(Length(p) > 0) then
|
||||
begin
|
||||
x := p[0].x;
|
||||
@ -1594,7 +1594,7 @@ begin
|
||||
end;
|
||||
|
||||
// TODO: Add a max count, so we can use it more efficiently for FindDTM?
|
||||
function TMFinder.FindDTMs(DTM: pDTM; out Points: TPointArray; x1, y1, x2, y2: Integer): Boolean;
|
||||
function TMFinder.FindDTMs(DTM: pDTM; out Points: TPointArray; x1, y1, x2, y2, maxToFind: Integer): Boolean;
|
||||
var
|
||||
// Colours of DTMs
|
||||
C: Array of Integer;
|
||||
@ -1623,7 +1623,7 @@ var
|
||||
// point count
|
||||
pc: Integer = 0;
|
||||
|
||||
label EndOfLoop;
|
||||
label theEnd;
|
||||
label AnotherLoopEnd;
|
||||
|
||||
|
||||
@ -1671,120 +1671,46 @@ begin
|
||||
|
||||
cd := CalculateRowPtrs(PtrData, h + 1);
|
||||
writeln(format('w,h: %d, %d', [w,h]));
|
||||
for yy := 0 to h do
|
||||
for xx := 0 to w do
|
||||
begin
|
||||
//writeln(format('x,y: %d, %d', [xx,yy]));
|
||||
|
||||
for yy := MA.y1 to MA.y2 do
|
||||
for xx := MA.x1 to MA.x2 do
|
||||
begin
|
||||
// main point
|
||||
if not TClient(Client).MFinder.SimilarColors(dtm.c[0], RGBToColor(cd[yy][xx].R, cd[yy][xx].G, cd[yy][xx].B), dtm.t[0]) then
|
||||
//if dtm.c[0] <> RGBToColor(cd[yy][xx].R, cd[yy][xx].G, cd[yy][xx].B) then
|
||||
if not SimilarColors(dtm.c[0], RGBToColor(cd[yy][xx].R, cd[yy][xx].G, cd[yy][xx].B), dtm.t[0]) then
|
||||
goto AnotherLoopEnd;
|
||||
b[xx][yy] := B[xx][yy] or 1;
|
||||
for i := 1 to dtm.l - 1 do
|
||||
begin // use square areashape - it covers all.
|
||||
begin //change to use other areashapes too.
|
||||
for xxx := xx - dtm.asz[i] + dtm.p[i].x to xx + dtm.asz[i] + dtm.p[i].x do
|
||||
for yyy := yy - dtm.asz[i] + dtm.p[i].y to yy + dtm.asz[i]+ dtm.p[i].y do
|
||||
begin
|
||||
// may want to remove this line, but I think it is a good optimisation.
|
||||
if B[xxx][yyy] and (1 shl i) = 0 then
|
||||
if TClient(Client).MFinder.SimilarColors(dtm.c[i], RGBToColor(cd[yyy][xxx].R, cd[yyy][xxx].G, cd[yyy][xxx].B), dtm.t[i]) then
|
||||
begin
|
||||
//if dtm.c[i] = RGBToColor(cd[yyy][xxx].R, cd[yyy][xxx].G, cd[yyy][xxx].B) then
|
||||
if SimilarColors(dtm.c[i], RGBToColor(cd[yyy][xxx].R, cd[yyy][xxx].G, cd[yyy][xxx].B), dtm.t[i]) then
|
||||
b[xxx][yyy] := B[xxx][yyy] or (1 shl i)
|
||||
else
|
||||
goto AnotherLoopEnd;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
//writeln(Format('Found point: (%d, %d)', [xx,yy]));
|
||||
ClientTPA[pc] := Point(xx, yy);
|
||||
Inc(pc);
|
||||
if(pc = maxToFind) then
|
||||
goto theEnd;
|
||||
AnotherLoopEnd:
|
||||
//writeln(format('b[%d][%d]: %d' ,[xx,yy,b[xx][yy]]));
|
||||
end;
|
||||
|
||||
{for yy := 0 to h do
|
||||
for xx := 0 to w do
|
||||
writeln(format('b[%d][%d]: %d' ,[xx,yy,b[xx][yy]])); }
|
||||
|
||||
// Now iterate over the data. (Main Point Bounds)
|
||||
for yy := MA.y1-y1 to MA.y2-y1 do
|
||||
for xx := MA.x1-x1 to MA.x2-x1 do
|
||||
begin
|
||||
//writeln(format('Testing for MP at %d, %d', [xx,yy]));
|
||||
//writeln(format('Testing for MP RealPoints at %d, %d', [xx+x1,yy+y1]));
|
||||
if (b[xx][yy] and 1) = 0 then
|
||||
continue;
|
||||
//writeln(format('Got a MP at %d, %d', [xx,yy]));
|
||||
//writeln(format('Got a MP Real Points at %d, %d', [xx+x1,yy+y1]));
|
||||
for i := 1 to dtm.l - 1 do
|
||||
begin
|
||||
//writeln(format('i: %d',[i]));
|
||||
case dtm.ash[i] of
|
||||
|
||||
{ Example:
|
||||
3x3 (AreaSize = 1)
|
||||
X X X
|
||||
X X X
|
||||
X X X }
|
||||
//areasize and areashape. areasize = 0 is completly valid
|
||||
dtm_Rectangle:
|
||||
begin
|
||||
//writeln(Format('X - From, To: %d, %d', [xx - dtm.asz[i]+ dtm.p[i].x, xx + dtm.asz[i]+ dtm.p[i].x]));
|
||||
for xxx := xx - dtm.asz[i] + dtm.p[i].x to xx + dtm.asz[i] + dtm.p[i].x do
|
||||
for yyy := yy - dtm.asz[i] + dtm.p[i].y to yy + dtm.asz[i]+ dtm.p[i].y do
|
||||
if b[xxx][yyy] and (1 shl i) = 0 then
|
||||
goto EndOfLoop;
|
||||
end;
|
||||
|
||||
{ Example:
|
||||
3x3 (AreaSize = 1)
|
||||
X
|
||||
X X X
|
||||
X }
|
||||
dtm_Cross:
|
||||
begin
|
||||
for xxx := xx - dtm.asz[i] + dtm.p[i].x to xx + dtm.asz[i] + dtm.p[i].x do
|
||||
begin
|
||||
//writeln(format('Cross - One. %d, %d', [xxx,dtm.p[i].y + yy]));
|
||||
if b[xxx][dtm.p[i].y + yy] and (1 shl i) = 0 then
|
||||
goto EndOfLoop;
|
||||
|
||||
end;
|
||||
for yyy := yy - dtm.asz[i] + dtm.p[i].y to yy + dtm.asz[i]+ dtm.p[i].y do
|
||||
begin
|
||||
//writeln(format('Cross - One. %d, %d', [dtm.p[i].x + xx,yyy]));
|
||||
if b[dtm.p[i].x + xx][yyy] and (1 shl i) = 0 then
|
||||
goto EndOfLoop;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Example:
|
||||
3x3 (AreaSize = 1)
|
||||
X X
|
||||
X
|
||||
X X }
|
||||
dtm_DiagonalCross:
|
||||
begin
|
||||
for xxx := -dtm.asz[i] to dtm.asz[i] do
|
||||
begin
|
||||
if b[xx + dtm.p[i].x + xxx][yy + dtm.p[i].y + xxx] and (1 shl i) = 0 then
|
||||
goto EndOfLoop;
|
||||
if b[xx + dtm.p[i].x + xxx][yy + dtm.p[i].y + xxx] and (1 shl i) = 0 then
|
||||
goto EndOfLoop;
|
||||
end;
|
||||
end
|
||||
|
||||
else
|
||||
begin
|
||||
raise exception.createFMT('FindDTMs: Invalid Areashape!', []);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
// point [xx,yy] found if we make it to here
|
||||
//writeln(Format('Wat (Real Points): %d, %d', [xx+x1, yy+y1])); //Good old wat!
|
||||
end;
|
||||
ClientTPA[pc] := Point(xx+x1, yy+y1);
|
||||
Inc(pc);
|
||||
//writeln(Format('Found a Point: %d, %d', [xx+x1, yy+y1]));
|
||||
EndOfLoop:
|
||||
end;
|
||||
TheEnd:
|
||||
TClient(Client).MWindow.FreeReturnData;
|
||||
|
||||
SetLength(Points, pc);
|
||||
Move(ClientTPA[0], Points[0], pc * SizeOf(TPoint));
|
||||
if pc > 0 then
|
||||
Move(ClientTPA[0], Points[0], pc * SizeOf(TPoint));
|
||||
end;
|
||||
|
||||
function TMFinder.FindDTMRotated(DTM: pDTM; out x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user