XPRINT POLYGON statement

Purpose | Draw a polygon on a host printer page.
Syntax | XPRINT POLYGON points [, [rgbColor&] [, [fillcolor&] [, [fillstyle&] [, fillmode&]]]]
Remarks | The coordinate points are specified in pixels, unless optional world coordinates have been defined with an XPRINT SCALE statement. Line width can be set using XPRINT WIDTH. If line width is set to 1 (the default), the line style can be set with XPRINT STYLE. XPRINT POLYGON neither uses, nor updates, the last point referenced (POS). If executed without a host printer attached, error 57 is generated.

points

User-defined type that defines the number of vertices and the location of each. There must be at least two, and no more than 1024 vertices. The first member is a long integer point count, followed directly by the appropriate number of single precision floats to specify the actual coordinates. Floating point coordinates are required, because of the possibility of their use as world coordinates with XPRINT SCALE. You can use a type with a scalar list, like this:

TYPE PolyPoints

count as long

x1 as single

y1 as single

x2 as single

y2 as single

x3 as single

y3 as single

END TYPE

Or, you can create an array using point types, like this:

TYPE PolyPoint

x as single

y as single

END TYPE

TYPE PolyArray

count as long

xy(1 TO 3) as PolyPoint

END TYPE

rgbColor& | Optional RGB color of the polygon edge. If omitted (or -1), the edge color defaults to the current foreground color for the host printer page.
fillcolor& | Optional RGB color of the polygon interior. If fillcolor& is omitted (or -2), the interior of the ellipse is not filled, allowing the background to show through. If fillcolor& is -1, the interior is painted with the same color as the edge. Otherwise, fillcolor& specifies the RGB color to be used.

fillstyle&

Optional fill style (pattern) to be used. If fillstyle& is omitted, the default fill style is solid (0). If a hatch pattern is chosen (1 to 6), the foreground color is specified by the fillcolor&, while the background is specified by the default background color for the host printer page. The optional fillstyle& may be:

0 | Solid (default)
1 | Horizontal Lines
2 | Vertical Lines
3 | Upward Diagonal Lines
4 | Downward Diagonal Lines
5 | Crossed Lines
6 | Diagonal Crossed Lines

fillmode& | If fillmode& is missing (or zero), the winding mode is selected. This fills any region with a non-zero winding value. If fillmode& is non-zero, the alternate mode is selected. This fills the area between odd-numbered and even-numbered polygon sides on each scan line. That is, it fills the area between the first side and the second side, between the third side and fourth side, etc.
See also | Built In RGB Color Equates, XPRINT ARC, XPRINT ATTACH, XPRINT BOX, XPRINT COLOR, XPRINT ELLIPSE, XPRINT LINE, XPRINT POLYLINE