1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-21 16:55:01 -05:00

Added FindColoredArea and FindColoredAreaTolerance.

--Esta línea y las que están debajo serán ignoradas--
M    Units/MMLAddon/PSInc/Wrappers/colour.inc
M    Units/MMLAddon/PSInc/psexportedmethods.inc
M    Units/MMLCore/finder.pas
M    Projects/SAMufasaGUI/testunit.lfm
M    Projects/SAMufasaGUI/project1.lpi
M    Projects/SAMufasaGUI/testunit.lrs


git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@285 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Cazax 2009-12-17 17:49:44 +00:00
parent 162d716f15
commit 025aceb591
6 changed files with 2271 additions and 2022 deletions

View File

@ -10,7 +10,7 @@
<TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="11"/>
<ActiveEditorIndexAtStart Value="7"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -167,8 +167,9 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="61" Y="756"/>
<TopLine Value="110"/>
<ComponentState Value="1"/>
<CursorPos X="55" Y="46"/>
<TopLine Value="1"/>
<EditorIndex Value="4"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
@ -224,8 +225,8 @@
<Filename Value="../../Units/MMLCore/client.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Client"/>
<CursorPos X="20" Y="66"/>
<TopLine Value="1"/>
<CursorPos X="51" Y="41"/>
<TopLine Value="15"/>
<EditorIndex Value="1"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
@ -234,8 +235,8 @@
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="MufasaTypes"/>
<CursorPos X="14" Y="2"/>
<TopLine Value="1"/>
<CursorPos X="49" Y="92"/>
<TopLine Value="77"/>
<EditorIndex Value="0"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
@ -259,8 +260,8 @@
<Filename Value="../../Units/MMLCore/window.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Window"/>
<CursorPos X="59" Y="635"/>
<TopLine Value="605"/>
<CursorPos X="73" Y="291"/>
<TopLine Value="274"/>
<EditorIndex Value="3"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
@ -278,7 +279,7 @@
<CursorPos X="23" Y="8"/>
<TopLine Value="1"/>
<EditorIndex Value="14"/>
<UsageCount Value="61"/>
<UsageCount Value="63"/>
<Loaded Value="True"/>
</Unit31>
<Unit32>
@ -292,8 +293,8 @@
<Filename Value="../../Units/MMLCore/finder.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="finder"/>
<CursorPos X="75" Y="1710"/>
<TopLine Value="1653"/>
<CursorPos X="25" Y="820"/>
<TopLine Value="807"/>
<EditorIndex Value="7"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
@ -408,7 +409,7 @@
<IsPartOfProject Value="True"/>
<UnitName Value="bitmaps"/>
<CursorPos X="70" Y="896"/>
<TopLine Value="882"/>
<TopLine Value="52"/>
<EditorIndex Value="2"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
@ -712,8 +713,8 @@
<Filename Value="../../Units/MMLCore/dtm.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="dtm"/>
<CursorPos X="7" Y="139"/>
<TopLine Value="109"/>
<CursorPos X="62" Y="135"/>
<TopLine Value="1"/>
<EditorIndex Value="11"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
@ -808,7 +809,7 @@
<CursorPos X="33" Y="34"/>
<TopLine Value="30"/>
<EditorIndex Value="13"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit107>
<Unit108>
@ -1002,7 +1003,7 @@
<UnitName Value="web"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="167"/>
<UsageCount Value="171"/>
</Unit136>
<Unit137>
<Filename Value="../../../lazarus/lcl/lazhelphtml.pas"/>
@ -1201,7 +1202,7 @@
<UnitName Value="framescript"/>
<CursorPos X="106" Y="190"/>
<TopLine Value="180"/>
<UsageCount Value="160"/>
<UsageCount Value="164"/>
</Unit161>
<Unit162>
<Filename Value="framesynedit.lrs"/>
@ -1513,10 +1514,11 @@
<ComponentName Value="ColourHistoryForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="colourhistory"/>
<CursorPos X="36" Y="135"/>
<ComponentState Value="1"/>
<CursorPos X="72" Y="21"/>
<TopLine Value="13"/>
<EditorIndex Value="5"/>
<UsageCount Value="97"/>
<UsageCount Value="101"/>
<Loaded Value="True"/>
</Unit208>
<Unit209>
@ -1767,7 +1769,7 @@
<UnitName Value="about"/>
<CursorPos X="44" Y="21"/>
<TopLine Value="4"/>
<UsageCount Value="60"/>
<UsageCount Value="64"/>
</Unit245>
<Unit246>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
@ -1781,7 +1783,7 @@
<UnitName Value="internets"/>
<CursorPos X="87" Y="3"/>
<TopLine Value="1"/>
<UsageCount Value="54"/>
<UsageCount Value="58"/>
</Unit247>
<Unit248>
<Filename Value="debugimageform.pas"/>
@ -1790,7 +1792,7 @@
<UnitName Value="debugimageform"/>
<CursorPos X="20" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="41"/>
<UsageCount Value="45"/>
</Unit248>
<Unit249>
<Filename Value="debugimage.pas"/>
@ -1799,10 +1801,10 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="debugimage"/>
<ComponentState Value="1"/>
<CursorPos X="62" Y="62"/>
<TopLine Value="1"/>
<CursorPos X="87" Y="39"/>
<TopLine Value="20"/>
<EditorIndex Value="6"/>
<UsageCount Value="40"/>
<UsageCount Value="44"/>
<Loaded Value="True"/>
</Unit249>
<Unit250>
@ -1874,124 +1876,124 @@
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="debugimage.pas"/>
<Caret Line="115" Column="99" TopLine="94"/>
<Filename Value="testunit.pas"/>
<Caret Line="993" Column="49" TopLine="736"/>
</Position1>
<Position2>
<Filename Value="testunit.pas"/>
<Caret Line="1053" Column="33" TopLine="1049"/>
<Caret Line="817" Column="39" TopLine="23"/>
</Position2>
<Position3>
<Filename Value="debugimage.pas"/>
<Caret Line="81" Column="35" TopLine="78"/>
</Position3>
<Position4>
<Filename Value="debugimage.pas"/>
<Caret Line="71" Column="47" TopLine="59"/>
</Position4>
<Position5>
<Filename Value="testunit.pas"/>
<Caret Line="1052" Column="53" TopLine="1049"/>
</Position5>
<Position6>
<Filename Value="testunit.pas"/>
<Caret Line="993" Column="49" TopLine="736"/>
</Position6>
<Position7>
<Filename Value="testunit.pas"/>
<Caret Line="817" Column="39" TopLine="23"/>
</Position7>
<Position8>
<Filename Value="testunit.pas"/>
<Caret Line="24" Column="53" TopLine="1"/>
</Position8>
<Position9>
</Position3>
<Position4>
<Filename Value="colourhistory.pas"/>
<Caret Line="7" Column="88" TopLine="1"/>
</Position4>
<Position5>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="162" Column="14" TopLine="132"/>
</Position5>
<Position6>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="47" Column="69" TopLine="36"/>
</Position6>
<Position7>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="51" Column="33" TopLine="36"/>
</Position7>
<Position8>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="153" Column="37" TopLine="133"/>
</Position8>
<Position9>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="111" Column="51" TopLine="92"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="162" Column="14" TopLine="132"/>
<Caret Line="180" Column="19" TopLine="160"/>
</Position10>
<Position11>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="47" Column="69" TopLine="36"/>
<Caret Line="182" Column="30" TopLine="160"/>
</Position11>
<Position12>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="51" Column="33" TopLine="36"/>
<Caret Line="179" Column="65" TopLine="152"/>
</Position12>
<Position13>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="153" Column="37" TopLine="133"/>
<Caret Line="180" Column="9" TopLine="152"/>
</Position13>
<Position14>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="111" Column="51" TopLine="92"/>
<Caret Line="182" Column="25" TopLine="152"/>
</Position14>
<Position15>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="180" Column="19" TopLine="160"/>
<Caret Line="183" Column="8" TopLine="152"/>
</Position15>
<Position16>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="182" Column="30" TopLine="160"/>
<Caret Line="184" Column="8" TopLine="152"/>
</Position16>
<Position17>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="179" Column="65" TopLine="152"/>
<Caret Line="202" Column="10" TopLine="182"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="180" Column="9" TopLine="152"/>
<Caret Line="240" Column="10" TopLine="220"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="182" Column="25" TopLine="152"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="376" Column="10" TopLine="358"/>
</Position19>
<Position20>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="183" Column="8" TopLine="152"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="49" Column="28" TopLine="29"/>
</Position20>
<Position21>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="184" Column="8" TopLine="152"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="376" Column="16" TopLine="356"/>
</Position21>
<Position22>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="202" Column="10" TopLine="182"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="389" Column="18" TopLine="356"/>
</Position22>
<Position23>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="240" Column="10" TopLine="220"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="396" Column="16" TopLine="376"/>
</Position23>
<Position24>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="376" Column="10" TopLine="358"/>
<Caret Line="408" Column="18" TopLine="376"/>
</Position24>
<Position25>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="49" Column="28" TopLine="29"/>
<Caret Line="448" Column="16" TopLine="428"/>
</Position25>
<Position26>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="376" Column="16" TopLine="356"/>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="581" Column="23" TopLine="566"/>
</Position26>
<Position27>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="389" Column="18" TopLine="356"/>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="548" Column="15" TopLine="544"/>
</Position27>
<Position28>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="396" Column="16" TopLine="376"/>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="856" Column="14" TopLine="854"/>
</Position28>
<Position29>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="408" Column="18" TopLine="376"/>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="848" Column="22" TopLine="836"/>
</Position29>
<Position30>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="448" Column="16" TopLine="428"/>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="856" Column="37" TopLine="837"/>
</Position30>
</JumpHistory>
</ProjectOptions>

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 331
Left = 274
Height = 557
Top = 119
Top = 121
Width = 731
ActiveControl = ScriptPanel
Caption = 'THA FUKING MUFASA'
@ -972,6 +972,42 @@ object Form1: TForm1
end
object MenuItemFind: TMenuItem
Action = ActionFindStart
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000001010120020202CF141414FF393939CF000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000001010130020202EF151515FF3A3A3AFF606060FF000000000000
0000000000000000000000000000000000000000000000000000000000000000
000001010130020202EF151515FF3B3B3BFF606060FF808080CF000000000000
0000000000000000000000000000000000000000000000000000000000000101
0130020202EF151515FF3B3B3BFF616161FF818181CF8C8C8C10000000000000
0000000000008C8C8C508C8C8C9F8C8C8CBF8C8C8CBF8C8C8C8F545454500202
02EF161616FF3B3B3BFF616161FF818181CF8C8C8C1000000000000000008C8C
8C108C8C8CBF8C8C8CFFA29F9AFFBEB6ABFFB7B0A5FF9A9894FF8C8C8CFF6060
60FF3C3C3CFF616161FF818181CF8C8C8C1000000000000000008C8C8C108C8C
8CCFA29F9CFFE9DFCFFFFFF0DAFFFFEED5FFFFECD0FFFFEBCCFFDBCCB5FF9392
90FF7C7C7CFF818181CF8C8C8C100000000000000000000000008C8C8C809393
92FFF1E8DCFFFFF4E3FFFFF2DEFFFFF0D9FFFFEED5FFFFECD0FFFFEBCCFFDBCC
B5FF8C8C8CFF8C8C8C50000000000000000000000000000000008C8C8CEFBEBC
B7FFFFF7ECFFFFF5E7FFFFF4E2FFFFF2DEFFFFF0D9FFFFEED5FFFFECD0FFFFEB
CBFFA29E97FF8C8C8CAF000000000000000000000000000000008C8C8CFFE2DF
DAFFFFF9F0FFFFF7EBFFFFF5E7FFFFF4E2FFFFF2DDFFFFF0D9FFFFEED4FFFFEC
D0FFC6BBACFF8C8C8CCF000000000000000000000000000000008C8C8CFFE2E0
DDFFFFFBF4FFFFF9F0FFFFF7EBFFFFF5E6FFFFF3E2FFFFF2DDFFFFF0D9FFFFEE
D4FFC6BCAEFF8C8C8CEF000000000000000000000000000000008C8C8CFFD4D3
D2FFFFFCF9FFFFFBF4FFFFF9EFFFFFF7EBFFFFF5E6FFFFF3E2FFFFF2DDFFFFF2
DDFFB7B1A7FF8C8C8CBF000000000000000000000000000000008C8C8CAF9A9A
9AFFFFFEFDFFFFFCF8FFFFFBF4FFFFF9EFFFFFF7EAFFFFF6E8FFFFFAF2FFF1E8
DBFF939291FF8C8C8C70000000000000000000000000000000008C8C8C308C8C
8CFFB7B7B7FFFFFEFDFFFFFEFCFFFFFDF9FFFFFDF9FFFFFEFCFFF8F2E8FFA29F
9CFF8C8C8CDF8C8C8C1000000000000000000000000000000000000000008C8C
8C608C8C8CFF9A9A9AFFD4D3D2FFE2E1DFFFE2E0DCFFCDC9C3FF939392FF8C8C
8CEF8C8C8C300000000000000000000000000000000000000000000000000000
00008C8C8C308C8C8CAF8C8C8CFF8C8C8CFF8C8C8CFF8C8C8CEF8C8C8C9F8C8C
8C10000000000000000000000000000000000000000000000000
}
ImageIndex = 26
OnClick = ActionFindstartExecute
end

File diff suppressed because it is too large Load Diff

View File

@ -82,3 +82,14 @@ function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color
begin;
result := CurrThread.Client.MFinder.FindColorsSpiralTolerance(x,y,Points,color,xs,ys,xe,ye,tolerance);
end;
function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea: Integer): Boolean;
begin;
result := CurrThread.Client.MFinder.FindColoredArea(x,y,color,xs,ys,xe,ye,minarea);
end;
function FindColoredAreaTolerance(var x, y: Integer; Color, xs, ys, xe, ye, MinArea, tol: Integer): Boolean;
begin;
result := CurrThread.Client.MFinder.FindColoredAreaTolerance(x,y,color,xs,ys,xe,ye,minarea,tol);
end;

View File

@ -110,8 +110,9 @@ AddFunction(@FindColorsToleranceOptimised,'function FindColorsToleranceOptimised
AddFunction(@FindColorsTolerance,'function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;');
AddFunction(@FindColorSpiral,'function FindColorSpiral(var x, y: Integer; color, xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@FindColorsSpiralTolerance,'function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;');
AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);');
AddFunction(@SetColorToleranceSpeed, 'procedure SetColorToleranceSpeed(cts: integer);');
AddFunction(@FindColoredArea, 'function FindColoredArea(var x, y : Integer; color, xs, ys, xe, ye, MinArea : Integer): Boolean');
AddFunction(@FindColoredAreaTolerance, 'function FindColoredAreaTolerance(var x, y : Integer; color, xs, ys, xe, ye, MinArea, Tolerance : Integer): Boolean');
AddFunction(@ColorToHSL, 'procedure ColorToHSL(c: integer; out r,g,b: extended);');
{Mouse etc.}

View File

@ -67,6 +67,8 @@ type
function FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tol: Integer): Boolean;
function FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean;
function FindColors(out TPA: TPointArray; Color, xs, ys, xe, ye: Integer): Boolean;
function FindColoredArea(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea: Integer): Boolean;
function FindColoredAreaTolerance(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea, tol: Integer): Boolean;
//Mask
function FindBitmapMaskTolerance(mask: TMask; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean;
procedure CheckMask(Mask : TMask);
@ -511,6 +513,81 @@ begin
TClient(Client).MWindow.FreeReturnData;
end;
function TMFinder.FindColoredArea(var x, y: Integer; Color, xs, ys, xe, ye, MinArea: Integer): Boolean;
var
PtrData: TRetData;
Ptr, Before: PRGB32;
PtrInc: Integer;
dX, dY, clR, clG, clB, xx, yy, fx, fy, Count : Integer;
NotFound : Boolean;
begin
Result := false;
Count := 0;
// checks for valid xs,ys,xe,ye? (may involve GetDimensions)
DefaultOperations(xs,ys,xe,ye);
// calculate delta x and y
dX := xe - xs;
dY := ye - ys;
//next, convert the color to r,g,b
ColorToRGB(Color, clR, clG, clB);
PtrData := TClient(Client).MWindow.ReturnData(xs, ys, dX + 1, dY + 1);
// Do we want to "cache" these vars?
// We will, for now. Easier to type.
Ptr := PtrData.Ptr;
PtrInc := PtrData.IncPtrWith;
for yy := ys to ye do
begin;
for xx := xs to xe do
begin;
NotFound := False;
// Colour comparison here. Possibly with tolerance? ;)
if (Ptr^.R = clR) and (Ptr^.G = clG) and (Ptr^.B = clB) then
begin
Before := Ptr;
for fy := yy to ye do
begin
for fx := xx to xe do
begin
Inc(Ptr);
if not ((Ptr^.R = clR) and (Ptr^.G = clG) and (Ptr^.B = clB)) then
begin
NotFound := True;
Break;
end;
Inc(Count);
if Count >= MinArea then
Begin
Result := True;
x := xx;
y := yy;
TClient(Client).MWindow.FreeReturnData;
Exit;
end;
end;
if NotFound then
begin
Ptr := Before;
Break;
end;
Inc(Ptr, PtrInc);
end;
end;
Inc(Ptr);
end;
Inc(Ptr, PtrInc);
end;
TClient(Client).MWindow.FreeReturnData;
end;
function TMFinder.FindColorToleranceOptimised(out x, y: Integer; Color, xs, ys, xe, ye, tol: Integer): Boolean;
var
PtrData: TRetData;
@ -734,6 +811,84 @@ begin
TClient(Client).MWindow.FreeReturnData;
end;
function TMFinder.FindColoredAreaTolerance(var x, y: Integer; Color, xs, ys, xe, ye, MinArea, tol: Integer): Boolean;
var
PtrData: TRetData;
Ptr, Before: PRGB32;
PtrInc: Integer;
dX, dY, xx, yy, fx, fy, Count: Integer;
clR, clG, clB : Byte;
H1, S1, L1: Extended;
NotFound : Boolean;
label Hit;
begin
Result := false;
// checks for valid xs,ys,xe,ye? (may involve GetDimensions)
DefaultOperations(xs,ys,xe,ye);
// calculate delta x and y
dX := xe - xs;
dY := ye - ys;
//next, convert the color to r,g,b
ColorToRGB(Color, clR, clG, clB);
if Cts = 2 then
RGBToHSL(clR,clG,clB,H1,S1,L1);
PtrData := TClient(Client).MWindow.ReturnData(xs, ys, dX + 1, dY + 1);
// Do we want to "cache" these vars?
// We will, for now. Easier to type.
Ptr := PtrData.Ptr;
PtrInc := PtrData.IncPtrWith;
for yy := ys to ye do
begin;
for xx := xs to xe do
begin;
NotFound := False;
// Colour comparison here.
if ColorSame(CTS, Tol, Ptr^.R, Ptr^.G, Ptr^.B, clR, clG, clB, H1, S1, L1, huemod, satmod) then
begin
Before := Ptr;
for fy := yy to ye do
begin
for fx := xx to xe do
begin
Inc(Ptr);
if not ColorSame(CTS, Tol, Ptr^.R, Ptr^.G, Ptr^.B, clR, clG, clB, H1, S1, L1, huemod, satmod) then
begin
NotFound := True;
Break;
end;
Inc(Count);
if Count >= MinArea then
goto Hit;
end;
if NotFound then
begin
Ptr := Before;
Break;
end;
Inc(Ptr, PtrInc);
end;
end;
Inc(Ptr);
end;
Inc(Ptr, PtrInc);
end;
Result := False;
TClient(Client).MWindow.FreeReturnData;
Exit;
Hit:
Result := True;
x := xx;
y := yy;
TClient(Client).MWindow.FreeReturnData;
end;
function TMFinder.FindColorsTolerance(out Points: TPointArray; Color, xs, ys,
xe, ye, Tol: Integer): Boolean;
var