Jump to content

GpiCloseFigure: Difference between revisions

From EDM2
Created page with "This function closes a figure within a path specification. ==Syntax== <PRE> #define INCL_GPIPATHS Or use INCL_GPI, INCL_PM,: #include <os2.h> HPS hps; /* Pr..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 2: Line 2:


==Syntax==
==Syntax==
<PRE>
GpiCloseFigure(hps)
#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>
==Parameters==
==Parameters==
; hps (HPS) - input : Presentation-space handle.
; hps (HPS) - input : Presentation-space handle.
Line 21: Line 14:
==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.


==Remarks==
==Remarks==
The current figure is closed by a line drawn to the start point of the figure.
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 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.
This function must not be used outside a path specification. In particular, it must not be used within an area.


==Graphic Elements and Orders==
==Graphic Elements and Orders==
'''Element Type: OCODE_GCFIG'''  
'''Element Type: OCODE_GCFIG'''
Order: Close Figure
Order: Close Figure


Line 56: Line 47:
==Related Functions==
==Related Functions==
Prerequisite Functions
Prerequisite Functions
* [[GpiBeginPath]]
*GpiBeginPath
Related Functions
Related Functions
* [[GpiEndPath]]
*GpiEndPath
* [[GpiModifyPath]]
*GpiModifyPath
* [[GpiStrokePath]]
*[[GpiStrokePath]]


[[Category:Gpi]]
[[Category:Gpi]]

Revision as of 01:15, 5 March 2017

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

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

  • GpiBeginPath

Related Functions