Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {$loadlib tpaconvexhull.dll}
- {$loadlib pumbaa.dll}
- {==============================================================================]
- Explanation: Sets points from TPA that are inside bmp as color.
- [==============================================================================}
- procedure SetPixels(bmp: Integer; TPA: TPointArray; color: Integer);
- var
- a, z, w, h: Integer;
- begin
- z := High(TPA);
- if (z > -1) then
- begin
- GetBitmapSize(bmp, w, h);
- for a := 0 to z do
- if ((TPA[a].X >= 0) and (TPA[a].Y >= 0) and (TPA[a].X < w) and (TPA[a].Y < h)) then
- FastSetPixel(bmp, TPA[a].X, TPA[a].Y, color);
- end;
- end;
- var
- TPA, p, t: TPointArray;
- bmp: Integer;
- begin
- bmp := CreateBitmap(500, 500);
- TPA := [Point(10, 50), Point(50, 10), Point(140, 100), Point(100, 180), Point(10, 10), Point(50, 50), Point(30, 25), Point(40, 54), Point(15, 15), Point(18, 39)];
- t := CopyTPA(TPA);
- SetPixels(bmp, t, 13655361);
- TPAConvexHull(TPA);
- pp_Append(TPA, TPA[0]); // Just to make sure we get it enclosed.. :)
- pp_TPAFromFlexibleLine(TPA, p);
- SetPixels(bmp, p, 255);
- SetPixels(bmp, TPA, 16777215);
- DisplayDebugImgWindow(500, 500);
- DrawBitmapDebugImg(bmp);
- end.
Advertisement
Add Comment
Please, Sign In to add comment