Sign in Join
FPDoc Onlineexperiment

TCanvas.Polygon procedure

Member of TCanvaspublicIn unit Graphics

Draws a closed, many-sided shape using the Pen for the canvas.

Declaration

pascal
procedure Polygon(const Points: Array of TPoint; Winding: Boolean; 
 StartIndex: Integer=0; NumPts: Integer=- 1)
procedure Polygon(Points: PPoint; NumPts: Integer; 
 Winding: Boolean=False); virtual
procedure Polygon(const Points: Array of TPoint); reintroduce

Description

Use Polygon to draw a closed, many-sided shape on the canvas, using the Pen for the canvas. After drawing the complete shape, Polygon fills the shape using the canvas Brush.

The Points parameter is an array of points that give the vertices of the polygon.

Winding determines how the polygon is filled. When Winding is True, Polygon fills the shape using the Winding fill algorithm.

When Winding is False, Polygon uses the even-odd (alternative) fill algorithm.

StartIndex gives the index of the first point in the array to use. All points before this are ignored.

NumPts indicates the number of points to use, starting at StartIndex.

If NumPts is -1 (the default), Polygon uses all points from StartIndex to the end of the array. The first point is always connected to the last point.

To draw a polygon on the canvas without filling the internal area, use the Polyline method specifying the first point a second time at the end of the line.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.