GpiFillPath: Difference between revisions
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..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function draws the interior of a path using the area attributes. | This function draws the interior of a path using the area attributes. | ||
==Syntax== | ==Syntax== | ||
GpiFillPath(hps, lPath, lOptions) | GpiFillPath(hps, lPath, lOptions) | ||
==Parameters== | ==Parameters== | ||
;hps (HPS) - input | ;hps ([[HPS]]) - input:Presentation-space handle. | ||
:Presentation-space handle. | ;lPath (LONG) - input:Identifier of path whose interior is to be drawn; it must be 1. | ||
;lOptions (LONG) - input:Fill option. | |||
;lPath (LONG) - input | :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. | ||
:Identifier of path whose interior is to be drawn; it must be 1. | :Fill path mode: | ||
:*FPATH_ALTERNATE Fills the path using the alternate rule; see [[GpiBeginArea]] (the default). | |||
;lOptions (LONG) - input | :*FPATH_WINDING Fills the path using the winding rule; see GpiBeginArea. This value must be selected if the path has been modified using [[GpiModifyPath]]. | ||
:Fill option. | :Draw boundary lines: | ||
:*FPATH_INCL Includes all boundaries in fill path (the default). | |||
: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. | :*FPATH_EXCL Excludes bottom and right boundaries from the fill path. | ||
: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== | ==Returns== | ||
;lHits (LONG) - returns | ;lHits (LONG) - returns:Error indicator. | ||
:Error indicator. | :*GPI_OK Successful | ||
:*GPI_HITS Correlate hits | |||
:*GPI_OK Successful | :*GPI_ERROR Error. | ||
:*GPI_HITS Correlate hits | :Possible returns from WinGetLastError: | ||
:*GPI_ERROR Error. | :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. | |||
:Possible returns from WinGetLastError | :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. | ||
: | |||
: | |||
: | |||
: | |||
==Example Source Code== | ==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. | 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. | ||
<PRE> | <PRE> | ||
#define INCL_GPIPATHS /* GPI Path functions */ | #define INCL_GPIPATHS /* GPI Path functions */ | ||
Line 81: | Line 45: | ||
GpiFillPath(hps, 1L, FPATH_ALTERNATE); /* fill the path */ | GpiFillPath(hps, 1L, FPATH_ALTERNATE); /* fill the path */ | ||
</PRE> | </PRE> | ||
==Remarks== | ==Remarks== | ||
Any open figures within the path are closed. | Any open figures within the path are closed. | ||
The path is deleted when the interior has been drawn. | 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. | 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. | 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== | ==Graphic Elements and Orders== | ||
Element Type: '''OCODE_GFPTH''' | Element Type: '''OCODE_GFPTH''' | ||
Note that GpiStrokePath also generates this element type. | Note that [[GpiStrokePath]] also generates this element type. | ||
Order: Fill Path | Order: Fill Path | ||
[[Category: | [[Category:Gpi]] |
Latest revision as of 05:17, 21 February 2020
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.
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