Skip to menu

Robotics with Object Pascal

Drawing a line on TBGRAVirtualScreen

2025.07.13 18:35

me Views:34

// Drawing on a BITMAP before it gets assigned for display

procedure Tfrm3D2main.BGRASurfaceRedraw(Sender: TObject; Bitmap: TBGRABitmap);

var

   LineColor: TBGRAPixel;

   LineWidth: Single;

 

begin

     LineColor := BGRA(255, 0, 0, 250); // Red, fully opaque

     LineWidth := 2.0; // 2 pixels wide  

 

     // drawing a elliptical circle

     Bitmap.EllipseAntialias(x, y, 60, 60, LineColor, 2, BGRAWhite);  // 

 

     // Drawing a line on 2D projected coordinate

     Bitmap.DrawLineAntialias(50, 50, 200, 150, LineColor, LineWidth); 

 

     scene.Surface := Bitmap;

     scene.Render;

     scene.Surface := nil; 

end;

 

=============================================================

// Drawing connected multiple line segments

var Points: array of TPointF;

begin

   SetLength(Points, 3);

   Points[0] := PointF(100, 200);

   Points[1] := PointF(250, 100);

   Points[2] := PointF(300, 250);

   image.DrawPolyLineAntialias(Points, BGRA(0, 0, 255, 255), 3.0); // Blue polyline, 3 pixels wide

end;

 

Screenshot 2025-07-13 193758.png

 

No. Subject Author Date Views
Notice temp [1] me 2023.12.14 556
» Drawing a line on TBGRAVirtualScreen file me 2025.07.13 34
1 CVS's Drift XR from Protocol file me 2023.12.12 250