gpi12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GpiPolyLine (1.2)
Function Group  Overview  Changes               Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPIPRIMITIVES
 
LONG GpiPolyLine(hps, cptl, aptl)
HPS hps;         /* presentation-space handle                 */
LONG cptl;       /* number of points in array                 */
PPOINTL aptl;    /* address of array of structures for points */
 
The GpiPolyLine function draws one or more straight lines. The function
draws the lines by using the points specified by the aptl parameter. The
function needs at least one point to draw a line. If a point is specified,
the function draws the line from the current position to the point. For each
additional line, the function needs exactly one more point, and uses the end
point of the last line as the starting point for the next. The function
draws the lines by using the current values of the line-color, line-mix,
line-width, and line-type attributes.
 
The GpiPolyLine function moves the current position to the end point of the
last line.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies a presentation space.
 
cptl       Specifies the number of points. This parameter must be greater
           than or equal to zero.
 
aptl       Points to an array of POINTL structures that contains the
           points.
 
Return Value
 
The return value is GPI_OK or GPI_HITS if the function is successful (it is
GPI_HITS if the detectable attribute is set for the presentation space and a
correlation hit occurs). The return value is GPI_ERROR if an error occurs.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_COORDINATE
     PMERR_INV_HPS
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_PS_BUSY
 
Example
 
This example uses the GpiPolyLine function to draw a triangle.
 
POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 };
 
GpiMove(hps, &ptlTriangle[2]);          /* moves to end point (0, 0) */
GpiPolyLine(hps, 3L, &ptlTriangle[1]);  /* draws triangle            */
 
See Also
 
GpiLine, GpiMove, GpiSetAttrs, GpiSetColor, GpiSetCurrentPosition,
GpiSetLineType, POINTL