4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5

New to Analytica 5.0

CanvasDrawPolygon( canvas, x, y, I, lineColor, fillColor, lineWidth, dash, alternate, swapXY )

Draws a closed polygon on a canvas. The last point is connected to the first point.

  • «canvas» is a canvas obtained from calling the Canvas() function, or a canvas context obtained by calling the CanvasContext() function.
  • «x», «y»: Arrays both indexed by «I» containing the vertices of the polygon.
  • «I»: An index that dimensions «x» and «y». This can be omitted when «x» and «y» have only one index in common (such as when one is an index).
  • «lineColor», «fillColor»: (Optional) The color for the edge and fill respectively, each is either a textual color name or a color integer. See Color parameters for an enumeration of textual color names and a description of color integers. «LineColor» defaults to 'Black'.
  • «lineWidth»: (Optional) The width of the border line. Defaults to 1.0.
  • «dash»; The dither style of the border line, one of: 'Solid', 'Dash', 'Dot', 'DashDot', 'DashDotDot'.
  • «alternate»: (Optional). When set to true and the polygon has overlapping edges, fills every other enclosed region within the polygon, alternating which areas are filled or not. When False (default), fills all areas that were fully encircled by the polygon's path at least once.
  • «swapXY»: (Optional) Swaps the «x» and «y» parameters.

When «fillColor» and «alternate» is omitted, the border is drawn and the polygon is not filled. When «fillColor» or «alternate» is specified but none of the line-relevant parameters is specified (i.e., «lineColor», «lineWidth» or «dash»), the polygon is filled and no border is drawn. When «fillColor» and at least one line-relevant parameter is specified, the rectangle is drawn filled with a border line.

(New to Analytica 6.0) If «x» or «y» is Null, it starts a new distinct polygon.


Local c := Canvas( 32,32 );
CanvasDrawPolygon( c, Array(I4,[1,13,25,16]), Array(I4,[6,1,5,11]), I4, fillColor:0x408080 );
CanvasDrawPolygon( c, Array(I4,[17,26,25,17]), Array(I4, [12,6,18,27]), fillColor:0xb40015);
CanvasDrawPolygon( c, Array(I4,[15,3,2,15]), Array(I4, [26,21,6,10]), lineColor:0x60b2b9ba);
CanvasPolygon cubeExample.png

See also


You are not allowed to post comments.