CRgn::CreatePolygonRgn

Syntax

BOOL CreatePolygonRgn( LPPOINT lpPoints, int nCount, int wMode );

Parameters

lpPoints

Points to an array of POINT structures or an array of CPoint objects. Each structure specifies the x- and y-coordinate of one vertex of the polygon.

nCount

Specifies the number of POINT structures or CPoint objects in the array pointed to by lpPoints.

nMode

Specifies the filling mode for the region. This parameter may be either ALTERNATE or WINDING.

Remarks

Creates a polygonal region. The system closes the polygon automatically, if necessary, by drawing a line from the last vertex to the first. The resulting region is stored in the CRgn object.

When the polygon-filling mode is ALTERNATE, the system fills the area between odd-numbered and even-numbered polygon sides on each scan line. That is, the system fills the area between the first and second side, between the third and fourth side, and so on.

When the polygon-filling mode is WINDING, the system uses the direction in which a figure was drawn to determine whether to fill an area. Each line segment in a polygon is drawn in either a clockwise or a counterclockwise direction. Whenever an imaginary line drawn from an enclosed area to the outside of a figure passes through a clockwise line segment, a count is incremented. When the line passes through a counterclockwise line segment, the count is decremented. The area is filled if the count is nonzero when the line reaches the outside of the figure.

Return Value

TRUE if the operation succeeded; otherwise FALSE.

See Also

CRgn::CreatePolyPolygonRgn, ::CreatePolygonRgn