GetPolyFillMode

2.x

  int GetPolyFillMode(hdc)    
  HDC hdc; /* handle of device context */

The GetPolyFillMode function retrieves the current polygon-filling mode.

Parameters

hdc

Identifies the device context.

Return Value

The return value specifies the polygon-filling mode, ALTERNATE or WINDING, if the function is successful.

Comments

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.

Example

The following example uses the GetPolyFillMode function to determine whether the current polygon-filling mode is ALTERNATE:

int nPolyFillMode;

nPolyFillMode = GetPolyFillMode(hdc);
if (nPolyFillMode == ALTERNATE) {
    .
    .
    .
}

See Also

SetPolyFillMode