1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-22 09:12:19 -05:00

Added some methods to complete SRL compatibility.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@527 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-02-06 02:21:27 +00:00
parent 121560f8be
commit 82e54e5b07
5 changed files with 38 additions and 2 deletions

View File

@ -22,6 +22,11 @@ begin
Result := CurrThread.Client.MOCR.TextToMask(text,font); Result := CurrThread.Client.MOCR.TextToMask(text,font);
end; end;
procedure TPAFromTextWrap(text, font: String;out w,h : integer;out TPA : TPointArray); extdecl;
begin
TPA := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h);
end;
function TPAFromText(text, font: String;out w,h : integer): TPointArray; extdecl; function TPAFromText(text, font: String;out w,h : integer): TPointArray; extdecl;
begin begin
Result := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h); Result := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h);

View File

@ -90,6 +90,11 @@ begin;
result := GetTickCount - CurrThread.StartTime; result := GetTickCount - CurrThread.StartTime;
end; end;
procedure ps_Quicksort(var Arr : TIntegerArray); extdecl;
begin
QuickSort(Arr,low(arr),high(arr));
end;
procedure ConvertTime(Time : integer; var h,m,s : integer); extdecl; procedure ConvertTime(Time : integer; var h,m,s : integer); extdecl;
var var
x : integer; x : integer;

View File

@ -212,6 +212,7 @@ AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
AddFunction(@rs_GetUpTextAt, 'function rs_GetUpTextAt(x, y : integer): string;'); AddFunction(@rs_GetUpTextAt, 'function rs_GetUpTextAt(x, y : integer): string;');
AddFunction(@BitmapFromText, 'function BitmapFromText(text, font: String): integer;'); AddFunction(@BitmapFromText, 'function BitmapFromText(text, font: String): integer;');
AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;out w,h : integer): TPointArray;'); AddFunction(@TPAFromText, 'function TPAFromText(text, font: String;out w,h : integer): TPointArray;');
AddFunction(@TPAFromTextWrap,'procedure TPAFromTextWrap(text, font: String;out w,h : integer;out TPA : TPointArray)');
AddFunction(@MaskFromText, 'function MaskFromText(text, font: String): TMask;'); AddFunction(@MaskFromText, 'function MaskFromText(text, font: String): TMask;');
AddFunction(@GetTextAt,'function GetTextAt(atX, atY, minvspacing, maxvspacing, hspacing,color, tol, len: integer; font: string): string;'); AddFunction(@GetTextAt,'function GetTextAt(atX, atY, minvspacing, maxvspacing, hspacing,color, tol, len: integer; font: string): string;');
@ -265,6 +266,7 @@ AddFunction(@DrawATPABitmapEx,'procedure DrawATPABitmapEx(bitmap: integer; ATPA:
{tpa} {tpa}
SetCurrSection('TPA'); SetCurrSection('TPA');
AddFunction(@ps_Quicksort,'procedure Quicksort(var Arr : TIntegerArray);');
AddFunction(@tSwap,'procedure tSwap(var a, b: TPoint);'); AddFunction(@tSwap,'procedure tSwap(var a, b: TPoint);');
AddFunction(@tpaSwap,'procedure tpaSwap(var a, b: TPointArray);'); AddFunction(@tpaSwap,'procedure tpaSwap(var a, b: TPointArray);');
AddFunction(@SwapE,'procedure SwapE(var a, b: Extended);'); AddFunction(@SwapE,'procedure SwapE(var a, b: Extended);');

View File

@ -762,7 +762,7 @@ begin
PtrRet := TIOManager_Abstract(MWindow).ReturnData(xs,ys,wi,hi); PtrRet := TIOManager_Abstract(MWindow).ReturnData(xs,ys,wi,hi);
for y := 0 to (hi-1) do for y := 0 to (hi-1) do
Move(PtrRet.Ptr[y * (wi + PtrRet.IncPtrWith)], FData[y * self.w],wi * SizeOf(TRGB32)); Move(PtrRet.Ptr[y * PtrRet.RowLen], FData[y * self.w],wi * SizeOf(TRGB32));
TIOManager_Abstract(MWindow).FreeReturnData; TIOManager_Abstract(MWindow).FreeReturnData;
end; end;
@ -781,7 +781,7 @@ begin
PtrRet := TIOManager_Abstract(MWindow).ReturnData(xs,ys,wi - x,hi - y); PtrRet := TIOManager_Abstract(MWindow).ReturnData(xs,ys,wi - x,hi - y);
for yy := 0 to (hi-1 - y) do for yy := 0 to (hi-1 - y) do
Move(PtrRet.Ptr[yy * (wi - x + PtrRet.IncPtrWith)], FData[(yy + y) * self.w + x],wi * SizeOf(TRGB32)); Move(PtrRet.Ptr[yy * (PtrRet.RowLen)], FData[(yy + y) * self.w + x],wi * SizeOf(TRGB32));
TIOManager_Abstract(MWindow).FreeReturnData; TIOManager_Abstract(MWindow).FreeReturnData;
end; end;

View File

@ -30,6 +30,7 @@ uses
Classes, SysUtils, mufasatypes; Classes, SysUtils, mufasatypes;
function FastTPASort(TPA: TPointArray; Dists: TIntegerArray; maxDist: Integer; CloseFirst: Boolean): TPointArray; function FastTPASort(TPA: TPointArray; Dists: TIntegerArray; maxDist: Integer; CloseFirst: Boolean): TPointArray;
procedure QuickSort(var A: TIntegerArray; iLo, iHi: Integer);
//Start Wizzyplugin //Start Wizzyplugin
procedure tSwap(var a, b: TPoint); procedure tSwap(var a, b: TPoint);
@ -174,6 +175,29 @@ Begin
// Voila! // Voila!
End; End;
procedure QuickSort(var A: TIntegerArray; iLo, iHi: Integer) ;
var
Lo, Hi, Pivot, T: Integer;
begin
Lo := iLo;
Hi := iHi;
Pivot := A[(Lo + Hi) div 2];
repeat
while A[Lo] < Pivot do Inc(Lo) ;
while A[Hi] > Pivot do Dec(Hi) ;
if Lo <= Hi then
begin
T := A[Lo];
A[Lo] := A[Hi];
A[Hi] := T;
Inc(Lo) ;
Dec(Hi) ;
end;
until Lo > Hi;
if Hi > iLo then QuickSort(A, iLo, Hi) ;
if Lo < iHi then QuickSort(A, Lo, iHi) ;
end;
const const
flnC=545947; flnC=545947;
fsqrtA:single=0.5; fsqrtA:single=0.5;