I have to learn C# due to the need of my company. If I resist it, may I be able to be fired. Now, under the circumstance
of the economic crisis, losting job is not a good thing.
Both the altered image bitmap and the mask bitmap are selected into memory device contexts. Two BitBlt calls perform the magic.
The first does a BitBlt of the mask bitmap on the window:
BitBlt (hdc, x, y, cxBitmap, cyBitmap, hdcMemMask, 0, 0, 0x220326) ;
This uses a raster operation for which there is no name. The logical operation is D & ~S. Recall that the source-the mask bitmap
is a white ellipse (1 bits) surrounded by black (0 bits). The raster operation inverts the source so that it's a black ellipse
surrounded by white. The raster operation then performs a bitwise AND of this inverted source with the destination the surface of
the window. When the destination is ANDed with 1 bits, it remains unchanged. When ANDed with 0 bits, the destination becomes black.
Thus, this BitBlt operation draws a black ellipse in the window.
The second BitBlt call draws the image bitmap on the window:
BitBlt (hdc, x, y, cxBitmap, cyBitmap, hdcMemImag, 0, 0, SRCPAINT) ;
The raster operation performs a bitwise OR operation between the source and the destination. The outside of the source bitmap is black,
so it leaves the destination unchanged. Within the ellipse, the destination is black, so the image is copied unchanged.
of the economic crisis, losting job is not a good thing.
Both the altered image bitmap and the mask bitmap are selected into memory device contexts. Two BitBlt calls perform the magic.
The first does a BitBlt of the mask bitmap on the window:
BitBlt (hdc, x, y, cxBitmap, cyBitmap, hdcMemMask, 0, 0, 0x220326) ;
This uses a raster operation for which there is no name. The logical operation is D & ~S. Recall that the source-the mask bitmap
is a white ellipse (1 bits) surrounded by black (0 bits). The raster operation inverts the source so that it's a black ellipse
surrounded by white. The raster operation then performs a bitwise AND of this inverted source with the destination the surface of
the window. When the destination is ANDed with 1 bits, it remains unchanged. When ANDed with 0 bits, the destination becomes black.
Thus, this BitBlt operation draws a black ellipse in the window.
The second BitBlt call draws the image bitmap on the window:
BitBlt (hdc, x, y, cxBitmap, cyBitmap, hdcMemImag, 0, 0, SRCPAINT) ;
The raster operation performs a bitwise OR operation between the source and the destination. The outside of the source bitmap is black,
so it leaves the destination unchanged. Within the ellipse, the destination is black, so the image is copied unchanged.
本文介绍如何利用BitBlt函数通过两个内存设备上下文来绘制带有蒙版的位图。首先使用一个特殊的光栅操作来绘制黑色的椭圆蒙版,接着再将目标图像绘制到窗口上,实现精确的图像定位。
635

被折叠的 条评论
为什么被折叠?



