GdiTransparentBlt function (Windows)

Switch View :
ScriptFree
GdiTransparentBlt function

Applies to: desktop apps only

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

Minimum supported server

Windows 2000 Server

Header

WinGdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Bitmaps Overview
Bitmap Functions
AlphaBlend
GetDIBits
SetDIBits
SetStretchBltMode
StretchDIBits

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012