GpiCloseFigure: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 29: | Line 29: | ||
==Example Code== | ==Example Code== | ||
<PRE> | |||
#define INCL_GPIPATHS /* Or use INCL_GPI, INCL_PM, */ | |||
#include <os2.h> | |||
HPS hps; /* Presentation-space handle. */ | |||
BOOL rc; /* Success indicator. */ | |||
rc = GpiCloseFigure(hps); | |||
</PRE> | |||
This example uses the GpiCloseFigure function to close a triangle drawn in a path bracket. The triangle starts at (0,0), and as the current position just before the GpiCloseFigure is (200,0), the function closes the triangle by drawing a line from (200,0) to (0,0). | This example uses the GpiCloseFigure function to close a triangle drawn in a path bracket. The triangle starts at (0,0), and as the current position just before the GpiCloseFigure is (200,0), the function closes the triangle by drawing a line from (200,0) to (0,0). | ||
<PRE> | <PRE> |
Latest revision as of 23:33, 23 April 2025
This function closes a figure within a path specification.
Syntax
GpiCloseFigure(hps)
Parameters
- hps (HPS) - input
- Presentation-space handle.
Return Code
- rc (BOOL) - returns
- Success indicator.
- TRUE Successful completion
- FALSE Error occurred.
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.
Remarks
The current figure is closed by a line drawn to the start point of the figure.
This function need not be used if the path is to be filled (see GpiFillPath), or used as a clip path (see GpiSetClipPath), as any figures in the path that have not been closed are automatically closed at that time. It should be used, however, for any closed figures within paths that are subsequently to be stroked by GpiModifyPath or GpiStrokePath.
This function must not be used outside a path specification. In particular, it must not be used within an area.
Graphic Elements and Orders
Element Type: OCODE_GCFIG Order: Close Figure
Example Code
#define INCL_GPIPATHS /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ BOOL rc; /* Success indicator. */ rc = GpiCloseFigure(hps);
This example uses the GpiCloseFigure function to close a triangle drawn in a path bracket. The triangle starts at (0,0), and as the current position just before the GpiCloseFigure is (200,0), the function closes the triangle by drawing a line from (200,0) to (0,0).
#define INCL_GPIPATHS /* GPI Path functions */ #include <os2.h> HPS hps; /* presentation space handle */ POINTL ptlStart = { 0, 0 }; POINTL ptlPoints[] = { 100, 100, 200, 0 }; GpiBeginPath(hps, 1L); /* start the path bracket */ GpiMove(hps, &ptlStart); /* move to starting point */ GpiPolyLine(hps, 2L, ptlPoints); /* draw two sides */ GpiCloseFigure(hps); /* close the triangle */ GpiEndPath(hps); /* end the path bracket */
Related Functions
Prerequisite Functions
Related Functions