Jump to content

GpiPolyLine: Difference between revisions

From EDM2
Created page with "This function draws a series of straight lines starting at the current position and connecting the points specified. ==Syntax== GpiPolyLine(hps, lCount, aptlPoints) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lCount (LONG) - input : Number of points. : Must not be negative. Zero is valid but causes no output. ; aptlPoints (PPOINTL) - input : Array of points. ==Return Value== ; lHits (LONG) - returns : Correlation and error indi..."
 
 
Line 43: Line 43:


==Graphic Elements and Orders==
==Graphic Elements and Orders==
Element Type: OCODE_GCLINE
;Element Type: OCODE_GCLINE
Note that [[GpiLine]] also generates this element type.
Note that [[GpiLine]] also generates this element type.
Order: Line at Current Position
Order: Line at Current Position
As many of these orders are generated as is necessary to hold the specified points.
As many of these orders are generated as is necessary to hold the specified points.



Latest revision as of 20:42, 6 April 2025

This function draws a series of straight lines starting at the current position and connecting the points specified.

Syntax

GpiPolyLine(hps, lCount, aptlPoints)

Parameters

hps (HPS) - input
Presentation-space handle.
lCount (LONG) - input
Number of points.
Must not be negative. Zero is valid but causes no output.
aptlPoints (PPOINTL) - input
Array of points.

Return Value

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

Remarks

On completion, current position is set to the last point. The maximum number of lines allowed in a polyline is device dependent, but is always greater than 3 500 for GPIF_LONG format spaces and always greater than 7 200 for GPIF_SHORT format spaces (see the PS_FORMAT of GpiCreatePS for the meaning of this format).

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_LENGTH_OR_COUNT (0x2092)
An invalid length or count parameter was specified.
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 GpiLine also generates this element type.

Order: Line at Current Position

As many of these orders are generated as is necessary to hold the specified points.

Example Code

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

HPS     hps;          /* Presentation-space handle. */
LONG    lCount;       /* Number of points. */
PPOINTL aptlPoints;   /* Array of points. */
LONG    lHits;        /* Correlation and error indicators. */

lHits = GpiPolyLine(hps, lCount, aptlPoints);

This example uses the GpiPolyLine function to draw a triangle.

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

HPS hps; /* presentation space handle*/
POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 }; /* vertices */

GpiMove(hps, &ptlTriangle[2]); /* moves to end point (0, 0)*/
GpiPolyLine(hps, 3L, ptlTriangle); /* draws triangle */

Related Functions