BOOL PatBlt(hDC,X,Y,nWidth,nHeight,dwRop)
This function creates a bit pattern on the specified device. The pattern is a combination of the selected brush and the pattern already on the device. The raster-operation code specified by the dwRop parameter defines how the patterns are to be combined.
| Parameter | Type/Description |
| hDC | HDC Identifies the device context. | |
| X | int Specifies the logical x-coordinate of the upper-left corner of the rectangle that is to receive the pattern. | |
| Y | int Specifies the logical y-coordinate of the upper-left corner of the rectangle that is to receive the pattern. | |
| nWidth | int Specifies the width (in logical units) of the rectangle that is to receive the pattern. | |
| nHeight | int Specifies the height (in logical units) of the rectangle that is to receive the pattern. | |
| dwRop | DWORD Specifies the raster-operation code. Raster-operation codes (ROPs) define how GDI combines colors in output operations that involve a current brush, a possible source bitmap, and a destination bitmap. For a list of the raster-operation codes, see Table R.12, “Raster Operations.” |
The return value specifies the outcome of the function. It is nonzero if the bit pattern is drawn. Otherwise, it is zero.
The values of dwRop 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 cannot be used.
Not all devices support the PatBlt function. For more information, see the RC_BITBLT capability in the GetDeviceCaps function, earlier in this chapter.
Table R.12 lists the various raster-operation codes for the dwRop parameter:
Table R.12 Raster Operations
| Code | Description |
| PATCOPY | Copies pattern to destination bitmap. |
| PATINVERT | Combines destination bitmap with pattern using the Boolean OR operator. |
| DSTINVERT | Inverts the destination bitmap. |
| BLACKNESS | Turns all output black. |
| WHITENESS | Turns all output white. |