Jump to content

GpiPolygons: Difference between revisions

From EDM2
Created page with "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 opti..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 5: Line 5:


==Parameters==
==Parameters==
; hps ([[HPS]]) - input
; hps ([[HPS]]) - input: Presentation-space handle.
: Presentation-space handle.
; ulCount ([[ULONG]]) - input: Number of polygons.
 
; 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.
: 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.
; paplgn ([[PPOLYGON]]) - input
: Array of polygons.
: An array of POLYGON structures.
: An array of POLYGON structures.
 
; flOptions (ULONG) - input: Drawing options.
; 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.
: 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:
:; Drawing boundary lines:
:;* POLYGON_NOBOUNDARY
:* POLYGON_NOBOUNDARY - Does not draw boundary lines.
:: Does not draw boundary lines.
:* POLYGON_BOUNDARY - Draws boundary lines (the default).
:;* POLYGON_BOUNDARY
:: Draws boundary lines (the default).
:; Construction of the area interior:
:; Construction of the area interior:
:;* POLYGON_ALTERNATE
:* POLYGON_ALTERNATE - Constructs interior in alternate mode (the default).
:: Constructs interior in alternate mode (the default).
:* POLYGON_WINDING - Constructs interior in winding mode.
:;* POLYGON_WINDING
; flModel ([[ULONG]]) - input: Drawing model.
:: Constructs interior in winding mode.
:: POLYGON_INCL - Fill is inclusive of bottom right (the default).
 
:: POLYGON_EXCL - Fill is exclusive of bottom right.
; 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.
: This is provided to aid migration from other graphics models.


==Return Value==
==Return Value==
; lHits ([[LONG]]) - returns
; lHits ([[LONG]]) - returns: Correlation/error indicator.
: Correlation/error indicator.
:: GPI_OK - Successful
:; GPI_OK
:: GPI_HITS - Correlate hits.
:: Successful
:: GPI_ERROR - Error.
:; GPI_HITS
:: Correlate hits.
:; GPI_ERROR
:: Error.


==Remarks==
==Remarks==
Line 55: Line 36:
==Errors==
==Errors==
Possible returns from WinGetLastError:
Possible returns from WinGetLastError:
; PMERR_INV_HPS (0x207F)
; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified.
: 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_PS_BUSY (0x20F4)
; PMERR_INV_AREA_CONTROL (0x2041): An invalid options parameter was specified with GpiBeginArea.
: An attempt was made to access the presentation space from more than one thread simultaneously.
; PMERR_INV_IN_PATH (0x208B): An attempt was made to issue a function invalid inside a path bracket.
; PMERR_INV_AREA_CONTROL (0x2041)
; PMERR_ALREADY_IN_AREA (0x2001): An attempt was made to begin a new area while an existing area bracket was already open.
: 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==
==Graphic Elements and Orders==
Line 73: Line 49:
<PRE>
<PRE>
#define INCL_GPIPOLYGON /* Or use INCL_GPI, INCL_PM, */
#define INCL_GPIPOLYGON /* Or use INCL_GPI, INCL_PM, */
#include &lt;os2.h&gt;
#include <os2.h>


HPS    hps;      /* Presentation-space handle. */
HPS    hps;      /* Presentation-space handle. */

Latest revision as of 00:50, 17 November 2025

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);

Related Functions