PaintStarN procedure
Draws a star-shaped polygon on a canvas using the specified number of points and rotation.
Declaration
procedure PaintStarN(Canvas: TCanvas; cx: Integer; cy: Integer;
r: Integer; n: Integer; a: Extended)Arguments
Canvas | TCanvas instance where the shape is drawn. |
cx | Horizontal canvas coordinate for the center point in the shape. |
cy | Vertical canvas coordinate for the center point in the shape. |
r | Radius for the points on the star shape. |
n | Number of points for the star-shaped polygon. |
a | Angle of rotation for the shape in radians. |
Description
PaintStarN is a routine used to draw a star-shaped polygon with a
given number of points or arms. Each point is spaced equally along the
circumference of a circle with the specified radius.
Canvas is the
TCanvas instance where the drawing
operation is performed. The Polygon method in Canvas is used to draw the
shape using an array of TPoint instances calculated in the method.
cx and
cy contain the canvas coordinates where the
center point for the star-shaped polygon is located.
r contains the radius for the circle where the point vertices for
the shape are drawn. It is the distance from the center point to the vertex
of any given point.
n contains the number of points or arms drawn on the star-shaped
polygon. The angular span (or turn angle) between the point vertices is 360/n.
a contains the angle of rotation for the polygon expressed in
radians. Negative values rotate the shape in a clockwise direction. Positive
values rotate the shape in a counter-clockwise direction. Use DegToRad (in
the RTL
math.pp unit) or
<angle>*pi/180 to convert
an angle in degrees to radians.
Set the Brush color in Canvas used to fill the polygon prior to calling the routine.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
