Share via


CRgn::CreatePolyPolygonRgn

BOOLCreatePolyPolygonRgn(LPPOINTlpPoints**,LPINTlpPolyCounts,intnCount,intnPolyFillMode);**

Return Value

Nonzero if the operation succeeded; otherwise 0.

Parameters

lpPoints

Points to an array of POINT structures or an array of CPoint objects that defines the vertices of the polygons. Each polygon must be explicitly closed because the system does not close them automatically. The polygons are specified consecutively. The POINT structure has the following form:

typedef struct tagPOINT {
   int x;
   int y;
} POINT;

lpPolyCounts

Points to an array of integers. The first integer specifies the number of vertices in the first polygon in the lpPoints array, the second integer specifies the number of vertices in the second polygon, and so on.

nCount

Specifies the total number of integers in the lpPolyCounts array.

nPolyFillMode

Specifies the polygon-filling mode. This value may be either ALTERNATE or WINDING.

Remarks

Creates a region consisting of a series of closed polygons. The resulting region is stored in the CRgn object.

The polygons may be disjoint, or they may overlap.

The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.

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.

When an application has finished using a region created with the CreatePolyPolygonRgn function, it should select the region out of the device context and use the CGDIObject::DeleteObject member function to remove it.

CRgn OverviewClass MembersHierarchy Chart

See Also   CRgn::CreatePolygonRgn, CDC::SetPolyFillMode,