PolyDraw

  BOOL PolyDraw(hdc, lpPoints, lpTypes, nCount)    
  HDC hdc; /* handle of a device context */
  LPPOINT lpPoints; /* address of array of points */
  LPBYTE lpTypes; /* address of line and curve identifiers */
  int nCount; /* count of points */

The PolyDraw function draws a set of line segments and Bezier curves.

Parameters

hdc

Identifies a device context.

lpPoints

Points to an array of POINT structures containing the endpoints for each line segment and the endpoints and control points for each Bezier curve. The POINT structure has the following form:

typedef struct tagPOINT { /* pt */

LONG x;

LONG y;

} POINT;

lpTypes

Points to an array of BYTEs, each of which specifies the type of the corresponding point in the lpPoints array. Values may be one of the following:

Type Meaning

PT_MOVETO  
  Specifies that this point starts a disjoint figure. This point becomes the new current position.
PT_LINETO  
  Specifies that a line is to be drawn from the current position to this point, which then becomes the new current position.
PT_BEZIERTO  
  Specifies that this point is a control point or end-point for a Bezier curve.
  PT_BEZIERTO types always occur in sets of three. The current position defines the start-point for the Bezier curve. The first two PT_BEZIERTO points are the control points, and the third PT_BEZIERTO point is the end-point. The end-point becomes the new current position. An error results if there are not three consecutive PT_BEZIERTO points.

A PT_LINETO or PT_BEZIERTO type may be combined with the following flag (using the bit-wise operator OR) to indicate that the corresponding point is the last point in a figure and the figure should be closed:

Type Meaning

PT_CLOSEFIGURE  
  This flag specifies that the figure is automatically closed after the PT_LINETO or PT_BEZIERTO for this point is done. A line is to be drawn from this point to the most recent PT_MOVETO or MoveTo point.
  This flag is combined with the PT_LINETO type for a line, or with the PT_BEZIERTO type of the end-point for a Bezier curve, using the bit-wise operator OR.
  The current position is set to the end-point of the closing line.

nCount

Specifies the total number of points in the lpPoints array, which is the same as the number of bytes in the lpTypes array.

Return Value

TRUE if the command is successful; FALSE if unsuccessful.

Comments

This function may be used in place of consecutive calls to MoveTo, LineTo, and PolyBezierTo to draw disjoint figures. The lines and curves are drawn using the current pen and figures are not filled. If there is an active path started by calling BeginPath, PolyDraw adds to the path.

The points are contained in the lpPoints array, and lpTypes indicates if each point is part of a MoveTo, a LineTo, or part of a BezierTo operation. It is also possible to close figures.

This function updates the current position.

See Also

BeginPath, EndPath, LineTo, PolyBezierTo, PolyLine