Jump to content

GpiFillPath

From EDM2
Revision as of 04:54, 21 February 2020 by Martini (talk | contribs) (Created page with "This function draws the interior of a path using the area attributes. ==Syntax== GpiFillPath(hps, lPath, lOptions); ==Parameters== ;hps (HPS) - input :Presentation-space h...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function draws the interior of a path using the area attributes.

Syntax

GpiFillPath(hps, lPath, lOptions);

Parameters

hps (HPS) - input
Presentation-space handle.
lPath (LONG) - input
Identifier of path whose interior is to be drawn; it must be 1.
lOptions (LONG) - input
Fill option.
One value should be selected for each option (unless the default is suitable). These values can be ORed together to determine fill path mode and boundaries.
Fill path mode:
  • FPATH_ALTERNATE Fills the path using the alternate rule; see GpiBeginArea (the default).
  • FPATH_WINDING Fills the path using the winding rule; see GpiBeginArea. This value must be selected if the path has been modified using GpiModifyPath.
Draw boundary lines:
  • FPATH_INCL Includes all boundaries in fill path (the default).
  • FPATH_EXCL Excludes bottom and right boundaries from the fill path.


Returns

lHits (LONG) - returns
Error indicator.
  • GPI_OK Successful
  • GPI_HITS Correlate hits
  • GPI_ERROR Error.
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_PATH_ID (0x20AE)
An invalid path identifier parameter was specified.
PMERR_INV_FILL_PATH_OPTIONS (0x2070)
An invalid options parameter was specified with GpiFillPath.
PMERR_PATH_UNKNOWN (0x20EE)
An attempt was made to perform a path function on a path that did not exist.

Calling Sequence

#define INCL_GPIPATHS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS     hps;       /*  Presentation-space handle. */
LONG    lPath;     /*  Identifier of path whose interior is to be drawn; it must be 1. */
LONG    lOptions;  /*  Fill option. */
LONG    lHits;     /*  Error indicator. */

lHits = GpiFillPath(hps, lPath, lOptions);

Example Source Code

This example uses the GpiFillPath function to draw the interior of the given path. The path, an isosceles triangle, is not closed when it is created, so the GpiFillPath function closes it before filling.

#define INCL_GPIPATHS           /* GPI Path functions           */
#include <os2.h>

HPS hps;                /* presentation space handle            */
POINTL ptlStart = { 0, 0 }; /* first vertex                     */
POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 }; /* vertices  */

GpiBeginPath(hps, 1L);                  /* create a path */
GpiMove(hps, &ptlStart);
GpiPolyLine(hps, 3L, ptlTriangle);
GpiEndPath(hps);

GpiFillPath(hps, 1L, FPATH_ALTERNATE);  /* fill the path */


Remarks

Any open figures within the path are closed.

The path is deleted when the interior has been drawn.

The boundaries of the area, as defined by the path, are considered to be part of the interior and are included in the fill.

If the current drawing mode (see GpiSetDrawingMode) is draw or draw-and-retain, the interior is drawn on the currently associated device. If the drawing mode is retain, this function is stored in the current segment, and output occurs when the segment is subsequently drawn in the usual way.

Graphic Elements and Orders

Element Type: OCODE_GFPTH

Note that GpiStrokePath also generates this element type.

Order: Fill Path