SetPolyFillMode

Syntax

int SetPolyFillMode(hDC,nPolyFillMode)

This function sets the polygon-filling mode for the GDI functions that use the polygon algorithm to compute interior points.

Parameter Type/Description  

hDC HDC Identifies the device context.  
nPolyFillMode int Specifies the new filling mode. The nPolyFillMode parameter may be either of the following values:  
  Value Meaning
  ALTERNATE Selects alternate mode.
  WINDING Selects winding number mode.

Return Value

The return value specifies the previous filling mode. It is zero if there is an error.

Comments

In general, the modes differ only in cases where a complex, overlapping polygon must be filled (for example, a five-sided polygon that forms a five-pointed star with a pentagon in the center). In such cases, ALTERNATE mode fills every other enclosed region within the polygon (that is, the points of the star), but WINDING mode fills all regions (that is, the points and the pentagon).

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

To fill all regions, WINDING mode causes GDI to compute and draw a border that encloses the polygon but does not overlap. For example, in WINDING mode, the five-sided polygon that forms the star is drawn as a ten-sided polygon with no overlapping sides; the resulting star is filled.