mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-25 18:52:15 -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:
parent
121560f8be
commit
82e54e5b07
@ -22,6 +22,11 @@ begin
|
||||
Result := CurrThread.Client.MOCR.TextToMask(text,font);
|
||||
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;
|
||||
begin
|
||||
Result := CurrThread.Client.MOCR.TextToFontTPA(text, font, w, h);
|
||||
|
@ -90,6 +90,11 @@ begin;
|
||||
result := GetTickCount - CurrThread.StartTime;
|
||||
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;
|
||||
var
|
||||
x : integer;
|
||||
|
@ -212,6 +212,7 @@ AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
|
||||
AddFunction(@rs_GetUpTextAt, 'function rs_GetUpTextAt(x, y : integer): string;');
|
||||
AddFunction(@BitmapFromText, 'function BitmapFromText(text, font: String): integer;');
|
||||
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(@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}
|
||||
SetCurrSection('TPA');
|
||||
AddFunction(@ps_Quicksort,'procedure Quicksort(var Arr : TIntegerArray);');
|
||||
AddFunction(@tSwap,'procedure tSwap(var a, b: TPoint);');
|
||||
AddFunction(@tpaSwap,'procedure tpaSwap(var a, b: TPointArray);');
|
||||
AddFunction(@SwapE,'procedure SwapE(var a, b: Extended);');
|
||||
|
@ -762,7 +762,7 @@ begin
|
||||
PtrRet := TIOManager_Abstract(MWindow).ReturnData(xs,ys,wi,hi);
|
||||
|
||||
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;
|
||||
end;
|
||||
|
||||
@ -781,7 +781,7 @@ begin
|
||||
PtrRet := TIOManager_Abstract(MWindow).ReturnData(xs,ys,wi - x,hi - y);
|
||||
|
||||
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;
|
||||
end;
|
||||
|
||||
|
@ -30,6 +30,7 @@ uses
|
||||
Classes, SysUtils, mufasatypes;
|
||||
|
||||
function FastTPASort(TPA: TPointArray; Dists: TIntegerArray; maxDist: Integer; CloseFirst: Boolean): TPointArray;
|
||||
procedure QuickSort(var A: TIntegerArray; iLo, iHi: Integer);
|
||||
|
||||
//Start Wizzyplugin
|
||||
procedure tSwap(var a, b: TPoint);
|
||||
@ -174,6 +175,29 @@ Begin
|
||||
// Voila!
|
||||
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
|
||||
flnC=545947;
|
||||
fsqrtA:single=0.5;
|
||||
|
Loading…
Reference in New Issue
Block a user