# POLYGON

> [HTML Version](polygon_pd.htm)

_Revised December 2017_

**//POLYGON, mode, brush, x1, y1, x2, y2, \{...X10, Y10\}**

POLYGON draws a polygon based on up to 10 points. Straight lines are drawn between the points using the current pen, including a line from the last point back to the first. The points are specified in the current map mode.

**Parameters**

_mode_ specifies the polygon fill mode:

| **Symbol** | **Value** | **Description** |
|------|------|------|
|  | 0 | Use existing mode (whatever was last set) |
| Alternate | 1 | Fills in the area between odd and even sides |
| Winding | 2 | Fills in any area with a non-zero "winding value". |


The difference between the modes is not significant for simple enclosed polygons, but becomes apparent with polygons whose sides cross over themselves. An illustrative example would be a five-pointed star, whose lines intersect to create a pentagon in the middle. The _alternate_ fill mode would fill in the points, whereas the _winding_ fill mode would fill in the entire region.

The _winding_ value is defined as the number of times a pen used to draw the polygon would go around the region.

_brush_ selects a value for _fill_ from the table below. See the topic [Parameters: Symbols vs. Values](parameterssymbolsvs_values.md) if you have questions about which to use.

| **Symbol** | **Value** | **Description** | **Comment** |
|------|------|------|------|
| WHITE\_BRUSH | 0 | White | Overrides color set by SETBRUSH |
| LTGRAY\_BRUSH | 1 | Light gray | Or color set by SETBRUSH |
| GRAY\_BRUSH | 2 | Gray | Or color set by SETBRUSH |
| DKGRAY\_BRUSH | 3 | Dark gray | Or color set by SETBRUSH |
| BLACK\_BRUSH | 4 | Black | Overrides color set bySETBRUSH |
| NULL\_BRUSH | 5 | Hollow (default) | Overrides color set by SETBRUSH |




**History**

2011 January, A-Shell 6.0.1203:  Added to A-Shell