TransparentBlt

TransparentBlt function

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.

Syntax


BOOL TransparentBlt(
  _In_ HDC  hdcDest,
  _In_ int  xoriginDest,
  _In_ int  yoriginDest,
  _In_ int  wDest,
  _In_ int  hDest,
  _In_ HDC  hdcSrc,
  _In_ int  xoriginSrc,
  _In_ int  yoriginSrc,
  _In_ int  wSrc,
  _In_ int  hSrc,
  _In_ UINT crTransparent
);

Parameters

hdcDest [in]

A handle to the destination device context.

xoriginDest [in]

The x-coordinate, in logical units, of the upper-left corner of the destination rectangle.

yoriginDest [in]

The y-coordinate, in logical units, of the upper-left corner of the destination rectangle.

wDest [in]

The width, in logical units, of the destination rectangle.

hDest [in]

The height, in logical units, of the destination rectangle.

hdcSrc [in]

A handle to the source device context.

xoriginSrc [in]

The x-coordinate, in logical units, of the source rectangle.

yoriginSrc [in]

The y-coordinate, in logical units, of the source rectangle.

wSrc [in]

The width, in logical units, of the source rectangle.

hSrc [in]

The height, in logical units, of the source rectangle.

crTransparent [in]

The RGB color in the source bitmap to treat as transparent.

Return value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE.

Remarks

The TransparentBlt function works with compatible bitmaps (DDBs).

The TransparentBlt function supports all formats of source bitmaps. However, for 32 bpp bitmaps, it just copies the alpha value over. Use AlphaBlend to specify 32 bits-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.

When used in a multiple monitor system, both hdcSrc and hdcDest must refer to the same device or the function will fail. To transfer data between DCs for different devices, convert the memory bitmap to a DIB by calling GetDIBits. To display the DIB to the second device, call SetDIBits or StretchDIBits.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

WinGdi.h (include Windows.h)

Library

Msimg32.lib

DLL

Msimg32.dll

See also

Bitmaps Overview
Bitmap Functions
AlphaBlend
GetDIBits
SetDIBits
SetStretchBltMode
StretchDIBits

 

 

Show:
© 2016 Microsoft