mirror of
https://github.com/moparisthebest/Simba
synced 2025-03-06 04:09:40 -05:00
Mem leak fix
This commit is contained in:
parent
1a8e3977b7
commit
a7eccb53d2
@ -2045,7 +2045,7 @@ begin
|
|||||||
|
|
||||||
Self.OnScriptStart:= @ScriptStartEvent;
|
Self.OnScriptStart:= @ScriptStartEvent;
|
||||||
|
|
||||||
FillThread := TProcThread.Create(true);
|
FillThread := TProcThread.Create;
|
||||||
FillThread.FreeOnTerminate:= True;
|
FillThread.FreeOnTerminate:= True;
|
||||||
FillThread.NormalProc:= @CCFillCore;
|
FillThread.NormalProc:= @CCFillCore;
|
||||||
UpdateTimer.OnTimer:= @UpdateTimerCheck;
|
UpdateTimer.OnTimer:= @UpdateTimerCheck;
|
||||||
@ -2359,15 +2359,14 @@ function TForm1.GetSimbaNews: String;
|
|||||||
var
|
var
|
||||||
t: TDownloadThread;
|
t: TDownloadThread;
|
||||||
begin
|
begin
|
||||||
t := TDownloadThread.Create;
|
t := TDownloadThread.Create(LoadSettingDef('Settings/News/URL', 'http://simba.villavu.com/bin/news'),
|
||||||
t.InputURL:=LoadSettingDef('Settings/News/URL', 'http://simba.villavu.com/bin/news');
|
@Result);
|
||||||
t.Resume;
|
t.Resume;
|
||||||
while not t.done do
|
while not t.done do
|
||||||
begin
|
begin
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
Sleep(50);
|
Sleep(50);
|
||||||
end;
|
end;
|
||||||
Exit(t.ResultStr);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.SetExtPath(const AValue: string);
|
procedure TForm1.SetExtPath(const AValue: string);
|
||||||
@ -2634,6 +2633,7 @@ var
|
|||||||
FontDownload : TDownloadThread;
|
FontDownload : TDownloadThread;
|
||||||
Stream : TStringStream;
|
Stream : TStringStream;
|
||||||
UnTarrer : TUntarThread;
|
UnTarrer : TUntarThread;
|
||||||
|
Fonts : string;
|
||||||
Decompress : TDecompressThread;
|
Decompress : TDecompressThread;
|
||||||
begin
|
begin
|
||||||
if UpdatingFonts then
|
if UpdatingFonts then
|
||||||
@ -2644,12 +2644,13 @@ begin
|
|||||||
if LatestVersion > CurrVersion then
|
if LatestVersion > CurrVersion then
|
||||||
begin;
|
begin;
|
||||||
formWriteln(format('New fonts available. Current version: %d. Latest version: %d',[CurrVersion,LatestVersion]));
|
formWriteln(format('New fonts available. Current version: %d. Latest version: %d',[CurrVersion,LatestVersion]));
|
||||||
FontDownload := TDownloadThread.Create(True);
|
FontDownload := TDownloadThread.Create(LoadSettingDef('Settings/Fonts/UpdateLink',FontURL + 'Fonts.tar.bz2'),
|
||||||
FontDownload.InputURL:= LoadSettingDef('Settings/Fonts/UpdateLink',FontURL + 'Fonts.tar.bz2');
|
@Fonts);
|
||||||
FontDownload.resume;
|
FontDownload.resume;
|
||||||
while FontDownload.Done = false do
|
while FontDownload.Done = false do
|
||||||
Idler;
|
Idler;
|
||||||
Stream := TStringStream.Create(FontDownload.ResultStr);
|
//Fontdownload is freed now
|
||||||
|
Stream := TStringStream.Create(Fonts);
|
||||||
try
|
try
|
||||||
Decompress := TDecompressThread.Create(Stream);
|
Decompress := TDecompressThread.Create(Stream);
|
||||||
Decompress.Resume;
|
Decompress.Resume;
|
||||||
@ -2676,7 +2677,6 @@ begin
|
|||||||
Decompress.free;
|
Decompress.free;
|
||||||
finally
|
finally
|
||||||
Stream.Free;
|
Stream.Free;
|
||||||
FontDownload.Free;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
UpdatingFonts := False;
|
UpdatingFonts := False;
|
||||||
|
@ -15,11 +15,12 @@ type
|
|||||||
{ TDownloadThread }
|
{ TDownloadThread }
|
||||||
|
|
||||||
TDownloadThread = class(TThread)
|
TDownloadThread = class(TThread)
|
||||||
public
|
private
|
||||||
ResultStr : string;
|
|
||||||
InputURL : string;
|
InputURL : string;
|
||||||
|
ResultStr : PString;
|
||||||
|
public
|
||||||
Done : boolean;
|
Done : boolean;
|
||||||
constructor Create;
|
constructor Create(const URL : string; const Output : PString);
|
||||||
procedure Execute; override;
|
procedure Execute; override;
|
||||||
end;
|
end;
|
||||||
TSimbaUpdateForm = class(TForm)
|
TSimbaUpdateForm = class(TForm)
|
||||||
@ -91,20 +92,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TSimbaUpdateForm.GetLatestFontVersion: integer;
|
function TSimbaUpdateForm.GetLatestFontVersion: integer;
|
||||||
|
var
|
||||||
|
Vers : string;
|
||||||
begin
|
begin
|
||||||
if FontVersionThread = nil then//Create thread (only if no-other one is already running)
|
if FontVersionThread = nil then//Create thread (only if no-other one is already running)
|
||||||
begin
|
begin
|
||||||
FontVersionThread := TDownloadThread.Create(true);
|
FontVersionThread := TDownloadThread.Create(SettingsForm.Settings.GetKeyValueDefLoad(
|
||||||
FontVersionThread.InputURL := SettingsForm.Settings.GetKeyValueDefLoad(
|
'Settings/Fonts/VersionLink',FontURL + 'Version',SimbaSettingsFile),
|
||||||
'Settings/Fonts/VersionLink',FontURL + 'Version',SimbaSettingsFile);
|
@Vers);
|
||||||
FontVersionThread.Resume;
|
FontVersionThread.Resume;
|
||||||
while FontVersionThread.Done = false do//Wait till thread is done
|
while FontVersionThread.Done = false do//Wait till thread is done
|
||||||
begin
|
begin
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
Sleep(25);
|
Sleep(25);
|
||||||
end;
|
end;
|
||||||
FFontVersion := StrToIntDef(Trim(FontVersionThread.ResultStr), -1);//Read output
|
FFontVersion := StrToIntDef(Trim(Vers), -1);//Read output
|
||||||
FreeAndNil(FontVersionThread);//Free the thread
|
FontVersionThread := nil; //It's already freed
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
//Another thread is already running, lets wait for it! (When it's nil, it means that the result is written!)
|
//Another thread is already running, lets wait for it! (When it's nil, it means that the result is written!)
|
||||||
@ -119,21 +122,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TSimbaUpdateForm.GetLatestSimbaVersion: Integer;
|
function TSimbaUpdateForm.GetLatestSimbaVersion: Integer;
|
||||||
|
var
|
||||||
|
Vers : string;
|
||||||
begin
|
begin
|
||||||
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
|
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
|
||||||
begin
|
begin
|
||||||
SimbaVersionThread := TDownloadThread.Create(true);
|
SimbaVersionThread := TDownloadThread.Create(SettingsForm.Settings.GetKeyValueDefLoad(
|
||||||
|
'Settings/Updater/RemoteVersionLink',SimbaURL + 'Version'
|
||||||
SimbaVersionThread.InputURL := SettingsForm.Settings.GetKeyValueDefLoad(
|
,SimbaSettingsFile),@Vers);
|
||||||
'Settings/Updater/RemoteVersionLink',SimbaURL + 'Version',SimbaSettingsFile);
|
|
||||||
SimbaVersionThread.Resume;
|
SimbaVersionThread.Resume;
|
||||||
while SimbaVersionThread.Done = false do//Wait till thread is done
|
while SimbaVersionThread.Done = false do//Wait till thread is done
|
||||||
begin
|
begin
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
Sleep(25);
|
Sleep(25);
|
||||||
end;
|
end;
|
||||||
FSimbaVersion := StrToIntDef(Trim(SimbaVersionThread.ResultStr), -1);//Read output
|
FSimbaVersion := StrToIntDef(Trim(Vers), -1);//Read output
|
||||||
FreeAndNil(SimbaVersionThread);//Free the thread
|
SimbaVersionThread := nil;//It's automatically freed
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
//Another thread is already running, lets wait for it! (When it's nil, it means that the result is written!)
|
//Another thread is already running, lets wait for it! (When it's nil, it means that the result is written!)
|
||||||
@ -264,17 +268,19 @@ begin
|
|||||||
FUpdating:= false;
|
FUpdating:= false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TDownloadThread.Create;
|
constructor TDownloadThread.Create(const url : String; const Output : PString);
|
||||||
begin
|
begin
|
||||||
inherited Create(true);
|
inherited Create(true);
|
||||||
FreeOnTerminate:= True;
|
FreeOnTerminate:= True;
|
||||||
|
InputURL:= url;
|
||||||
|
ResultStr:= Output;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDownloadThread }
|
{ TDownloadThread }
|
||||||
|
|
||||||
procedure TDownloadThread.Execute;
|
procedure TDownloadThread.Execute;
|
||||||
begin
|
begin
|
||||||
ResultStr:= GetPage(InputURL);
|
ResultStr^:= GetPage(InputURL);
|
||||||
done := true;
|
done := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ begin;
|
|||||||
raise exception.createfmt('Wrong Width or Height in ScretchResize: (%d,%d)',[NewW,NewH]);
|
raise exception.createfmt('Wrong Width or Height in ScretchResize: (%d,%d)',[NewW,NewH]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ps_GetBitmapSize(Bmp : integer; out BmpW,BmpH : integer); extdecl;
|
procedure ps_GetBitmapSize(Bmp : integer; var BmpW,BmpH : integer); extdecl;
|
||||||
begin;
|
begin;
|
||||||
With CurrThread.Client.MBitmaps[bmp] do
|
With CurrThread.Client.MBitmaps[bmp] do
|
||||||
begin;
|
begin;
|
||||||
@ -170,19 +170,19 @@ begin;
|
|||||||
CurrThread.Client.MBitmaps[result].CopyClientToBitmap(CurrThread.Client.IOManager,True,xs,ys,xe,ye);
|
CurrThread.Client.MBitmaps[result].CopyClientToBitmap(CurrThread.Client.IOManager,True,xs,ys,xe,ye);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps_FindBitmap(Bitmap: integer; out x, y: Integer): Boolean; extdecl;
|
function ps_FindBitmap(Bitmap: integer; var x, y: Integer): Boolean; extdecl;
|
||||||
begin;
|
begin;
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindBitmap( MBitmaps[bitmap],x,y);
|
result := MFinder.FindBitmap( MBitmaps[bitmap],x,y);
|
||||||
end;
|
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;
|
begin;
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindBitmapIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye);
|
result := MFinder.FindBitmapIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye);
|
||||||
end;
|
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;
|
begin;
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindBitmapToleranceIn( MBitmaps[bitmap],x,y,xs,ys,xe,ye,tolerance);
|
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);
|
result := MFinder.FindBitmapSpiral(Mbitmaps[bitmap],x,y,xs,ys,xe,ye);
|
||||||
end;
|
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;
|
begin;
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindBitmapsSpiralTolerance(MBitmaps[bitmap],x,y,points,xs,ys,xe,ye,tolerance);
|
result := MFinder.FindBitmapsSpiralTolerance(MBitmaps[bitmap],x,y,points,xs,ys,xe,ye,tolerance);
|
||||||
@ -270,11 +270,11 @@ begin;
|
|||||||
result := CurrThread.Client.MBitmaps[Bitmap].CreateTMask;
|
result := CurrThread.Client.MBitmaps[Bitmap].CreateTMask;
|
||||||
end;
|
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;
|
begin;
|
||||||
result := CurrThread.Client.MFinder.FindMaskTolerance(Mask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
|
result := CurrThread.Client.MFinder.FindMaskTolerance(Mask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
|
||||||
end;
|
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;
|
begin;
|
||||||
{$ifdef mDebug}
|
{$ifdef mDebug}
|
||||||
mDebugLn('Better be using FindMaskTolerance in combination with CreateMaskFromBitmap, more efficient.');
|
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);
|
result := MFinder.FindMaskTolerance(MBitmaps[mask].CreateTMask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
|
||||||
end;
|
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;
|
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;
|
begin;
|
||||||
result := CurrThread.Client.MFinder.FindDeformedBitmapToleranceIn(CurrThread.Client.MBitmaps[Bitmap],x,y,xs,ys,xe,ye,tolerance,range,AllowPartialAccuracy,accuracy);
|
result := CurrThread.Client.MFinder.FindDeformedBitmapToleranceIn(CurrThread.Client.MBitmaps[Bitmap],x,y,xs,ys,xe,ye,tolerance,range,AllowPartialAccuracy,accuracy);
|
||||||
end;
|
end;
|
||||||
|
@ -36,21 +36,21 @@ begin
|
|||||||
result := CurrThread.Client.MFinder.GetColors(coords);
|
result := CurrThread.Client.MFinder.GetColors(coords);
|
||||||
end;
|
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
|
begin
|
||||||
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
|
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
|
||||||
end;
|
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
|
begin
|
||||||
Result := CurrThread.Client.MFinder.FindColorToleranceOptimised(x, y, color, x1, y1, x2, y2, tol);
|
Result := CurrThread.Client.MFinder.FindColorToleranceOptimised(x, y, color, x1, y1, x2, y2, tol);
|
||||||
end;
|
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
|
begin
|
||||||
Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
|
Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
|
||||||
end;
|
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
|
begin
|
||||||
Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
|
Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
|
||||||
end;
|
end;
|
||||||
@ -70,7 +70,7 @@ begin
|
|||||||
CurrThread.Client.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
|
CurrThread.Client.MFinder.SetToleranceSpeed2Modifiers(nHue, nSat);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ps_GetToleranceSpeed2Modifiers(out hMod, sMod: Extended); extdecl;
|
procedure ps_GetToleranceSpeed2Modifiers(var hMod, sMod: Extended); extdecl;
|
||||||
begin
|
begin
|
||||||
CurrThread.Client.MFinder.GetToleranceSpeed2Modifiers(hMod, sMod);
|
CurrThread.Client.MFinder.GetToleranceSpeed2Modifiers(hMod, sMod);
|
||||||
end;
|
end;
|
||||||
@ -89,11 +89,11 @@ begin;
|
|||||||
result := CurrThread.Client.MFinder.CountColorTolerance(color,xs,ys,xe,ye,tolerance);
|
result := CurrThread.Client.MFinder.CountColorTolerance(color,xs,ys,xe,ye,tolerance);
|
||||||
end;
|
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;
|
begin;
|
||||||
result := CurrThread.Client.MFinder.FindColorsToleranceOptimised(points,color,xs,ys,xe,ye,tolerance);
|
result := CurrThread.Client.MFinder.FindColorsToleranceOptimised(points,color,xs,ys,xe,ye,tolerance);
|
||||||
end;
|
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;
|
begin;
|
||||||
result := CurrThread.Client.MFinder.FindColorsTolerance(points,color,xs,ys,xe,ye,tolerance);
|
result := CurrThread.Client.MFinder.FindColorsTolerance(points,color,xs,ys,xe,ye,tolerance);
|
||||||
end;
|
end;
|
||||||
@ -108,7 +108,7 @@ begin
|
|||||||
result := CurrThread.Client.MFinder.FindColorSpiralTolerance(x,y,color,xs,ys,xe,ye,tol);
|
result := CurrThread.Client.MFinder.FindColorSpiralTolerance(x,y,color,xs,ys,xe,ye,tol);
|
||||||
end;
|
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;
|
begin;
|
||||||
result := CurrThread.Client.MFinder.FindColorsSpiralTolerance(x,y,Points,color,xs,ys,xe,ye,tolerance);
|
result := CurrThread.Client.MFinder.FindColorsSpiralTolerance(x,y,Points,color,xs,ys,xe,ye,tolerance);
|
||||||
end;
|
end;
|
||||||
|
@ -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
|
begin
|
||||||
colour_conv.ColorToRGB(color,r,g,b);
|
colour_conv.ColorToRGB(color,rr,gg,bb);
|
||||||
|
r := rr;
|
||||||
|
g := gg;
|
||||||
|
b := bb;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps_RGBtoColor(r, g, b: Byte): TColor;extdecl;
|
function ps_RGBtoColor(r, g, b: Integer): TColor;extdecl;
|
||||||
begin
|
begin
|
||||||
result := RGBtoColor(r,g,b);
|
result := RGBtoColor(r,g,b);
|
||||||
end;
|
end;
|
||||||
@ -28,21 +33,31 @@ begin
|
|||||||
result := XYZToColor(x,y,z);
|
result := XYZToColor(x,y,z);
|
||||||
end;
|
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
|
begin
|
||||||
RGBToHSL(r,g,b,h,s,l);
|
RGBToHSL(r,g,b,h,s,l);
|
||||||
end;
|
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
|
begin
|
||||||
HSLtoRGB(h,s,l,r,g,b);
|
HSLtoRGB(h,s,l,rr,gg,bb);
|
||||||
|
r := rr;
|
||||||
|
g := gg;
|
||||||
|
b := bb;
|
||||||
end;
|
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
|
begin
|
||||||
RGBToXYZ(r,g,b,x,y,z);
|
RGBToXYZ(r,g,b,x,y,z);
|
||||||
end;
|
end;
|
||||||
procedure ps_XYZToRGB(X, Y, Z: Extended; var R, G, B: Byte);extdecl;
|
procedure ps_XYZToRGB(X, Y, Z: Extended; var R, G, B: Integer);extdecl;
|
||||||
begin
|
var
|
||||||
XYZToRGB(x,y,z,r,g,b);
|
RR,GG,BB : byte;
|
||||||
|
begin;
|
||||||
|
XYZToRGB(x,y,z,rr,gg,bb);
|
||||||
|
r := rr;
|
||||||
|
g := gg;
|
||||||
|
b := bb;
|
||||||
end;
|
end;
|
||||||
|
@ -21,42 +21,42 @@
|
|||||||
DTM.inc for the Mufasa Macro Library
|
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
|
begin
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindDTM(MDTM.GetDTM(DTM),x,y,xs,ys,xe,ye);
|
result := MFinder.FindDTM(MDTM.GetDTM(DTM),x,y,xs,ys,xe,ye);
|
||||||
end;
|
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
|
begin
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindDTMs(MDTM.GetDTM(DTM), p, xs, ys, xe, ye);
|
result := MFinder.FindDTMs(MDTM.GetDTM(DTM), p, xs, ys, xe, ye);
|
||||||
end;
|
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;
|
Integer; sAngle, eAngle, aStep: Extended;
|
||||||
out aFound: Extended): Boolean; extdecl;
|
var aFound: Extended): Boolean; extdecl;
|
||||||
begin
|
begin
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindDTMRotated(MDTM.GetDTM(DTM), x,y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound,true);
|
result := MFinder.FindDTMRotated(MDTM.GetDTM(DTM), x,y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound,true);
|
||||||
end;
|
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;
|
Integer; sAngle, eAngle, aStep: Extended;
|
||||||
out aFound: Extended): Boolean; extdecl;
|
var aFound: Extended): Boolean; extdecl;
|
||||||
begin
|
begin
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindDTMRotated(MDTM.GetDTM(DTM), x, y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound,false);
|
result := MFinder.FindDTMRotated(MDTM.GetDTM(DTM), x, y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound,false);
|
||||||
end;
|
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
|
begin
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindDTMsRotated(MDTM.GetDTM(DTM), Points, xs, ys, xe, ye,
|
result := MFinder.FindDTMsRotated(MDTM.GetDTM(DTM), Points, xs, ys, xe, ye,
|
||||||
sAngle, eAngle, aStep, aFound, true);
|
sAngle, eAngle, aStep, aFound, true);
|
||||||
end;
|
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
|
begin
|
||||||
with CurrThread.Client do
|
with CurrThread.Client do
|
||||||
result := MFinder.FindDTMsRotated(MDTM.GetDTM(DTM), Points, xs, ys, xe, ye,
|
result := MFinder.FindDTMsRotated(MDTM.GetDTM(DTM), Points, xs, ys, xe, ye,
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
type
|
type
|
||||||
TStringArray = array of string;
|
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
|
var
|
||||||
Stream : TStringStream;
|
Stream : TStringStream;
|
||||||
begin
|
begin
|
||||||
@ -58,7 +58,7 @@ begin
|
|||||||
stream.free;
|
stream.free;
|
||||||
end;
|
end;
|
||||||
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
|
var
|
||||||
Stream : TStringStream;
|
Stream : TStringStream;
|
||||||
Decompress : TDecompressThread;
|
Decompress : TDecompressThread;
|
||||||
@ -95,15 +95,13 @@ var
|
|||||||
begin
|
begin
|
||||||
result := '';
|
result := '';
|
||||||
try
|
try
|
||||||
t := TDownloadThread.Create(true);
|
t := TDownloadThread.Create(url,@result);
|
||||||
t.InputURL:=url;
|
|
||||||
t.Resume;
|
t.Resume;
|
||||||
while not t.done do
|
while not t.done do
|
||||||
begin
|
begin
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
Sleep(25);
|
Sleep(25);
|
||||||
end;
|
end;
|
||||||
Exit(t.ResultStr);
|
|
||||||
except
|
except
|
||||||
on e : exception do
|
on e : exception do
|
||||||
mDebugLn('Exception in GetPage in Extensions: ' + e.message);
|
mDebugLn('Exception in GetPage in Extensions: ' + e.message);
|
||||||
|
@ -134,7 +134,7 @@ begin;
|
|||||||
x := x mod (1000 * 60);
|
x := x mod (1000 * 60);
|
||||||
s := x div (1000);
|
s := x div (1000);
|
||||||
end;
|
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
|
begin
|
||||||
decodedate(sourcedate,year,month,day);
|
decodedate(sourcedate,year,month,day);
|
||||||
end;
|
end;
|
||||||
|
@ -278,69 +278,69 @@ begin
|
|||||||
result := AverageExtended(te);
|
result := AverageExtended(te);
|
||||||
end;
|
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
|
begin
|
||||||
res := SplitTPAEx(arr,w,h);
|
res := SplitTPAEx(arr,w,h);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ps_SplitTPAWrap(arr: TPointArray; Dist: Integer; out res: T2DPointArray);extdecl;
|
procedure ps_SplitTPAWrap(arr: TPointArray; Dist: Integer; var res: T2DPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
res := SplitTPA(arr,dist);
|
res := SplitTPA(arr,dist);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ps_FindGapsTPAWrap(TPA: TPointArray; MinPixels: Integer; out Res : T2DPointArray); extdecl;
|
procedure ps_FindGapsTPAWrap(TPA: TPointArray; MinPixels: Integer; var Res : T2DPointArray); extdecl;
|
||||||
begin
|
begin
|
||||||
Res := FindGapsTPA(TPA,MinPixels);
|
Res := FindGapsTPA(TPA,MinPixels);
|
||||||
end;
|
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
|
begin
|
||||||
Res := RemoveDistTPointArray(x,y,dist,thepoints,removehigher);
|
Res := RemoveDistTPointArray(x,y,dist,thepoints,removehigher);
|
||||||
end;
|
end;
|
||||||
procedure ps_CombineTPAWrap(Ar1, Ar2: TPointArray; out Res : TPointArray);extdecl;
|
procedure ps_CombineTPAWrap(Ar1, Ar2: TPointArray; var Res : TPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := CombineTPA(Ar1,Ar2);
|
Res := CombineTPA(Ar1,Ar2);
|
||||||
end;
|
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
|
begin
|
||||||
Res := ReArrangeandShortenArrayEx(a,w,h);
|
Res := ReArrangeandShortenArrayEx(a,w,h);
|
||||||
end;
|
end;
|
||||||
procedure ps_ReArrangeandShortenArrayWrap(a: TPointArray; Dist: Integer; out Res : TPointArray);extdecl;
|
procedure ps_ReArrangeandShortenArrayWrap(a: TPointArray; Dist: Integer; var Res : TPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := ReArrangeandShortenArray(a,dist);
|
Res := ReArrangeandShortenArray(a,dist);
|
||||||
end;
|
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
|
begin
|
||||||
Res := TPAtoATPAEx(TPA,w,h);
|
Res := TPAtoATPAEx(TPA,w,h);
|
||||||
end;
|
end;
|
||||||
procedure ps_TPAtoATPAWrap(TPA: TPointArray; Dist: Integer; out Res : T2DPointArray);extdecl;
|
procedure ps_TPAtoATPAWrap(TPA: TPointArray; Dist: Integer; var Res : T2DPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := TPAtoATPA(TPA,Dist);
|
Res := TPAtoATPA(TPA,Dist);
|
||||||
end;
|
end;
|
||||||
procedure ps_CombineIntArrayWrap(Ar1, Ar2: TIntegerArray; out Res : TIntegerArray);extdecl;
|
procedure ps_CombineIntArrayWrap(Ar1, Ar2: TIntegerArray; var Res : TIntegerArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := CombineIntArray(Ar1,Ar2);
|
Res := CombineIntArray(Ar1,Ar2);
|
||||||
end;
|
end;
|
||||||
procedure ps_MergeATPAWrap(ATPA : T2DPointArray; out Res: TPointArray); extdecl;
|
procedure ps_MergeATPAWrap(ATPA : T2DPointArray; var Res: TPointArray); extdecl;
|
||||||
begin
|
begin
|
||||||
Res := MergeATPA(ATPA);
|
Res := MergeATPA(ATPA);
|
||||||
end;
|
end;
|
||||||
procedure ps_TPAFromBoxWrap(const Box : TBox; out Res : TPointArray);extdecl;
|
procedure ps_TPAFromBoxWrap(const Box : TBox; var Res : TPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := TPAFromBox(Box);
|
Res := TPAFromBox(Box);
|
||||||
end;
|
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
|
begin
|
||||||
Res := RotatePoints(P,a,cx,cy);
|
Res := RotatePoints(P,a,cx,cy);
|
||||||
end;
|
end;
|
||||||
procedure ps_FindTPAEdgesWrap(p: TPointArray; out Res : TPointArray);extdecl;
|
procedure ps_FindTPAEdgesWrap(p: TPointArray; var Res : TPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := FindTPAEdges(p);
|
Res := FindTPAEdges(p);
|
||||||
end;
|
end;
|
||||||
procedure ps_ClearTPAFromTPAWrap(arP, ClearPoints: TPointArray; out Res : TPointArray);extdecl;
|
procedure ps_ClearTPAFromTPAWrap(arP, ClearPoints: TPointArray; var Res : TPointArray);extdecl;
|
||||||
begin
|
begin
|
||||||
Res := ClearTPAFromTPA(arP, clearpoints);
|
Res := ClearTPAFromTPA(arP, clearpoints);
|
||||||
end;
|
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
|
begin
|
||||||
Res := ReturnPointsNotInTPA(TotalTPA,box);
|
Res := ReturnPointsNotInTPA(TotalTPA,box);
|
||||||
end;
|
end;
|
||||||
|
@ -76,7 +76,7 @@ begin
|
|||||||
CurrThread.Client.IOManager.FreeTarget(idx);
|
CurrThread.Client.IOManager.FreeTarget(idx);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ps_GetClientDimensions(out w, h: integer); extdecl;
|
procedure ps_GetClientDimensions(var w, h: integer); extdecl;
|
||||||
begin
|
begin
|
||||||
CurrThread.Client.IOManager.GetDimensions(w, h);
|
CurrThread.Client.IOManager.GetDimensions(w, h);
|
||||||
end;
|
end;
|
||||||
|
@ -32,8 +32,8 @@ AddFunction(@ps_DTMFromString, 'function DTMFromString(const DTMString: String):
|
|||||||
AddFunction(@ps_FreeDTM, 'procedure FreeDTM(DTM: Integer);');
|
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_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_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_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; out 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_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_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;');
|
AddFunction(@ps_addDTM, 'function AddDTM(const d: TDTM): Integer;');
|
||||||
@ -180,16 +180,16 @@ AddFunction(@ps_GetRawHeaders,'function GetRawHeaders(Client: Integer): string;'
|
|||||||
|
|
||||||
{ Color Conversions and Speed }
|
{ Color Conversions and Speed }
|
||||||
SetCurrSection('Color Convert');
|
SetCurrSection('Color Convert');
|
||||||
AddFunction(@ps_ColorToRGB, 'procedure ColorToRGB(Color: integer; var r, g, b: Byte);');
|
AddFunction(@ps_ColorToRGB, 'procedure ColorToRGB(Color: integer; var r, g, b: Integer);');
|
||||||
AddFunction(@ps_RGBToColor, 'function RGBtoColor(r, g, b: Byte): TColor;');
|
AddFunction(@ps_RGBToColor, 'function RGBtoColor(r, g, b: Integer): TColor;');
|
||||||
AddFunction(@ps_ColorToHSL, 'procedure ColorToHSL(Color: Integer; var h, s, l: Extended);');
|
AddFunction(@ps_ColorToHSL, 'procedure ColorToHSL(Color: Integer; var h, s, l: Extended);');
|
||||||
AddFunction(@ps_HSLToColor, 'function HSLToColor(H, S, L: Extended): TColor;');
|
AddFunction(@ps_HSLToColor, 'function HSLToColor(H, S, L: Extended): TColor;');
|
||||||
AddFunction(@ps_ColorToXYZ, 'procedure ColorToXYZ(Color: Integer; var x, y, z: Extended);');
|
AddFunction(@ps_ColorToXYZ, 'procedure ColorToXYZ(Color: Integer; var x, y, z: Extended);');
|
||||||
AddFunction(@ps_XYZToColor, 'function XYZToColor(X, Y, Z: Extended): TColor;');
|
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_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: Byte);');
|
AddFunction(@ps_HSLToRGB, 'procedure HSLtoRGB(H, S, L: extended; var R, G ,B: Integer);');
|
||||||
AddFunction(@ps_RGBToXYZ, 'procedure RGBToXYZ(R, G, B: Byte;var x, y ,z: Extended);');
|
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: Byte);');
|
AddFunction(@ps_XYZToRGB, 'procedure XYZToRGB(X, Y, Z: Extended; var R, G, B: Integer);');
|
||||||
|
|
||||||
{ Color Finding }
|
{ Color Finding }
|
||||||
SetCurrSection('Color');
|
SetCurrSection('Color');
|
||||||
|
@ -81,7 +81,8 @@ type
|
|||||||
procedure Invert;overload;
|
procedure Invert;overload;
|
||||||
procedure Posterize(TargetBitmap : TMufasaBitmap; Po : integer);overload;
|
procedure Posterize(TargetBitmap : TMufasaBitmap; Po : integer);overload;
|
||||||
procedure Posterize(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 ToTBitmap: TBitmap;
|
||||||
function ToString : string;
|
function ToString : string;
|
||||||
procedure LoadFromTBitmap(bmp: TBitmap);
|
procedure LoadFromTBitmap(bmp: TBitmap);
|
||||||
@ -519,6 +520,18 @@ begin
|
|||||||
Move(self.FData[0], Result.FData[0],self.w * self.h * SizeOf(TRGB32));
|
Move(self.FData[0], Result.FData[0],self.w * self.h * SizeOf(TRGB32));
|
||||||
end;
|
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;
|
function TMufasaBitmap.ToTBitmap: TBitmap;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -733,12 +746,15 @@ begin
|
|||||||
StartPtr := Self.FData;
|
StartPtr := Self.FData;
|
||||||
For y := 0 to Self.h - 1 do
|
For y := 0 to Self.h - 1 do
|
||||||
For x := 0 to self.w - 1 do
|
For x := 0 to self.w - 1 do
|
||||||
|
begin
|
||||||
|
StartPtr^.A := 0;
|
||||||
if LongWord(StartPtr^) = LongWord(Search) then
|
if LongWord(StartPtr^) = LongWord(Search) then
|
||||||
begin;
|
begin;
|
||||||
L := L + 1;
|
L := L + 1;
|
||||||
Result[L].x := x;
|
Result[L].x := x;
|
||||||
Result[L].y := y;
|
Result[L].y := y;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
SetLength(Result,L + 1);
|
SetLength(Result,L + 1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -809,9 +825,11 @@ begin
|
|||||||
begin;
|
begin;
|
||||||
for loopy := 0 to MinH do
|
for loopy := 0 to MinH do
|
||||||
for loopx := 0 to MinW do
|
for loopx := 0 to MinW do
|
||||||
|
begin;
|
||||||
|
FData[loopy * w + loopx].A := 0;
|
||||||
if LongWord(FData[loopy * w + loopx]) <> LongWord(FTransparentColor) then
|
if LongWord(FData[loopy * w + loopx]) <> LongWord(FTransparentColor) then
|
||||||
TargetBitmap.FData[(loopy + y) * TargetW + loopx + x] := FData[Loopy * w + loopx];
|
TargetBitmap.FData[(loopy + y) * TargetW + loopx + x] := FData[Loopy * w + loopx];
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for loopy := 0 to MinH do
|
for loopy := 0 to MinH do
|
||||||
@ -827,8 +845,11 @@ begin
|
|||||||
OldCol := RGBToBGR(OldColor);
|
OldCol := RGBToBGR(OldColor);
|
||||||
NewCol := RGBToBGR(NewColor);
|
NewCol := RGBToBGR(NewColor);
|
||||||
for i := w*h-1 downto 0 do
|
for i := w*h-1 downto 0 do
|
||||||
|
begin
|
||||||
|
FData[i].a := 0;
|
||||||
if LongWord(FData[i]) = LongWord(OldCol) then
|
if LongWord(FData[i]) = LongWord(OldCol) then
|
||||||
FData[i] := NewCol;
|
FData[i] := NewCol;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMufasaBitmap.CopyClientToBitmap(MWindow : TObject;Resize : boolean; xs, ys, xe, ye: Integer);
|
procedure TMufasaBitmap.CopyClientToBitmap(MWindow : TObject;Resize : boolean; xs, ys, xe, ye: Integer);
|
||||||
@ -1212,16 +1233,24 @@ end;
|
|||||||
destructor TMBitmaps.Destroy;
|
destructor TMBitmaps.Destroy;
|
||||||
var
|
var
|
||||||
I : integer;
|
I : integer;
|
||||||
|
WriteStr : string;
|
||||||
begin
|
begin
|
||||||
|
WriteStr := '[';
|
||||||
for i := 0 to BmpsCurr do
|
for i := 0 to BmpsCurr do
|
||||||
if BmpArray[i] <> nil then
|
if BmpArray[i] <> nil then
|
||||||
begin;
|
begin;
|
||||||
if BmpArray[i].Name = '' then
|
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
|
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]);
|
FreeAndNil(BmpArray[i]);
|
||||||
end;
|
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(BmpArray,0);
|
||||||
SetLength(FreeSpots,0);
|
SetLength(FreeSpots,0);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
@ -73,11 +73,12 @@ end;
|
|||||||
|
|
||||||
{$DEFINE DTM_DEBUG}
|
{$DEFINE DTM_DEBUG}
|
||||||
destructor TMDTM.Destroy;
|
destructor TMDTM.Destroy;
|
||||||
|
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
b:boolean;
|
b:boolean;
|
||||||
|
WriteStr : string;
|
||||||
begin
|
begin
|
||||||
|
WriteStr := '[';
|
||||||
for i := 0 to high(DTMList) do
|
for i := 0 to high(DTMList) do
|
||||||
begin
|
begin
|
||||||
b := false;
|
b := false;
|
||||||
@ -90,12 +91,18 @@ begin
|
|||||||
if not b then
|
if not b then
|
||||||
begin;
|
begin;
|
||||||
if DTMList[i].n <> '' then
|
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
|
else
|
||||||
TClient(Client).Writeln(Format('DTM[%d] has not been freed in the script, freeing it now.',[i]));
|
WriteStr := WriteStr + inttostr(i) + ', ';
|
||||||
FreeDTM(i);
|
FreeDTM(i);
|
||||||
end;
|
end;
|
||||||
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(DTMList, 0);
|
||||||
SetLength(FreeSpots, 0);
|
SetLength(FreeSpots, 0);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ type
|
|||||||
function FindColorTolerance(out x, y: Integer; Color, xs, ys, xe, ye, tol: Integer): Boolean;
|
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 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 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 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;
|
function FindColoredAreaTolerance(var x, y: Integer; color, xs, ys, xe, ye: Integer; MinArea, tol: Integer): Boolean;
|
||||||
//Mask
|
//Mask
|
||||||
@ -1302,7 +1302,7 @@ begin
|
|||||||
TClient(Client).IOManager.FreeReturnData;
|
TClient(Client).IOManager.FreeReturnData;
|
||||||
end;
|
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
|
var
|
||||||
PtrData: TRetData;
|
PtrData: TRetData;
|
||||||
Ptr: PRGB32;
|
Ptr: PRGB32;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user