PatBlt function (wingdi.h)

The PatBlt function paints the specified rectangle using the brush that is currently selected into the specified device context. The brush color and the surface color or colors are combined by using the specified raster operation.

Syntax

BOOL PatBlt(
  [in] HDC   hdc,
  [in] int   x,
  [in] int   y,
  [in] int   w,
  [in] int   h,
  [in] DWORD rop
);

Parameters

[in] hdc

A handle to the device context.

[in] x

The x-coordinate, in logical units, of the upper-left corner of the rectangle to be filled.

[in] y

The y-coordinate, in logical units, of the upper-left corner of the rectangle to be filled.

[in] w

The width, in logical units, of the rectangle.

[in] h

The height, in logical units, of the rectangle.

[in] rop

The raster operation code. This code can be one of the following values.

Value Meaning
PATCOPY
Copies the specified pattern into the destination bitmap.
PATINVERT
Combines the colors of the specified pattern with the colors of the destination rectangle by using the Boolean XOR operator.
DSTINVERT
Inverts the destination rectangle.
BLACKNESS
Fills the destination rectangle using the color associated with index 0 in the physical palette. (This color is black for the default physical palette.)
WHITENESS
Fills the destination rectangle using the color associated with index 1 in the physical palette. (This color is white for the default physical palette.)

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

The values of the dwRop parameter for this function are a limited subset of the full 256 ternary raster-operation codes; in particular, an operation code that refers to a source rectangle cannot be used.

Not all devices support the PatBlt function. For more information, see the description of the RC_BITBLT capability in the GetDeviceCaps function.

Examples

For an example, see "Example of Menu-Item Bitmaps" in Using Menus.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Brush Functions

Brushes Overview

GetDeviceCaps