Jump to content

GpiMove: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
No edit summary
 
Line 2: Line 2:


==Syntax==
==Syntax==
<PRE>
  GpiMove(hps, pptlPoint)
#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);
</PRE>


==Parameters==
==Parameters==
;hps (HPS) - input: Presentation-space handle.
;hps ([[HPS]]) - input: Presentation-space handle.
;pptlPoint (PPOINTL) - input: Position to which to move.
;pptlPoint (P[[POINTL]]) - input: Position to which to move.
:This position is in world coordinates.
:This position is in world coordinates.


==Return Code==
==Return Code==
;rc (BOOL) - returns : Success indicator.
;rc ([[BOOL]]) - returns : Success indicator.
::TRUE - Successful completion
::TRUE - Successful completion
::FALSE - Error occurred.
::FALSE - Error occurred.
Line 25: Line 16:
===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.
:PMERR_INV_COORDINATE (0x205B) An invalid coordinate value was specified.
;PMERR_INV_COORDINATE (0x205B) :An invalid coordinate value was specified.


==Remarks==
==Remarks==
Line 33: Line 24:


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.
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.
==Graphic Elements and Orders==
:Element Type: OCODE_GSCP
::Note that GpiSetCurrentPosition also generates this element type.
:Order: Set Current Position


==Example Code==
==Example Code==
<PRE>
#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);
</PRE>
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.
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.
<PRE>
<PRE>
Line 49: Line 56:
GpiLine(hps, &ptl[3]);
GpiLine(hps, &ptl[3]);
</PRE>
</PRE>
==Graphic Elements and Orders==
:Element Type: OCODE_GSCP
::Note that GpiSetCurrentPosition also generates this element type.
:Order: Set Current Position


==Related Functions==
==Related Functions==

Latest revision as of 23:49, 7 April 2025

This function moves the current position to the specified point.

Syntax

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.

Graphic Elements and Orders

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

Example Code

#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);

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]);

Related Functions