1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 18:52:15 -05:00

Merge branch 'master' of ssh://villavu.com:54367/simba

This commit is contained in:
Merlijn Wajer 2010-04-18 18:09:25 +02:00
commit a6da52fbb3
32 changed files with 248 additions and 222 deletions

View File

@ -5,7 +5,7 @@
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{1DBDC946-E964-430C-9BD6-2AE5E426E5AC}
AppId={{524C9B9A-B57F-4FEC-89BE-292202EBA44D}
AppName=Simba
AppVerName=Simba 1.0 Beta
AppPublisherURL=http://simba.villavu.com/
@ -13,7 +13,7 @@ AppSupportURL=http://simba.villavu.com/
AppUpdatesURL=http://simba.villavu.com/
DefaultDirName={pf}\Simba
DefaultGroupName=Simba
OutputDir=C:\Remake\Install\win32
OutputDir=C:\Remake\Install\windows\
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
@ -30,11 +30,13 @@ Name: "{app}\Extensions"
Name: "{app}\Includes"
Name: "{app}\Plugins"
Name: "{app}\Scripts"
Name: "{app}\Scripts\Tests"
[Files]
Source: "C:\Remake\Simba.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Remake\Fonts\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Remake\Tests\PS\*"; DestDir:"{app}\Scripts\Tests\"; Flags: ignoreversion
Source: "C:\Remake\Extensions\srl.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Remake\Fonts\*"; DestDir: "{app}\Fonts"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Remake\Tests\PS\*"; DestDir:"{app}\Scripts\Tests"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]

View File

@ -46,7 +46,7 @@ uses
CastaliaSimplePasPar, v_AutoCompleteForm, PSDump;
const
SimbaVersion = 630;
SimbaVersion = 632;
type
@ -2045,7 +2045,7 @@ begin
Self.OnScriptStart:= @ScriptStartEvent;
FillThread := TProcThread.Create(true);
FillThread := TProcThread.Create;
FillThread.FreeOnTerminate:= True;
FillThread.NormalProc:= @CCFillCore;
UpdateTimer.OnTimer:= @UpdateTimerCheck;
@ -2359,15 +2359,14 @@ function TForm1.GetSimbaNews: String;
var
t: TDownloadThread;
begin
t := TDownloadThread.Create(true);
t.InputURL:=LoadSettingDef('Settings/News/URL', 'http://simba.villavu.com/bin/news');
t := TDownloadThread.Create(LoadSettingDef('Settings/News/URL', 'http://simba.villavu.com/bin/news'),
@Result);
t.Resume;
while not t.done do
begin
Application.ProcessMessages;
Sleep(50);
end;
Exit(t.ResultStr);
end;
procedure TForm1.SetExtPath(const AValue: string);
@ -2634,6 +2633,7 @@ var
FontDownload : TDownloadThread;
Stream : TStringStream;
UnTarrer : TUntarThread;
Fonts : string;
Decompress : TDecompressThread;
begin
if UpdatingFonts then
@ -2644,12 +2644,13 @@ begin
if LatestVersion > CurrVersion then
begin;
formWriteln(format('New fonts available. Current version: %d. Latest version: %d',[CurrVersion,LatestVersion]));
FontDownload := TDownloadThread.Create(True);
FontDownload.InputURL:= LoadSettingDef('Settings/Fonts/UpdateLink',FontURL + 'Fonts.tar.bz2');
FontDownload := TDownloadThread.Create(LoadSettingDef('Settings/Fonts/UpdateLink',FontURL + 'Fonts.tar.bz2'),
@Fonts);
FontDownload.resume;
while FontDownload.Done = false do
Idler;
Stream := TStringStream.Create(FontDownload.ResultStr);
//Fontdownload is freed now
Stream := TStringStream.Create(Fonts);
try
Decompress := TDecompressThread.Create(Stream);
Decompress.Resume;
@ -2676,7 +2677,6 @@ begin
Decompress.free;
finally
Stream.Free;
FontDownload.Free;
end;
end;
UpdatingFonts := False;

View File

@ -15,10 +15,12 @@ type
{ TDownloadThread }
TDownloadThread = class(TThread)
public
ResultStr : string;
private
InputURL : string;
ResultStr : PString;
public
Done : boolean;
constructor Create(const URL : string; const Output : PString);
procedure Execute; override;
end;
TSimbaUpdateForm = class(TForm)
@ -90,20 +92,22 @@ begin
end;
function TSimbaUpdateForm.GetLatestFontVersion: integer;
var
Vers : string;
begin
if FontVersionThread = nil then//Create thread (only if no-other one is already running)
begin
FontVersionThread := TDownloadThread.Create(true);
FontVersionThread.InputURL := SettingsForm.Settings.GetKeyValueDefLoad(
'Settings/Fonts/VersionLink',FontURL + 'Version',SimbaSettingsFile);
FontVersionThread := TDownloadThread.Create(SettingsForm.Settings.GetKeyValueDefLoad(
'Settings/Fonts/VersionLink',FontURL + 'Version',SimbaSettingsFile),
@Vers);
FontVersionThread.Resume;
while FontVersionThread.Done = false do//Wait till thread is done
begin
Application.ProcessMessages;
Sleep(25);
end;
FFontVersion := StrToIntDef(Trim(FontVersionThread.ResultStr), -1);//Read output
FreeAndNil(FontVersionThread);//Free the thread
FFontVersion := StrToIntDef(Trim(Vers), -1);//Read output
FontVersionThread := nil; //It's already freed
end else
begin
//Another thread is already running, lets wait for it! (When it's nil, it means that the result is written!)
@ -118,21 +122,22 @@ begin
end;
function TSimbaUpdateForm.GetLatestSimbaVersion: Integer;
var
Vers : string;
begin
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
begin
SimbaVersionThread := TDownloadThread.Create(true);
SimbaVersionThread.InputURL := SettingsForm.Settings.GetKeyValueDefLoad(
'Settings/Updater/RemoteVersionLink',SimbaURL + 'Version',SimbaSettingsFile);
SimbaVersionThread := TDownloadThread.Create(SettingsForm.Settings.GetKeyValueDefLoad(
'Settings/Updater/RemoteVersionLink',SimbaURL + 'Version'
,SimbaSettingsFile),@Vers);
SimbaVersionThread.Resume;
while SimbaVersionThread.Done = false do//Wait till thread is done
begin
Application.ProcessMessages;
Sleep(25);
end;
FSimbaVersion := StrToIntDef(Trim(SimbaVersionThread.ResultStr), -1);//Read output
FreeAndNil(SimbaVersionThread);//Free the thread
FSimbaVersion := StrToIntDef(Trim(Vers), -1);//Read output
SimbaVersionThread := nil;//It's automatically freed
end else
begin
//Another thread is already running, lets wait for it! (When it's nil, it means that the result is written!)
@ -263,11 +268,19 @@ begin
FUpdating:= false;
end;
constructor TDownloadThread.Create(const url : String; const Output : PString);
begin
inherited Create(true);
FreeOnTerminate:= True;
InputURL:= url;
ResultStr:= Output;
end;
{ TDownloadThread }
procedure TDownloadThread.Execute;
begin
ResultStr:= GetPage(InputURL);
ResultStr^:= GetPage(InputURL);
done := true;
end;

View File

@ -1,76 +1,33 @@
program new;
//http://www.hawaiisunshine.org/wp-content/uploads/2008/12/sunshine1.jpg
//http://farm4.static.flickr.com/3067/2612399892_7df428d482.jpg
{Make the above bitmap your target}
var
Bmp : integer;
x,y : integer;
w,h : integer;
begin
Bmp := BitmapFromString(37, 32, 'beNqFl3lwVuUVxp93veu3f1' +
'lI+EKCLCkIAuI6oIBl0ylWweJerSm2atAaUJYgZCMLBAKyTSAh+w4' +
'ERKnUpWoXERSBjtailDVACLS17Tj+13NvpB3tTHvnzOTOzb3vL+c5' +
'azIGaIDMYMwQ3BBSkSkD4J4xCa4gNKQBZTClTS5tMBNQgAAY6C3mG' +
'cN/zP/Wf0o3373oK0mfM8/E1UMMAa0YmZKQ4pvz6DUHzAJM3wwmpH' +
'/6t1j/D3f1He/Xyj/HFQgzhIEQEAHiQDIwAEjzbrjrQX2c7yNJwDn' +
'/5vh+Tb5l/3Vx77mhdFDLEEMMSPdtMDAGmMAwXWOWxWfb4s6APT4a' +
'S5iBCDgRLT8KnjhcEJEJIgvP/ieOccPgZpDrsO/FIGAUcI8TeMwJP' +
'heOLI/FVkZj5YFAuWEscANTw8lDnEgcMgQeBDd9hQXjQggu6ack+z' +
'b0u5enHpAEZADXA3MDwSWZgwtSB5aG4+VmoBxGOfgqYC2wVNrjIaJ' +
'gQV/nKBdh7rnpMPKUecnGhCI044xdzZ9+5tV40ZXMPenIo/ujumRk' +
'5oahA1cHCIEqsCqINZCV3Fpjhsp08CnDHe5RVAw86oeVLOoHN8W/T' +
'+YywpWnMPfj2h/d/iTm3xBHAHcHUDT2mi3jrqm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jUsmuvvP6euPweOD1mNr' +
'd4u3a/v/u/v786fz3ld3aXsalacR8Z8B3XMF5ZcVprdRyrt6MbtGW' +
'VsWWTr6Q2/z0ieHzetjqfODoodzZ7PXT/f/q+v/+0PnyddHNUL6YW' +
'8V5cr1xx9Jq//Z8//7AqefNVM6sQLqL5PPZx+/litPUdd7hfNbhwN' +
'/V+f3Z//729P7/nufkPcS2aLuCzNNg/f1t/P7K////zvj3htXPRr2' +
'Xm86f2vPIwubLgtTJb93aidfT6O7D+f/h///9svT0U7vJtcR8//hP' +
'//63//7/y/z5vfD1wOLPhNKgOaxpc7uRyeK1s+vFaNHNbtXS0uHI/' +
'/vK///8svD/hsbW+uiK//6v9f//z/j9suvzo9TWwOO2ud+qI6RZEK' +
'lUbrxdl9qUV8q3Ub+6tNCz/Pmx/P/1xPP839/V+P2o//rmwPv/puH' +
'swtvVqti1ptiftd+ZJ6NUIKlZIaVLL6xgQ7J/Lq93bbqB5eiY+f/k' +
'xfX///fX//7X3fz/cd32wNvSs+O3sOScm9OeqtiJH6xIIKhWLKFRA' +
'KJJEqJHN6FNHKNAW75dfdeddc/Yrd+3tuzOaefqRbnWq9Cdhtijld' +
'WNmtWVoNF+MqxVJqlWJKJKG6I/UKs5hbtCWbNIQaVHYatXWq9yOq5' +
'8OqyGMaeZNKiMT7BuTrZ0aLpye8t0dspyM6xbL6dLLqBDJ6U8dKYy' +
'4upNx+J4yNt35OZ5yOh8W8eMRqNnQ6hWMqlTJaRXFaU5N6JBQrFIR' +
'rdaKqlIL6ZNKqM8CKc5VZw04N8w//2m/vq5/v7M6vzghtfEhr+Ohc' +
'NgYbRYU7lKUKo3O6k9K6s3KqQ/KKRILp8/D6k7GKZBMZwwqL86/P2' +
'S9f/j//zlzP73nNrfpMeprdp0hMlyqcxincxYY7tXOLFHDehUEnQ=' +
'');
GetClientDimensions(w,h);
if FindBitmapToleranceIn(bmp,x,y,0,0,w-1,h-1,25) then
MoveMouse(x,y);

View File

@ -1,4 +1,6 @@
program new;
const
bmppath = 'C:\Carina_1_by_Eeitam.png';
var
p1, p2: TPointArray;
w, h: integer;
@ -7,7 +9,7 @@ var
begin
SetColorToleranceSpeed(2);
bmp := LoadBitmap('/home/merlijn/Pictures/Mooi/Carina_1_by_Eeitam.png');
bmp := LoadBitmap(bmppath);
SetTargetBitmap(bmp);
GetClientDimensions(W, H);
writeln(inttostr(w) + ' : ' + inttostr(h));

View File

@ -19,7 +19,6 @@ program Hoi;
}
Const
TestPath = './test';
fsFromBeginning = 0; // offset must be pos or 0
fsFromCurrent = 1; // offset pos or neg
@ -27,10 +26,12 @@ Const
var
s, s2: string;
testPath : string;
myFile, myFile2: Integer;
begin
s := apppath;
testPath := scriptpath +'Test';
s := ScriptPath;
Writeln('Our current path is: ' + s);
{ If DirectoryExists(s) Then
writeln('Directory ' + s + ' exists.'); }

View File

@ -1,6 +0,0 @@
program new;
{.include test.mufa}
begin
Writeln(TestStr);
Writeln(inttostr(MultiPly(500,-20)));
end.

View File

@ -1,5 +1,8 @@
program new;
//http://nl.wikipedia.org/wiki/Lily_Allen
//This finds a mask of the text 'Op 24 september',
//so target wikipedia halfway down. Might not work because of
//different font's/sizes in your browser.
var
Bmp : integer;
@ -14,7 +17,7 @@ begin
'KvJQNKa5mEcyAhoauI6N8ymAlkxWpdtwgL2bhPXCJc7+E7JLNJsgG' +
'qQgL1jhHwX4VJdBsNZMbN5D//m/ob5XzwDp40wfg/jW9g024hbuPd' +
'ritabVqaAj7zYVyxg9fol4M8FFG7YAfIG00k=');
Mask := CreateBitmapMask(Bmp);
Mask := CreateMaskFromBitmap(Bmp);
GetClientDimensions(w,h);
// if FindBitmapMaskTolerance(Bmp,x,y,0, 0,w-1, h-1,1,5) then
if FindMaskTolerance(Mask,x,y,0, 0,w-1, h-1,1,5) then

View File

@ -2,4 +2,7 @@ program new;
begin
Writeln(AppPath);
Writeln(ScriptPath);
Writeln(IncludePath);
Writeln(FontPath);
writeln(PluginPath);
end.

View File

@ -1,6 +1,6 @@
program new;
const
SaveDir = 'C:\';
SaveDir = ScriptPath;
var
Bmpz : integer;
Bmp2 : integer;

View File

@ -1,4 +1,6 @@
program new;
const
savepath = scriptpath;
var
Bmpz : integer;
w,h : integer;
@ -134,9 +136,9 @@ begin
GetBitmapSize(bmpz,w,h);
Writeln(inttostr(w) + '-' + inttostr(h));
SetBitmapSize(Bmpz,w div 2, h div 2);
SaveBitmap(Bmpz,'/tmp/test.bmp');
SaveBitmap(Bmpz,savepath + 'test.bmp');
//FreeBitmap(Bmpz);
Bmpz := LoadBitmap('/tmp/test.bmp');
Bmpz := LoadBitmap(savepath + 'test.bmp');
SetBitmapSize(bmpz,w,h);
SaveBitmap(Bmpz,'/tmp/test2.bmp');
SaveBitmap(Bmpz,savepath + 'test2.bmp');
end.

View File

@ -5,6 +5,6 @@ begin
t:=getsystemtime;
for i := 0 to 100 do
rs_getuptext;
writeln(inttostr(round(getsystemtime - t) / 100));
writeln(floattostr(round(getsystemtime - t) / 100.0));
writeln(rs_getuptext);
end.

View File

@ -22,23 +22,10 @@ begin
if (FindColorsTolerance(cArr, TextCol, MCX1, P.y, MCX2, P.y + 13, 0)) then
begin
B := GetTPABounds(cArr);
// Result := GetTextAt(B.x1 - 1, B.y1 - 1, 1, 3, 0, 0, 0, 100, 'SmallChars');
{Result := Trim(GetTextAtEx(B.x1 - 1, B.y1 - 2, 0, SmallChars, False, False,
0, 1, TextCol, 80, False, tr_AllChars)); }
Result := GetTextAt(B.x1 - 1, B.y1 - 1,1, 4, 1, 0, 0, 100, 'SmallChars');
end;
end;
var
bmp: integer;
begin
bmp := LoadBitmap('/home/merlijn/Programs/trunk/pics/17.bmp');
SetTargetBitmap(bmp);
// freebitmap(bmp);
{ GetChatBoxText(8, 0); }
{SetDesktopAsClient; }
// uncomment this for exception
freebitmap(bmp);
Writeln(GetChatBoxText(8, 0));
end.

View File

@ -15,8 +15,7 @@ begin
movemouse(x,y);
end else
writeln('not found');
if getdtm(dtm, ppdtm) then
writeln('yay');
ppdtm := GetDTM(Dtm);
printpdtm(tdtmtopdtm(pdtmtotdtm(ppdtm)));
dtm := addpdtm(ppdtm);
freedtm(dtm);

View File

@ -53,7 +53,7 @@ begin
movemouse(p[0].x,p[0].y);
end;
if FindDTMRotated(dtm, x, y, 0, 0, w-1, h-1, -3.14, 3.14, 0.05, a) then
if FindDTMRotatedAlternating(dtm, x, y, 0, 0, w-1, h-1, -3.14, 3.14, 0.05, a) then
begin
writeln('Found DTM at ' + inttostr(x) + ', ' + inttostr(y) + ' Angle: ' + FloatToStr(a));
movemouse(x,y);

View File

@ -59,6 +59,6 @@ begin
writeln(inttostr(w) + ' , ' + inttostr(h));
if findcolortolerance(w,h,clwhite,0,0,764,502,300) then
smartmovemouse(w,h);
savescreenshot('/tmp/smart.bmp');
//Wait(5000);
Wait(5000);
savescreenshot(scriptPath + 'smart.bmp');
end.

View File

@ -1,17 +1,16 @@
program new;
begin
SettingsGetSetDefaultKeyValue('Kanker/wat', 'YO WAT');
SettingsGetSetDefaultKeyValue('Kanker/wat2', 'YO WAT2');
writeln(SettingsGetKeyValue('Kanker/wat'));
if SettingsIsDirectory('Kanker') then
writeln('Kanker has at least one child!');
if SettingsIsKey('Kanker/wat') then
writeln('wat exists!');
SettingsDeleteKey('Kanker/wat');
writeln(SettingsGetKeyValue('Kanker/wat2'));
writeln(SettingsGetKeyValue('Kanker/wat'));
SettingsDeleteSubKeys('Kanker');
if SettingsIsKey('Kanker') then
writeln('kanker is a key now!');
GetSettingValueDef('Testme/wat','Yo wat');
GetSettingValueDef('Testme/wat2','Yo wat2');
Writeln(GetSettingValue('Testme/wat'));
if KeyIsDirectory('Testme') then
Writeln('Testme has atleast one child!');
if KeyIsSetting('Testme/wat') then
writeln('wat exists in the parent Testme!');
DeleteSetting('Testme/wat');
Writeln(GetSettingValue('Testme/wat2'));
Writeln(GetSettingValue('Testme/wat'));
writeln(DeleteSubSettings('Testme'));
if KeyIsSetting('Testme') then
writeln('Testme is a key now!');
end.

View File

@ -34,6 +34,4 @@ begin
end;
Writeln(y);
Writeln(TPointArray([Point(5,5),Point(20,1337),point(1,2)]));
J := TForm.Create(nil);
Writeln(j.canvas);
end.

View File

@ -71,7 +71,7 @@ begin;
raise exception.createfmt('Wrong Width or Height in ScretchResize: (%d,%d)',[NewW,NewH]);
end;
procedure ps_GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer); extdecl;
procedure ps_GetBitmapSize(Bmp : integer; var BmpW,BmpH : integer); extdecl;
begin;
With CurrThread.Client.MBitmaps[bmp] do
begin;
@ -170,19 +170,19 @@ begin;
CurrThread.Client.MBitmaps[result].CopyClientToBitmap(CurrThread.Client.IOManager,True,xs,ys,xe,ye);
end;
function ps_FindBitmap(Bitmap: integer; out x, y: Integer): Boolean; extdecl;
function ps_FindBitmap(Bitmap: integer; var x, y: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmap( MBitmaps[bitmap],x,y);
end;
function ps_FindBitmapIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean; extdecl;
function ps_FindBitmapIn(bitmap: integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye);
end;
function ps_FindBitmapToleranceIn(bitmap: integer; out x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean; extdecl;
function ps_FindBitmapToleranceIn(bitmap: integer; var x, y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapToleranceIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye,tolerance);
@ -195,7 +195,7 @@ begin;
result := MFinder.FindBitmapSpiral(Mbitmaps[bitmap],x,y,xs,ys,xe,ye);
end;
function ps_FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; out Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean; extdecl;
function ps_FindBitmapsSpiralTolerance(bitmap: integer; x, y: Integer; var Points : TPointArray; xs, ys, xe, ye,tolerance: Integer): Boolean; extdecl;
begin;
with CurrThread.Client do
result := MFinder.FindBitmapsSpiralTolerance(MBitmaps[bitmap],x,y,points,xs,ys,xe,ye,tolerance);
@ -270,11 +270,11 @@ begin;
result := CurrThread.Client.MBitmaps[Bitmap].CreateTMask;
end;
function ps_FindMaskTolerance(const mask: TMask; out x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
function ps_FindMaskTolerance(const mask: TMask; var x, y: Integer; xs,ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindMaskTolerance(Mask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
end;
function ps_FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
function ps_FindBitmapMaskTolerance(mask: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
begin;
{$ifdef mDebug}
mDebugLn('Better be using FindMaskTolerance in combination with CreateMaskFromBitmap, more efficient.');
@ -283,9 +283,9 @@ begin;
result := MFinder.FindMaskTolerance(MBitmaps[mask].CreateTMask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
end;
function ps_FindDeformedBitmapToleranceIn(bitmap: integer; out x,
function ps_FindDeformedBitmapToleranceIn(bitmap: integer; var x,
y: Integer; xs, ys, xe, ye: Integer; tolerance: Integer; Range: Integer;
AllowPartialAccuracy: Boolean; out accuracy: Extended): Boolean; extdecl;
AllowPartialAccuracy: Boolean; var accuracy: Extended): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindDeformedBitmapToleranceIn(CurrThread.Client.MBitmaps[Bitmap],x,y,xs,ys,xe,ye,tolerance,range,AllowPartialAccuracy,accuracy);
end;

View File

@ -36,21 +36,21 @@ begin
result := CurrThread.Client.MFinder.GetColors(coords);
end;
function ps_findcolor(out x, y: integer; color, x1, y1, x2, y2: integer): boolean; extdecl;
function ps_findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
end;
function ps_findcolortoleranceOptimised(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; extdecl;
function ps_findcolortoleranceOptimised(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColorToleranceOptimised(x, y, color, x1, y1, x2, y2, tol);
end;
function ps_findcolortolerance(out x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; extdecl;
function ps_findcolortolerance(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
end;
function ps_FindColors(out TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; extdecl;
function ps_FindColors(var TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; extdecl;
begin
Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
end;
@ -70,7 +70,7 @@ begin
CurrThread.Client.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
end;
procedure ps_GetToleranceSpeed2Modifiers(out hMod, sMod: Extended); extdecl;
procedure ps_GetToleranceSpeed2Modifiers(var hMod, sMod: Extended); extdecl;
begin
CurrThread.Client.MFinder.GetToleranceSpeed2Modifiers(hMod, sMod);
end;
@ -89,11 +89,11 @@ begin;
result := CurrThread.Client.MFinder.CountColorTolerance(color,xs,ys,xe,ye,tolerance);
end;
function ps_FindColorsToleranceOptimised(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; extdecl;
function ps_FindColorsToleranceOptimised(var Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorsToleranceOptimised(points,color,xs,ys,xe,ye,tolerance);
end;
function ps_FindColorsTolerance(out Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; extdecl;
function ps_FindColorsTolerance(var Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorsTolerance(points,color,xs,ys,xe,ye,tolerance);
end;
@ -108,7 +108,7 @@ begin
result := CurrThread.Client.MFinder.FindColorSpiralTolerance(x,y,color,xs,ys,xe,ye,tol);
end;
function ps_FindColorsSpiralTolerance(x, y: Integer; out Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean; extdecl;
function ps_FindColorsSpiralTolerance(x, y: Integer; var Points: TPointArray; color, xs, ys, xe, ye: Integer; Tolerance: Integer) : boolean; extdecl;
begin;
result := CurrThread.Client.MFinder.FindColorsSpiralTolerance(x,y,Points,color,xs,ys,xe,ye,tolerance);
end;

View File

@ -1,9 +1,14 @@
procedure ps_ColorToRGB(Color: integer; var r, g, b: Byte);extdecl;
procedure ps_ColorToRGB(Color: integer; var r, g, b: Integer);extdecl;
var
RR,GG,BB : byte;
begin
colour_conv.ColorToRGB(color,r,g,b);
colour_conv.ColorToRGB(color,rr,gg,bb);
r := rr;
g := gg;
b := bb;
end;
function ps_RGBtoColor(r, g, b: Byte): TColor;extdecl;
function ps_RGBtoColor(r, g, b: Integer): TColor;extdecl;
begin
result := RGBtoColor(r,g,b);
end;
@ -28,21 +33,31 @@ begin
result := XYZToColor(x,y,z);
end;
procedure ps_RGBToHSL(R, G, B: Byte; var h, s, l: Extended);extdecl;
procedure ps_RGBToHSL(R, G, B: Integer; var h, s, l: Extended);extdecl;
begin
RGBToHSL(r,g,b,h,s,l);
end;
procedure ps_HSLtoRGB(H, S, L: extended; var R, G ,B: Byte);extdecl;
procedure ps_HSLtoRGB(H, S, L: extended; var R, G ,B: Integer);extdecl;
var
RR,GG,BB : byte;
begin
HSLtoRGB(h,s,l,r,g,b);
HSLtoRGB(h,s,l,rr,gg,bb);
r := rr;
g := gg;
b := bb;
end;
procedure ps_RGBToXYZ(R, G, B: Byte;var x, y ,z: Extended);extdecl;
procedure ps_RGBToXYZ(R, G, B: Integer;var x, y ,z: Extended);extdecl;
begin
RGBToXYZ(r,g,b,x,y,z);
end;
procedure ps_XYZToRGB(X, Y, Z: Extended; var R, G, B: Byte);extdecl;
begin
XYZToRGB(x,y,z,r,g,b);
procedure ps_XYZToRGB(X, Y, Z: Extended; var R, G, B: Integer);extdecl;
var
RR,GG,BB : byte;
begin;
XYZToRGB(x,y,z,rr,gg,bb);
r := rr;
g := gg;
b := bb;
end;

View File

@ -21,42 +21,42 @@
DTM.inc for the Mufasa Macro Library
}
function ps_FindDTM(DTM: Integer; out x, y: Integer; xs, ys, xe, ye: Integer): Boolean; extdecl;
function ps_FindDTM(DTM: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean; extdecl;
begin
with CurrThread.Client do
result := MFinder.FindDTM(MDTM.GetDTM(DTM),x,y,xs,ys,xe,ye);
end;
function ps_FindDTMs(DTM: Integer; out p: TPointArray; xs, ys, xe, ye: Integer): Boolean; extdecl;
function ps_FindDTMs(DTM: Integer; var p: TPointArray; xs, ys, xe, ye: Integer): Boolean; extdecl;
begin
with CurrThread.Client do
result := MFinder.FindDTMs(MDTM.GetDTM(DTM), p, xs, ys, xe, ye);
end;
function ps_FindDTMRotatedAlternating(DTM: Integer; out x, y: Integer; xs, ys, xe, ye:
function ps_FindDTMRotatedAlternating(DTM: Integer; var x, y: Integer; xs, ys, xe, ye:
Integer; sAngle, eAngle, aStep: Extended;
out aFound: Extended): Boolean; extdecl;
var aFound: Extended): Boolean; extdecl;
begin
with CurrThread.Client do
result := MFinder.FindDTMRotated(MDTM.GetDTM(DTM), x,y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound,true);
end;
function ps_FindDTMRotatedSE(DTM: Integer; out x, y: Integer; xs, ys, xe, ye:
function ps_FindDTMRotatedSE(DTM: Integer; var x, y: Integer; xs, ys, xe, ye:
Integer; sAngle, eAngle, aStep: Extended;
out aFound: Extended): Boolean; extdecl;
var aFound: Extended): Boolean; extdecl;
begin
with CurrThread.Client do
result := MFinder.FindDTMRotated(MDTM.GetDTM(DTM), x, y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound,false);
end;
function ps_FindDTMsRotatedAlternating(DTM: Integer; out Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; extdecl;
function ps_FindDTMsRotatedAlternating(DTM: Integer; var Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; extdecl;
begin
with CurrThread.Client do
result := MFinder.FindDTMsRotated(MDTM.GetDTM(DTM), Points, xs, ys, xe, ye,
sAngle, eAngle, aStep, aFound, true);
end;
function ps_FindDTMsRotatedSE(DTM: Integer; out Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; extdecl;
function ps_FindDTMsRotatedSE(DTM: Integer; var Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean; extdecl;
begin
with CurrThread.Client do
result := MFinder.FindDTMsRotated(MDTM.GetDTM(DTM), Points, xs, ys, xe, ye,

View File

@ -23,7 +23,7 @@
type
TStringArray = array of string;
function ext_UnTar(const Input : string; out Content : TStringArray) : boolean;
function ext_UnTar(const Input : string; var Content : TStringArray) : boolean;
var
Stream : TStringStream;
begin
@ -58,7 +58,7 @@ begin
stream.free;
end;
end;
function ext_DecompressBZip2(const input: string;out output : string; const BlockSize: Cardinal): boolean;
function ext_DecompressBZip2(const input: string;var output : string; const BlockSize: Cardinal): boolean;
var
Stream : TStringStream;
Decompress : TDecompressThread;
@ -95,15 +95,13 @@ var
begin
result := '';
try
t := TDownloadThread.Create(true);
t.InputURL:=url;
t := TDownloadThread.Create(url,@result);
t.Resume;
while not t.done do
begin
Application.ProcessMessages;
Sleep(25);
end;
Exit(t.ResultStr);
except
on e : exception do
mDebugLn('Exception in GetPage in Extensions: ' + e.message);

View File

@ -155,3 +155,11 @@ function ps_floor(e : extended) : integer; extdecl;
begin;
result := floor(e);
end;
function ps_logn(base, x : extended): extended;extdecl;
begin
result := logn(base,x);
end;
function ps_ln(x : extended) : extended;extdecl;
begin
result := ln(x);
end;

View File

@ -134,7 +134,7 @@ begin;
x := x mod (1000 * 60);
s := x div (1000);
end;
procedure ps_DecodeDate ( const SourceDate : TDateTime; out Year, Month, Day : Word ); extdecl;
procedure ps_DecodeDate ( const SourceDate : TDateTime; var Year, Month, Day : Word ); extdecl;
begin
decodedate(sourcedate,year,month,day);
end;

View File

@ -278,69 +278,69 @@ begin
result := AverageExtended(te);
end;
procedure ps_SplitTPAExWrap(arr: TPointArray; w, h: Integer; out res : T2DPointArray);extdecl;
procedure ps_SplitTPAExWrap(arr: TPointArray; w, h: Integer; var res : T2DPointArray);extdecl;
begin
res := SplitTPAEx(arr,w,h);
end;
procedure ps_SplitTPAWrap(arr: TPointArray; Dist: Integer; out res: T2DPointArray);extdecl;
procedure ps_SplitTPAWrap(arr: TPointArray; Dist: Integer; var res: T2DPointArray);extdecl;
begin
res := SplitTPA(arr,dist);
end;
procedure ps_FindGapsTPAWrap(TPA: TPointArray; MinPixels: Integer; out Res : T2DPointArray); extdecl;
procedure ps_FindGapsTPAWrap(TPA: TPointArray; MinPixels: Integer; var Res : T2DPointArray); extdecl;
begin
Res := FindGapsTPA(TPA,MinPixels);
end;
procedure ps_RemoveDistTPointArrayWrap(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean; out Res : TPointArray);extdecl;
procedure ps_RemoveDistTPointArrayWrap(x, y, dist: Integer; ThePoints: TPointArray; RemoveHigher: Boolean; var Res : TPointArray);extdecl;
begin
Res := RemoveDistTPointArray(x,y,dist,thepoints,removehigher);
end;
procedure ps_CombineTPAWrap(Ar1, Ar2: TPointArray; out Res : TPointArray);extdecl;
procedure ps_CombineTPAWrap(Ar1, Ar2: TPointArray; var Res : TPointArray);extdecl;
begin
Res := CombineTPA(Ar1,Ar2);
end;
procedure ps_ReArrangeandShortenArrayExWrap(a: TPointArray; w, h: Integer; out Res : TPointArray);extdecl;
procedure ps_ReArrangeandShortenArrayExWrap(a: TPointArray; w, h: Integer; var Res : TPointArray);extdecl;
begin
Res := ReArrangeandShortenArrayEx(a,w,h);
end;
procedure ps_ReArrangeandShortenArrayWrap(a: TPointArray; Dist: Integer; out Res : TPointArray);extdecl;
procedure ps_ReArrangeandShortenArrayWrap(a: TPointArray; Dist: Integer; var Res : TPointArray);extdecl;
begin
Res := ReArrangeandShortenArray(a,dist);
end;
procedure ps_TPAtoATPAExWrap(TPA: TPointArray; w, h: Integer; out Res : T2DPointArray);extdecl;
procedure ps_TPAtoATPAExWrap(TPA: TPointArray; w, h: Integer; var Res : T2DPointArray);extdecl;
begin
Res := TPAtoATPAEx(TPA,w,h);
end;
procedure ps_TPAtoATPAWrap(TPA: TPointArray; Dist: Integer; out Res : T2DPointArray);extdecl;
procedure ps_TPAtoATPAWrap(TPA: TPointArray; Dist: Integer; var Res : T2DPointArray);extdecl;
begin
Res := TPAtoATPA(TPA,Dist);
end;
procedure ps_CombineIntArrayWrap(Ar1, Ar2: TIntegerArray; out Res : TIntegerArray);extdecl;
procedure ps_CombineIntArrayWrap(Ar1, Ar2: TIntegerArray; var Res : TIntegerArray);extdecl;
begin
Res := CombineIntArray(Ar1,Ar2);
end;
procedure ps_MergeATPAWrap(ATPA : T2DPointArray; out Res: TPointArray); extdecl;
procedure ps_MergeATPAWrap(ATPA : T2DPointArray; var Res: TPointArray); extdecl;
begin
Res := MergeATPA(ATPA);
end;
procedure ps_TPAFromBoxWrap(const Box : TBox; out Res : TPointArray);extdecl;
procedure ps_TPAFromBoxWrap(const Box : TBox; var Res : TPointArray);extdecl;
begin
Res := TPAFromBox(Box);
end;
procedure ps_RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; out Res : TPointArray);extdecl;
procedure ps_RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; var Res : TPointArray);extdecl;
begin
Res := RotatePoints(P,a,cx,cy);
end;
procedure ps_FindTPAEdgesWrap(p: TPointArray; out Res : TPointArray);extdecl;
procedure ps_FindTPAEdgesWrap(p: TPointArray; var Res : TPointArray);extdecl;
begin
Res := FindTPAEdges(p);
end;
procedure ps_ClearTPAFromTPAWrap(arP, ClearPoints: TPointArray; out Res : TPointArray);extdecl;
procedure ps_ClearTPAFromTPAWrap(arP, ClearPoints: TPointArray; var Res : TPointArray);extdecl;
begin
Res := ClearTPAFromTPA(arP, clearpoints);
end;
procedure ps_ReturnPointsNotInTPAWrap(Const TotalTPA: TPointArray; const Box: TBox; out Res : TPointArray);extdecl;
procedure ps_ReturnPointsNotInTPAWrap(Const TotalTPA: TPointArray; const Box: TBox; var Res : TPointArray);extdecl;
begin
Res := ReturnPointsNotInTPA(TotalTPA,box);
end;

View File

@ -76,7 +76,7 @@ begin
CurrThread.Client.IOManager.FreeTarget(idx);
end;
procedure ps_GetClientDimensions(out w, h: integer); extdecl;
procedure ps_GetClientDimensions(var w, h: integer); extdecl;
begin
CurrThread.Client.IOManager.GetDimensions(w, h);
end;

View File

@ -32,8 +32,8 @@ AddFunction(@ps_DTMFromString, 'function DTMFromString(const DTMString: String):
AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);');
AddFunction(@ps_FindDTM, 'function FindDTM(DTM: Integer; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@ps_FindDTMs, 'function FindDTMs(DTM: Integer; var p: TPointArray; xs, ys, xe, ye: Integer): Boolean;');
AddFunction(@ps_FindDTMRotatedSE, 'function FindDTMRotatedSE(DTM: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;');
AddFunction(@ps_FindDTMRotatedAlternating, 'function FindDTMRotatedAlternating(DTM: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;');
AddFunction(@ps_FindDTMRotatedSE, 'function FindDTMRotatedSE(DTM: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; var aFound: Extended): Boolean;');
AddFunction(@ps_FindDTMRotatedAlternating, 'function FindDTMRotatedAlternating(DTM: Integer; var x, y: Integer; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; var aFound: Extended): Boolean;');
AddFunction(@ps_FindDTMsRotatedSE, 'function FindDTMsRotatedSE(DTM: Integer; var Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; var aFound: T2DExtendedArray) : Boolean;');
AddFunction(@ps_FindDTMsRotatedAlternating, 'function FindDTMsRotatedAlternating(DTM: Integer; var Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; var aFound: T2DExtendedArray) : Boolean;');
AddFunction(@ps_addDTM, 'function AddDTM(const d: TDTM): Integer;');
@ -69,6 +69,8 @@ AddFunction(@ps_DecEx,'procedure DecEx(var x : integer; Decrease : integer);');
AddFunction(@ps_BinCoe,'function BinCoe(a, b: LongInt): Extended;');
AddFunction(@ps_FixD,'function FixD(Degrees : extended) : Extended;');
AddFunction(@ps_InRange,'function InRange(const value,min,max : integer) : boolean;');
AddFunction(@ps_logn,'function logn(base, x : extended): extended;');
AddFunction(@ps_ln,'function ln(x : extended) : extended;');
{window}
SetCurrSection('Window');
@ -180,16 +182,16 @@ AddFunction(@ps_GetRawHeaders,'function GetRawHeaders(Client: Integer): string;'
{ Color Conversions and Speed }
SetCurrSection('Color Convert');
AddFunction(@ps_ColorToRGB, 'procedure ColorToRGB(Color: integer; var r, g, b: Byte);');
AddFunction(@ps_RGBToColor, 'function RGBtoColor(r, g, b: Byte): TColor;');
AddFunction(@ps_ColorToRGB, 'procedure ColorToRGB(Color: integer; var r, g, b: Integer);');
AddFunction(@ps_RGBToColor, 'function RGBtoColor(r, g, b: Integer): TColor;');
AddFunction(@ps_ColorToHSL, 'procedure ColorToHSL(Color: Integer; var h, s, l: Extended);');
AddFunction(@ps_HSLToColor, 'function HSLToColor(H, S, L: Extended): TColor;');
AddFunction(@ps_ColorToXYZ, 'procedure ColorToXYZ(Color: Integer; var x, y, z: Extended);');
AddFunction(@ps_XYZToColor, 'function XYZToColor(X, Y, Z: Extended): TColor;');
AddFunction(@ps_RGBToHSL, 'procedure RGBToHSL(R, G, B: Byte; var h, s, l: Extended);');
AddFunction(@ps_HSLToRGB, 'procedure HSLtoRGB(H, S, L: extended; var R, G ,B: Byte);');
AddFunction(@ps_RGBToXYZ, 'procedure RGBToXYZ(R, G, B: Byte;var x, y ,z: Extended);');
AddFunction(@ps_XYZToRGB, 'procedure XYZToRGB(X, Y, Z: Extended; var R, G, B: Byte);');
AddFunction(@ps_RGBToHSL, 'procedure RGBToHSL(R, G, B: Integer; var h, s, l: Extended);');
AddFunction(@ps_HSLToRGB, 'procedure HSLtoRGB(H, S, L: extended; var R, G ,B: Integer);');
AddFunction(@ps_RGBToXYZ, 'procedure RGBToXYZ(R, G, B: Integer;var x, y ,z: Extended);');
AddFunction(@ps_XYZToRGB, 'procedure XYZToRGB(X, Y, Z: Extended; var R, G, B: Integer);');
{ Color Finding }
SetCurrSection('Color');

View File

@ -18,6 +18,7 @@ type
StartWait : Cardinal;
ClassProc : procedure of object;
NormalProc : procedure;
constructor Create;
procedure Execute; override;
end;
@ -132,6 +133,12 @@ begin;
end;
constructor TProcThread.Create;
begin
inherited Create(true);
FreeOnTerminate:= True;
end;
{ TProcThread }

View File

@ -81,7 +81,8 @@ type
procedure Invert;overload;
procedure Posterize(TargetBitmap : TMufasaBitmap; Po : integer);overload;
procedure Posterize(Po : integer);overload;
function Copy: TMufasaBitmap;
function Copy: TMufasaBitmap;overload;
function Copy(const xs,ys,xe,ye : integer) : TMufasaBitmap; overload;
function ToTBitmap: TBitmap;
function ToString : string;
procedure LoadFromTBitmap(bmp: TBitmap);
@ -519,6 +520,18 @@ begin
Move(self.FData[0], Result.FData[0],self.w * self.h * SizeOf(TRGB32));
end;
function TMufasaBitmap.Copy(const xs, ys, xe, ye: integer): TMufasaBitmap;
var
i : integer;
begin
ValidatePoint(xs,ys);
ValidatePoint(xe,ye);
Result := TMufasaBitmap.Create;
Result.SetSize(xe-xs+1, ye-ys+1);
for i := ys to ye do
Move(self.FData[i * self.w + xs], Result.FData[i-ys],result.Width * SizeOf(TRGB32));
end;
function TMufasaBitmap.ToTBitmap: TBitmap;
var
@ -733,12 +746,15 @@ begin
StartPtr := Self.FData;
For y := 0 to Self.h - 1 do
For x := 0 to self.w - 1 do
begin
StartPtr^.A := 0;
if LongWord(StartPtr^) = LongWord(Search) then
begin;
L := L + 1;
Result[L].x := x;
Result[L].y := y;
end;
end;
SetLength(Result,L + 1);
end;
@ -809,9 +825,11 @@ begin
begin;
for loopy := 0 to MinH do
for loopx := 0 to MinW do
begin;
FData[loopy * w + loopx].A := 0;
if LongWord(FData[loopy * w + loopx]) <> LongWord(FTransparentColor) then
TargetBitmap.FData[(loopy + y) * TargetW + loopx + x] := FData[Loopy * w + loopx];
end;
end
else
for loopy := 0 to MinH do
@ -827,8 +845,11 @@ begin
OldCol := RGBToBGR(OldColor);
NewCol := RGBToBGR(NewColor);
for i := w*h-1 downto 0 do
begin
FData[i].a := 0;
if LongWord(FData[i]) = LongWord(OldCol) then
FData[i] := NewCol;
end;
end;
procedure TMufasaBitmap.CopyClientToBitmap(MWindow : TObject;Resize : boolean; xs, ys, xe, ye: Integer);
@ -1212,16 +1233,24 @@ end;
destructor TMBitmaps.Destroy;
var
I : integer;
WriteStr : string;
begin
WriteStr := '[';
for i := 0 to BmpsCurr do
if BmpArray[i] <> nil then
begin;
if BmpArray[i].Name = '' then
TClient(Client).Writeln(Format('BMP[%d] has not been freed in the script, freeing it now.',[i]))
WriteStr := WriteStr + inttostr(i) + ', '
else
TClient(Client).Writeln(Format('BMP[%s] has not been freed in the script, freeing it now.',[BmpArray[i].Name]));
WriteStr := WriteStr + bmpArray[i].Name + ', ';
FreeAndNil(BmpArray[i]);
end;
if WriteStr <> '[' then //Has unfreed bitmaps
begin
SetLength(WriteStr,length(WriteStr)-1);
WriteStr[Length(writeStr)] := ']';
TClient(Client).Writeln(Format('The following bitmaps were not freed: %s',[WriteStr]));
end;
SetLength(BmpArray,0);
SetLength(FreeSpots,0);
inherited Destroy;

View File

@ -73,11 +73,12 @@ end;
{$DEFINE DTM_DEBUG}
destructor TMDTM.Destroy;
var
i, j: integer;
b:boolean;
i, j: integer;
b:boolean;
WriteStr : string;
begin
WriteStr := '[';
for i := 0 to high(DTMList) do
begin
b := false;
@ -90,12 +91,18 @@ begin
if not b then
begin;
if DTMList[i].n <> '' then
TClient(Client).Writeln(Format('DTM[%s] has not been freed in the script, freeing it now.',[DTMList[i].n]))
WriteStr := WriteStr + DTMList[i].n + ', '
else
TClient(Client).Writeln(Format('DTM[%d] has not been freed in the script, freeing it now.',[i]));
WriteStr := WriteStr + inttostr(i) + ', ';
FreeDTM(i);
end;
end;
if WriteStr <> '[' then //Has unfreed DTMs
begin
SetLength(WriteStr,length(WriteStr)-1);
WriteStr[Length(writeStr)] := ']';
TClient(Client).Writeln(Format('The following DTMs were not freed: %s',[WriteStr]));
end;
SetLength(DTMList, 0);
SetLength(FreeSpots, 0);

View File

@ -69,7 +69,7 @@ type
function FindColorTolerance(out x, y: Integer; Color, xs, ys, xe, ye, tol: Integer): Boolean;
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 FindColors(var 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
@ -1306,7 +1306,7 @@ begin
TClient(Client).IOManager.FreeReturnData;
end;
function TMFinder.FindColors(out TPA: TPointArray; Color, xs, ys, xe, ye: Integer): Boolean;
function TMFinder.FindColors(var TPA: TPointArray; Color, xs, ys, xe, ye: Integer): Boolean;
var
PtrData: TRetData;
Ptr: PRGB32;