win32 PatBlt

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.

BOOL PatBlt(
  __in  HDC hdc,
  __in  int nXLeft,
  __in  int nYLeft,
  __in  int nWidth,
  __in  int nHeight,
  __in  DWORD dwRop
);

Parameters

hdc [in]
A handle to the device context.

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

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

nWidth [in]
The width, in logical units, of the rectangle.

nHeight [in]
The height, in logical units, of the rectangle.

dwRop [in]
The raster operation code. This code can be one of the following values.

ValueMeaning
PATCOPYCopies the specified pattern into the destination bitmap.
PATINVERTCombines the colors of the specified pattern with the colors of the destination rectangle by using the Boolean XOR operator.
DSTINVERTInverts the destination rectangle.
BLACKNESSFills the destination rectangle using the color associated with index 0 in the physical palette. (This color is black for the default physical palette.)
WHITENESSFills 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.

备注

参考《windows程序设计》第5版 北大出版社 Page616
绘制一个黑色矩形:
PatBlt(hdc,x,y,cx,cy,BLACKNESS)

绘制一个白色矩形:
PatBlt(hdc,x,y,cx,cy,WHITENESS)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值