Jump to content

GpiCloseFigure

From EDM2
Revision as of 12:49, 5 March 2020 by Ak120 (talk | contribs)

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

Related Functions