Windows supports five graphic modes that allow an application to specify how colors are mixed, where output appears, how the output is scaled, and so on. These modes, which are stored in a device context, are described in the following table.
Mode | Description |
Background mode | Defines how background colors are mixed with existing window or screen colors for bitmap and text operations. |
Drawing mode | Defines how foreground colors are mixed with existing window or screen colors for pen, brush, bitmap, and text operations. |
Mapping mode | Defines how graphics output is mapped from logical (or world) space onto the window, screen, or printer paper. |
Polygon-fill mode | Defines how the brush pattern is used to fill the interior of complex regions. |
Stretching mode | Defines how bitmap colors are mixed with existing window or screen colors when the bitmap is compressed (or scaled down). |
As it does with graphic objects, Windows initializes a device context with default graphic modes. An application can retrieve and examine these default modes by calling the following functions.
Graphic mode | Function |
Background mode | GetBkMode |
Drawing mode | GetROP2 |
Mapping mode | GetMapMode |
Polygon-fill mode | GetPolyFillMode |
Stretching mode | GetStretchBltMode |
An application can change the default modes by calling one of the following functions.
Graphic mode | Function |
Background mode | SetBkMode |
Drawing mode | SetROP2 |
Mapping mode | SetMapMode |
Polygon-fill mode | SetPolyFillMode |
Stretching mode | SetStretchBltMode |