GpiLine: Difference between revisions
Appearance
Created page with "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 p..." |
mNo edit summary |
||
| Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
; hps ([[HPS]]) - input | ; hps ([[HPS]]) - input: Presentation-space handle. | ||
: Presentation-space handle. | ; pptlEndPoint ([[PPOINTL]]) - input: End point of the line. | ||
; pptlEndPoint ([[PPOINTL]]) - input | |||
: End point of the line. | |||
==Return Value== | ==Return Value== | ||
; lHits ([[LONG]]) - returns | ; lHits ([[LONG]]) - returns: Correlation and error indicators. | ||
: Correlation and error indicators. | ::GPI_OK - Successful | ||
: | ::GPI_HITS - Correlate hits | ||
:: | ::GPI_ERROR - Error. | ||
: | |||
==Remarks== | ==Remarks== | ||
| Line 27: | Line 20: | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError: | Possible returns from WinGetLastError: | ||
; PMERR_INV_HPS (0x207F) | ; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified. | ||
: 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) | ; PMERR_INV_COORDINATE (0x205B): An invalid coordinate value was specified. | ||
: An attempt was made to access the presentation space from more than one thread simultaneously. | ; PMERR_INV_NESTED_FIGURES (0x20A8): Nested figures have been detected within a path definition. | ||
; 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== | ==Graphic Elements and Orders== | ||
| Line 42: | Line 31: | ||
==Example Code== | ==Example Code== | ||
This example uses GpiLine to draw an X. | This example uses GpiLine to draw an X. | ||
<pre> | <pre> | ||
#define INCL_GPIPRIMITIVES /* GPI primitive functions */ | #define INCL_GPIPRIMITIVES /* GPI primitive functions */ | ||
#include | #include <os2.h> | ||
HPS hps; /* presentation space handle */ | HPS hps; /* presentation space handle */ | ||
Latest revision as of 01:20, 17 November 2025
This function draws a straight line from the current position to the specified end point.
Syntax
GpiLine(hps, pptlEndPoint)
Parameters
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
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]);