GdiTransparentBlt function

The GdiTransparentBlt 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.

Note  This function is the same as TransparentBlt.

Syntax


BOOL GdiTransparentBlt(
  _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 GdiTransparentBlt function works with compatible bitmaps (DDBs).

The GdiTransparentBlt 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 GdiTransparentBlt 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.

GdiTransparentBlt 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

Gdi32.lib

DLL

Gdi32.dll

See also

Bitmaps Overview
Bitmap Functions
AlphaBlend
GetDIBits
SetDIBits
SetStretchBltMode
StretchDIBits

 

 

Build date: 6/12/2013

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.