GpiMove

From EDM2
Revision as of 20:20, 30 July 2020 by Ak120 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This function moves the current position to the specified point.

Syntax

#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, Also in COMMON section */
#include <os2.h>

HPS        hps;        /*  Presentation-space handle. */
PPOINTL    pptlPoint;  /*  Position to which to move. */
BOOL       rc;         /*  Success indicator. */

rc = GpiMove(hps, pptlPoint);

Parameters

hps (HPS) - input
Presentation-space handle.
pptlPoint (PPOINTL) - input
Position to which to move.
This position is in world coordinates.

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.
PMERR_INV_COORDINATE (0x205B) An invalid coordinate value was specified.

Remarks

This function also has the effect of resetting position within a line-type sequence, and, if within an area, of starting a new closed figure and causing any previous one to be closed automatically if necessary.

This function is equivalent to the GpiSetCurrentPosition call, except that, if the current attribute mode is AM_PRESERVE (see GpiSetAttrMode), the current position is not saved before being set to a new value by the GpiMove function, and hence cannot be restored using the GpiPop call.

Example Code

This example uses the GpiMove function to draw an X. The function moves the current position to the starting point of each leg of the character.

#define INCL_GPIPRIMITIVES      /* GPI primitive functions      */
#include <os2.h>

HPS hps;                /* presentation space handle            */
/* point array */
POINTL ptl[4] = { 0, 0, 100, 100, 0, 100, 100, 0 };

GpiMove(hps, &ptl[0]);    /* move to (0,0)   */
GpiLine(hps, &ptl[1]);
GpiMove(hps, &ptl[2]);    /* move to (0,100) */
GpiLine(hps, &ptl[3]);

Graphic Elements and Orders

Element Type: OCODE_GSCP
Note that GpiSetCurrentPosition also generates this element type.
Order: Set Current Position

Related Functions