TransparentBlt

[This is preliminary documentation and subject to change.]

The TransparentBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

BOOL TransparentBlt(
  HDC hdcDest,
  int nXOriginDest,
  int nYOriginDest,
  int nWidthDest,
  int hHeightDest,
  HDC hdcSrc,
  int nXOriginSrc,
  int nYOriginSrc,
  int nWidthSrc,
  int nHeightSrc,
  UINT crTransparent
);
 

Parameters

hdcDest
Handle to the destination device context.
nXOriginDest
Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nYOriginDest
Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nWidthDest
Specifies the width, in logical units, of the destination rectangle.
hHeightDest
Handle to the height, in logical units, of the destination rectangle.
hdcSrc
Handle to the source device context.
nXOriginSrc
Specifies the x-coordinate, in logical units, of the source rectangle.
nYOriginSrc
Specifies the y-coordinate, in logical units, of the source rectangle.
nWidthSrc
Specifies the width, in logical units, of the source rectangle.
nHeightSrc
Specifies the height, in logical units, of the source rectangle.
crTransparent
The RGB color in the source bitmap to treat as transparent.

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

Windows NT: To get extended error information, call GetLastError.

Remarks

The TransparentBlt function is supported for source bitmaps of 4 bits per pixel and 8 bits per pixel. Use AlphaBlend to specify 32-bit per pixel bitmaps with transparency.

If the source and destination rectangles are not the same size, the source bitmap is stretched to match the destination rectangle. When the SetStretchBltMode function is used, the iStretchMode modes of BLACKONWHITE and WHITEONBLACK are converted to COLORONCOLOR for the TransparentBlt function.

The destination device context specifies the transformation type for the destination coordinates. The source device context specifies the transformation type for the source coordinates.

TransparentBlt does not mirror a bitmap if either the width or height, of either the source or destination, is negative.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Requires Windows 98 or later.
  Windows CE: Unsupported.
  Header: Declared in wingdi.h.
  Import Library: Included as a resource in msimg32.dll.

See Also

Bitmaps Overview, Bitmap Functions, AlphaBlend, SetStretchBltMode