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.
GpiPolySpline (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPIPRIMITIVES
 
LONG GpiPolySpline(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 GpiPolySpline function creates one or more Bezier splines. The function
draws the Bezier splines by using the points specified by the aptl
parameter. The function needs at least three points to draw a spline. If
exactly three points are specified, the function draws the spline from the
current position to the third point, by using the first and second points as
control points. For each additional spline, the function needs exactly three
more points, and uses the end point of the last spline as the next starting
point. The function draws each fillet by using the current line-color,
line-mix, line-width, and line-type attributes.
 
For each Bezier spline, the array pointed to by aptl contains two control
points and an end point. The first triplet of points are the control and end
points for the first spline, with the control points given first.
 
The GpiPolySpline function moves the current position to the last specified
point.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies a presentation space.
 
cptl       Specifies the number of points in the array pointed to by aptl.
           This must be three times the number of splines since each spline
           requires two control points and an end point.
 
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
 
Comments
 
A Bezier spline is a smooth curve whose path is controlled by four points: a
start point, an end point, and two control points.
 
As the GpiPolySpline function draws a spline, all points contribute to the
direction of the path, with one point having the greatest amount of control.
The point with the greatest control tends to pull the path toward it.
Greatest control moves from the start point, to the first control point, to
the second control point, and finally to the end point as the path
progresses.
 
If the function draws more than one spline, it does not automatically ensure
continuity of the curve at the end points. If an application wants a smooth
transition from one curve to the next, it must supply the appropriate end
and control points.
 
Example
 
This example uses the GpiPolySpline function to draw a curve. The curve is
drawn within a skewed rectangle, with the bottom corners being the start and
end points and the top corners being the control points.
 
POINTL ptlStart = { 0, 0 };
POINTL aptl[3] = { 0, 100, 200, 150, 200, 50 };
 
GpiMove(hps, &ptlStart);         /* moves to start point       */
GpiPolySpline(hps,               /* presentation-space handle  */
    3L,                          /* 3 points in the array      */
    aptl);                       /* address of array of points */
 
See Also
 
GpiMove, GpiSetAttrs, GpiSetColor, GpiSetCurrentPosition, GpiSetLineType,
POINTL