Please enable JavaScript to view this site.

ESL Documentation

The polygon statement draws a convex polygon (any closed figure bounded by straight lines). You define the polygon's size and shape by specifying relative X Y offset positions (in the coordinate system of the object in which the polygon is being drawn). This is like drawing a series of lines with the draw statement, with two important differences: all polygons are solid (filled), and ESL always creates a closed figure from the sets of coordinates specified.

 

Consider the following example, which draws a triangle:

 

key KeyA at position 250 100

    polygon 10 10, 10 -10, -20 0

 

The polygon in KeyA draws a line 10 coordinates to the right of and 10 coordinates up from the current position of the graphics cursor, which is at position 0 0 in KeyA. Then ESL draws a line 10 coordinates to the right of and 10 coordinates down from the new position. Finally, ESL draws a line 20 coordinates to the left of

and 0 coordinates up or down from the last new position. Since this creates a closed shape, ESL needs to do nothing more except fill the polygon with the color specified or the default color, if none is specified.

 

If the polygon is defined as follows:

 

key KeyA at position 250 100

    polygon 10 10, 10 -10

 

the exact same figure is drawn, because ESL automatically closes the figure, drawing a line from the last specified position back to the origin.

 

Wherever possible, use the polygon statement instead of the shape

statement, for faster printing and screen drawing.