Jump to content

GpiLine

From EDM2

This function draws a straight line from the current position to the specified end point.

Syntax

GpiLine(hps, pptlEndPoint)

Parameters

hps (HPS) - input
Presentation-space handle.
pptlEndPoint (PPOINTL) - input
End point of the line.

Return Value

lHits (LONG) - returns
Correlation and error indicators.
GPI_OK
Successful
GPI_HITS
Correlate hits
GPI_ERROR
Error.

Remarks

The current position is set to the end point of the line. The line is drawn using the current values of the line color, line mix, line width, and line type attributes.

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.
PMERR_INV_NESTED_FIGURES (0x20A8)
Nested figures have been detected within a path definition.

Graphic Elements and Orders

Element Type: OCODE_GCLINE Note that GpiPolyLine also generates this element type. Order: Line at 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 pptlEndPoint; /* End point of the line. */
LONG    lHits;        /* Correlation and error indicators. */

lHits = GpiLine(hps, pptlEndPoint);

This example uses GpiLine to draw an X.

#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]);
GpiLine(hps, &ptl[1]);
GpiMove(hps, &ptl[2]);
GpiLine(hps, &ptl[3]);

Related Functions