SRL Archive - SRL Suggestions

DebugPoints


Shatterhand

2012-04-16 13:23:23

I made a procedure (modified existing ones) for debugging a TPA and ATPA the SAME TIME. It marks the first in the ATPA.
Pretty useful for testing! :)
procedure DebugPoints(TPA: TPointArray; ATPA: array Of TPointArray);
var
BMP, x,y, i, Color : Integer;
Box: TBox;
begin
BMP := BitmapFromClient(0,0,MSX2,MSY2);
DrawTPABitmap(BMP,TPA,clRed);

for i := 0 to high(ATPA) do
begin
if i = 0 then
Color := clYellow
else
Color := clBlack;

Box := getTPABounds(ATPA[i]);

for x := Box.x1 to Box.x2 do
begin
FastSetPixel(BMP, x, Box.y1, Color)
FastSetPixel(BMP, x, Box.y2, Color)
end;
for y := Box.y1 to Box.y2 do
begin
FastSetPixel(BMP, Box.x1, y, Color)
FastSetPixel(BMP, Box.x2, y, Color)
end;

end;
DebugBitmap(BMP);
FreeBitmap(BMP);
end;

Coh3n

2012-04-16 17:29:52

Neat. I think I'll add this when I get home in a couple weeks. If no one does before me.