CreatePolygonRgn function

The CreatePolygonRgn function creates a polygonal region.

Syntax

HRGN CreatePolygonRgn(
  CONST POINT *pptl,
  int         cPoint,
  int         iMode
);

Parameters

pptl

A pointer to an array of POINT structures that define the vertices of the polygon in logical units. The polygon is presumed closed. Each vertex can be specified only once.

cPoint

The number of points in the array.

iMode

The fill mode used to determine which pixels are in the region. This parameter can be one of the following values.

Value Meaning
ALTERNATE
Selects alternate mode (fills area between odd-numbered and even-numbered polygon sides on each scan line).
WINDING
Selects winding mode (fills any region with a nonzero winding value).
 

For more information about these modes, see the SetPolyFillMode function.

Return Value

If the function succeeds, the return value is the handle to the region.

If the function fails, the return value is NULL.

Remarks

When you no longer need the HRGN object, call the DeleteObject function to delete it.

Region coordinates are represented as 27-bit signed integers.

Regions created by the Create<shape>Rgn methods (such as CreateRectRgn and CreatePolygonRgn) only include the interior of the shape; the shape's outline is excluded from the region. This means that any point on a line between two sequential vertices is not included in the region. If you were to call PtInRegion for such a point, it would return zero as the result.

Requirements

   
Windows version Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See Also

CreatePolyPolygonRgn

CreateRectRgn

CreateRectRgnIndirect

CreateRoundRectRgn

DeleteObject

ExtCreateRegion

GetRegionData

POINT

Region Functions

Regions Overview

SelectObject

SetPolyFillMode