Jump to content

GpiStrokePath: Difference between revisions

From EDM2
Created page with "This function strokes a path, and then draws it. ==Syntax== <PRE> #define INCL_GPIPATHS Or use INCL_GPI, INCL_PM,: #include <os2.h> HPS hps; /* Presentation-sp..."
 
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:


==Syntax==
==Syntax==
<PRE>
GpiStrokePath (hps, lPath, flOptions)
#define INCL_GPIPATHS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>


HPS hps;          /* Presentation-space handle. */
LONG lPath;      /* Identifier of path to be stroked; it must be 1. */
ULONG flOptions;  /* Stroke option. */
LONG lHits;      /* Correlation and error indicators. */
lHits = GpiStrokePath(hps, lPath, flOptions);
</PRE>
==Parameters==
==Parameters==
; hps (HPS) - input : Presentation-space handle.
;hps (HPS) - input : Presentation-space handle.
 
;lPath (LONG) - input : Identifier of path to be stroked; it must be 1.
; lPath (LONG) - input : Identifier of path to be stroked; it must be 1.
;flOptions (ULONG) - input : Stroke option.
 
:Reserved; must be 0.
; flOptions (ULONG) - input : Stroke option.
 
Reserved; must be 0.


==Return Code==
==Return Code==
 
;lHits (LONG) - returns : Correlation and error indicators.
; lHits (LONG) - returns : Correlation and error indicators.
* GPI_OK Successful
* GPI_OK Successful
* GPI_HITS Correlate hits
* GPI_HITS Correlate hits
* GPI_ERROR Error.
* GPI_ERROR Error


==Errors==  
==Errors==  
Possible returns from WinGetLastError
Possible returns from WinGetLastError
; PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified.
; 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_PS_BUSY (0x20F4) : An attempt was made to access the presentation space from more than one thread simultaneously.
Line 39: Line 25:


==Remarks==
==Remarks==
The path is first converted to one that describes the envelope of a wide line stroked using the current geometric line-width attribute (see GpiSetLineWidthGeom).
The path is first converted to one that describes the envelope of a wide line stroked using the current geometric line-width attribute (see ''GpiSetLineWidthGeom'').


'''Note:''' This function and GpiModifyPath are the only calls that can cause geometric wide lines to be constructed. For more details about the way in which the envelope is constructed, see GpiModifyPath.
'''Note:''' This function and GpiModifyPath are the only calls that can cause geometric wide lines to be constructed. For more details about the way in which the envelope is constructed, see GpiModifyPath.
Line 52: Line 38:


==Graphic Elements and Orders==
==Graphic Elements and Orders==
'''Element Type: OCODE_GFPTH'''  
'''Element Type: OCODE_GFPTH'''
Note that GpiFillPath also generates this element type.
Note that GpiFillPath also generates this element type.
Order: Fill Path
Order: Fill Path


==Example Code==
==Example Code==
This example uses the GpiStrokePath function to draw a wide line.
This example uses the GpiStrokePath function to draw a wide line.
<PRE>
<PRE>
Line 76: Line 61:
GpiSetLineWidthGeom(hps, 20L);  /* set the line width */
GpiSetLineWidthGeom(hps, 20L);  /* set the line width */
GpiStrokePath(hps, 1L, 0L);      /* draw the wide line */
GpiStrokePath(hps, 1L, 0L);      /* draw the wide line */
</PRE>
</PRE>



Latest revision as of 19:32, 7 April 2025

This function strokes a path, and then draws it.

Syntax

GpiStrokePath (hps, lPath, flOptions)

Parameters

hps (HPS) - input
Presentation-space handle.
lPath (LONG) - input
Identifier of path to be stroked; it must be 1.
flOptions (ULONG) - input
Stroke option.
Reserved; must be 0.

Return Code

lHits (LONG) - returns
Correlation and error indicators.
  • GPI_OK Successful
  • GPI_HITS Correlate hits
  • GPI_ERROR Error

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_PATH_ID (0x20AE)
An invalid path identifier parameter was specified.
PMERR_INV_RESERVED_FIELD (0x20C1)
An invalid reserved field was specified.
PMERR_PATH_UNKNOWN (0x20EE)
An attempt was made to perform a path function on a path that did not exist.

Remarks

The path is first converted to one that describes the envelope of a wide line stroked using the current geometric line-width attribute (see GpiSetLineWidthGeom).

Note: This function and GpiModifyPath are the only calls that can cause geometric wide lines to be constructed. For more details about the way in which the envelope is constructed, see GpiModifyPath. The converted path is then filled, using winding mode area fill and the area attributes. The boundaries of the wide line are included in the fill.

When it has been drawn, the path is deleted.

This function is equivalent to GpiModifyPath, followed by GpiFillPath. It is provided to enable device drivers to optimize storage, if possible.

If the current drawing mode (see GpiSetDrawingMode) is draw or draw-and-retain, drawing occurs 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 GpiFillPath also generates this element type. Order: Fill Path

Example Code

This example uses the GpiStrokePath function to draw a wide line.

#define INCL_GPIPATHS
#include <OS2.H>

HPS hps;         /* Presentation space handle. */
POINTL ptlStart = { 0, 0 };
POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 };

/* create the path */

GpiBeginPath(hps, 1L);
GpiMove(hps, &ptlStart);
GpiPolyLine(hps, 3, ptlTriangle);
GpiEndPath(hps);

GpiSetLineWidthGeom(hps, 20L);   /* set the line width */
GpiStrokePath(hps, 1L, 0L);      /* draw the wide line */

Related Functions