Difference between revisions of "GpiMove"

From EDM2
Jump to: navigation, search
m
 
Line 1: Line 1:
==Description==
+
This function moves the current position to the specified point.
This function moves the current position to the specified point.  
+
 
 
==Syntax==
 
==Syntax==
 
<PRE>
 
<PRE>
Line 11: Line 11:
  
 
rc = GpiMove(hps, pptlPoint);
 
rc = GpiMove(hps, pptlPoint);
 
 
 
</PRE>
 
</PRE>
  
 
==Parameters==
 
==Parameters==
; hps (HPS) - input : Presentation-space handle.  
+
;hps (HPS) - input: Presentation-space handle.
 
+
;pptlPoint (PPOINTL) - input: Position to which to move.
; pptlPoint (PPOINTL) - 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
+
::FALSE - Error occurred.
        Successful completion  
+
 
+
FALSE
+
        Error occurred.
+
  
 
===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)
+
:PMERR_PS_BUSY (0x20F4) An attempt was made to access the presentation space from more than one thread simultaneously.
        An invalid presentation-space handle was specified.  
+
:PMERR_INV_COORDINATE (0x205B) An invalid coordinate value 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==
 
==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 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.  
+
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==
 
==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.
 
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>
 
#define INCL_GPIPRIMITIVES      /* GPI primitive functions      */
 
#define INCL_GPIPRIMITIVES      /* GPI primitive functions      */
Line 62: Line 48:
 
GpiMove(hps, &ptl[2]);    /* move to (0,100) */
 
GpiMove(hps, &ptl[2]);    /* move to (0,100) */
 
GpiLine(hps, &ptl[3]);
 
GpiLine(hps, &ptl[3]);
 
 
</PRE>
 
</PRE>
  
 
==Graphic Elements and Orders==
 
==Graphic Elements and Orders==
 
+
:Element Type: OCODE_GSCP
Element Type: OCODE_GSCP
+
::Note that GpiSetCurrentPosition also generates this element type.
+
:Order: Set Current Position
    Note that GpiSetCurrentPosition also generates this element type.
+
+
    Order: Set Current Position
+
  
 
==Related Functions==
 
==Related Functions==

Latest revision as of 20:20, 30 July 2020

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