Simba Code:
{$include SRL\SRL.scar}
{*******************************************************************************
function DebugATPABounds2(aPoints: T2DPointArray; BmpName: string): Boolean;
By: Wizzup? & lordsaturn
Description: Shows an image of the client, plotting each TPA's bounds as a box
of different colour per TPA. If a name is specified, an image
will be saved.
*******************************************************************************}
procedure DebugATPABounds2(aPoints: array Of TPointArray);
var
Width, Height, ClientBMP, I: Integer;
B: TBox;
BoxColors : Array Of Integer;
SelColor: Integer;
{$IFDEF SIMBA}
x,y : integer;
BMP : Integer;
{$ENDIF}
begin
GetClientDimensions(width,height);
DisplayDebugImgWindow(Width, Height);
BoxColors := [clRed, clBlue, clBlack, clGreen, clYellow];
{$IFDEF Simba}
ClientBMP := BitmapFromClient(0,0,width-1,height-1);
{$ELSE}
ClientBMP := BitmapFromString(Width, Height, '');
CopyClientToBitmap(ClientBMP, 0, 0, width, height);
SafeDrawBitmap(ClientBmp, GetDebugCanvas, 0, 0);
GetDebugCanvas.Font.Style := [fsBold];
GetDebugCanvas.Brush.Style := bsClear;
{$ENDIF}
for i:= 0 to high(aPoints) do
begin
SelColor := BoxColors[Random(length(Boxcolors))];
B := GetTPABounds(aPoints[i]);
{$IFDEF Simba}
for x := B.X1 to B.X2 do
begin
FastSetPixel(ClientBMP,x,B.y1,SelColor);
FastSetPixel(ClientBMP,x,B.y2,SelColor);
end;
for y := B.y1 to B.y2 do
begin
FastSetPixel(ClientBMP,B.X1,y,SelColor);
FastSetPixel(ClientBMP,B.X2,y,SelColor);
end;
BMP := BitmapFromText(inttostr(i),StatChars);
FastReplaceColor(bmp,clblack,clyellow);
FastReplaceColor(bmp,clwhite,clblack);
SetTransparentColor(bmp,clYellow);
FastDrawTransparent(B.x1 + 2,b.y1 + 2,bmp,clientbmp);
FreeBitmap(BMP);
{$ELSE}
GetDebugCanvas.Pen.Color := SelColor;
GetDebugCanvas.Font.Color := SelColor;
GetDebugCanvas.Rectangle(B.x1,B.y1,B.x2,B.y2);
GetDebugCanvas.TextOut(B.x1,B.y1,inttostr(i));
{$ENDIF}
end;
{$IFDEF Simba}
DrawBitmapDebugImg(clientBMP);
{$ENDIF}
FreeBitmap(ClientBmp);
end;
var
TPA: TPointArray;
ATPA: T2DPointArray;
begin
SetUpSRL;
TPA := TPAFromBox(IntToBox(0, 0, 500, 500));
ATPA := TPAToATPAEx(TPA, 10, 10);
DebugATPABounds2(ATPA);
end.