GpiPolygons
Appearance
This function draws a set of closed polygons.
Syntax
GpiPolygons(hps, ulCount, paplgn, flOptions, flModel)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- ulCount (ULONG) - input
- Number of polygons.
- Equal to the number of polygons in the polygons array. May be zero or positive, zero causes no output.
- paplgn (PPOLYGON) - input
- Array of polygons.
- An array of POLYGON structures.
- flOptions (ULONG) - input
- Drawing options.
- This contains fields of option bits. For each field, one value should be selected (unless the default is suitable). These values can be ORed together to determine whether to draw boundary lines as well as the area interior.
- Drawing boundary lines
- POLYGON_NOBOUNDARY
- Does not draw boundary lines.
- POLYGON_BOUNDARY
- Draws boundary lines (the default).
- Construction of the area interior
- POLYGON_ALTERNATE
- Constructs interior in alternate mode (the default).
- POLYGON_WINDING
- Constructs interior in winding mode.
- flModel (ULONG) - input
- Drawing model.
- POLYGON_INCL
- Fill is inclusive of bottom right (the default).
- POLYGON_EXCL
- Fill is exclusive of bottom right.
- This is provided to aid migration from other graphics models.
Return Value
- lHits (LONG) - returns
- Correlation/error indicator.
- GPI_OK
- Successful
- GPI_HITS
- Correlate hits.
- GPI_ERROR
- Error.
Remarks
The polygons are filled using the current AREABUNDLE structure values. For the first polygon, the current position is the first point. For all subsequent polygons all points which define the polygon are given explicitly. The polygons are automatically closed, if necessary, by drawing a line from the last vertex to the first. The polygons may overlap, but that is not necessary. GpiPolygons is not valid inside of an area.
Errors
Possible returns from WinGetLastError:
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_AREA_CONTROL (0x2041)
- An invalid options parameter was specified with GpiBeginArea.
- PMERR_INV_IN_PATH (0x208B)
- An attempt was made to issue a function invalid inside a path bracket.
- PMERR_ALREADY_IN_AREA (0x2001)
- An attempt was made to begin a new area while an existing area bracket was already open.
Graphic Elements and Orders
Element Type: OCODE_GPOLYS Order: Polygons
Example Code
#define INCL_GPIPOLYGON /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ ULONG ulCount; /* Number of polygons. */ PPOLYGON paplgn; /* Array of polygons. */ ULONG flOptions; /* Drawing options. */ ULONG flModel; /* Drawing model. */ LONG lHits; /* Correlation/error indicator. */ lHits = GpiPolygons(hps, ulCount, paplgn, flOptions, flModel);