BOOL PolyPolygon(hdc, lppt, lpnPolyCounts, cPolygons) | |||||
HDC hdc; | /* handle of device context | */ | |||
const POINT FAR* lppt; | /* address of array with vertices | */ | |||
int FAR* lpnPolyCounts; | /* address of array with point counts | */ | |||
int cPolygons; | /* number of polygons to draw | */ |
The PolyPolygon function creates two or more polygons that are filled by using the current polygon-filling mode. The polygons may be disjoint or overlapping.
hdc
Identifies the device context.
lppt
Points to an array of POINT structures. Each structure in the array specifies a vertext of a polygon. The POINT structure has the following form:
typedef struct tagPOINT { /* pt */
int x;
int y;
} POINT;
For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.
lpnPolyCounts
Points to an array of integers, each of which specifies the number of points in one of the polygons in the array pointed to by the lppt parameter.
cPolygons
Specifies the number of polygons to be drawn. This value must be at least 2.
The return value is nonzero if the function is successful. Otherwise, it is zero.
Each polygon specified in a call to the PolyPolygon function must be closed. Unlike polygons created by the Polygon function, the polygons created by PolyPolygon are not closed automatically.
The PolyPolygon function creates two or more polygons. To create a single polygon, an application should use the Polygon function.
The current polygon-filling mode can be retrieved or set by using the GetPolyFillMode and SetPolyFillMode functions.
The following example draws two overlapping polygons by assigning values to an array of points and then calling the PolyPolygon function:
HDC hdc;
POINT aPolyPoints[8];
int aVertices[] = { 4, 4 };
aPolyPoints[0].x = 50;
aPolyPoints[0].y = 10;
aPolyPoints[1].x = 250;
aPolyPoints[1].y = 50;
aPolyPoints[2].x = 125;
aPolyPoints[2].y = 130;
aPolyPoints[3].x = 50;
aPolyPoints[3].y = 10;
aPolyPoints[4].x = 100;
aPolyPoints[4].y = 25;
aPolyPoints[5].x = 300;
aPolyPoints[5].y = 125;
aPolyPoints[6].x = 70;
aPolyPoints[6].y = 150;
aPolyPoints[7].x = 100;
aPolyPoints[7].y = 25;
PolyPolygon(hdc, aPolyPoints, aVertices,
sizeof(aVertices) / sizeof(int));