Area brackets have the flexibility to draw any combination of curved or straight lines and combine the results into a closed figure. An advantage that polygons sometimes have over area brackets, however, is that they require fewer time-consuming calculations to provide that kind of flexibility.
The operating system provides a function that enables you to draw multiple straight-line closed areas outside of an area bracket. Like bracket-generated areas, they can be adjacent, intersecting, or completely separate.
The function is GpiPolygons and the set of objects it draws are called polygon primitives. A polygon primitive is any set of polygons with specified vertices that can be filled or filled and outlined. This function accepts as input the desired number of polygons, the POLYGON data structure for each polygon, and a boundary and construction option similar to those of the GpiBeginArea function.
The purpose of GpiPolygons is to enable you to specify an area in such a way as to pass all of the area boundaries at once. This improves performance significantly because the operating system cannot process the accumulated primitives inside an area bracket until it reaches a GpiEndArea. GpiPolygons is not valid inside an area bracket because the figures it defines are areas already.
Although GpiPolygons is limited to straight line figures, it retains a great deal of flexibility. The polygon data structure (POLYGON) contains the number of vertices, and the vertices themselves are in world coordinates. The collection of POLYGON structures accepted in a single GpiPolygons is not limited to one type of polygon.
The drawing of the first polygon begins at the current position. For all subsequent polygons, all vertices must be explicitly defined. If the individual polygons are not completely defined, they are closed with a straight line drawn from the last defined vertex to the first.
After the application has defined the polygons, they may be transformed and manipulated just as other primitives are.