MaskBlt

  BOOL MaskBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, hbmMask, xMask, yMask, dwRop)    
  HDC hdcDest; /* handle of destination device-context */
  int nXDest; /* upper-left corner of destination rectangle */
  int nYDest; /* upper-left corner of destination rectangle */
  int nWidth; /* width of source and destination rectangles */
  int nHeight; /* height of source and destination rectangles */
  HDC hdcSrc; /* handle of source device-context */
  int nXSrc; /* upper-left corner of source rectangle */
  int nYSrc; /* upper-left corner of source rectangle */
  HBITMAP hbmMask; /* handle of monochrome bit-mask */
  int xMask; /* upper-left corner of mask rectangle */
  int yMask; /* upper-left corner of mask rectangle */
  DWORD dwRop; /* raster-operation code */

The MaskBlt function combines the color data for the source and destination bitmaps using the given mask and raster operation.

Parameters

hdcDest

Identifies the destination device-context.

nXDest

Specifies the logical x-coordinate of the upper-left corner of the destination rectangle.

nYDest

Specifies the logical y-coordinate of the upper-left corner of the destination rectangle.

nWidth

Specifies the width (in logical units) of the destination rectangle and source bitmap.

nHeight

Specifies the height (in logical units) of the destination rectangle and source bitmap.

hdcSrc

Identifies the device context from which the bitmap will be copied. It must be 0 if the Rop parameter specifies a raster operation that does not include a source.

nXSrc

Specifies the logical x-coordinate of the upper-left corner of the source bitmap.

nYSrc

Specifies the logical y-coordinate of the upper-left corner of the source bitmap.

hbmMask

A monochrome bitmap which is combined with the color bitmap in the source device context.

xMask

Specifies the x-coordinate of the upper-left corner of the the mask in hbmMask.

yMask

Specifies the y-coordinate of the upper-left corner of the the mask in hbmMask.

dwRop

Specifies the raster operation that is used to combine the color data for the source and the destination rectangle. The following list contains the various raster-operation codes that can be specified for the dwRop parameter:

Raster-Operation (ROP) Code Description

To be supplied.  
  To be supplied.

Return Value

The return value is TRUE if the function is successful. Otherwise it is FALSE.

Comments

A value of 1 in the mask indicates that the destination pixel color should be combined with the source pixel color using the high-order word of dwROP. A value of 0 in the mask indicates that the destination pixel color should be combined with the source pixel color using the low-order word of dwROP.

If the mask rectangle is smaller than the source and destination rectangle, the function will replicate the mask pattern.

If a rotation or shear transformation is in effect for the source device-context when this function is called, an error will occur. However, other transformations are allowed.

If the color formats of the source, pattern, and destination bitmaps differ, this function will convert the pattern and/or destination formats to match the source format.

If the mask bitmap is not a monochrome bitmap, an error will occur.

When recording an enhanced metafile, it is an error if the source device context identifies the enhanced metafile device context.

Not all devices support the MaskBlt function. (An application should call the GetDeviceCaps function to determine whether or not a device supports the MaskBlt function.)

If the source and destination device-contexts represent incompatible devices, this function returns an error.

See Also

BitBlt, GetDeviceCaps