次の方法で共有


TransparentImage (Compact 2013)

3/28/2014

This function transfers a bitmap, omitting the portions drawn in a specified color.

Syntax

BOOL TransparentImage(
  HDC hdcDest, 
  LONG DstX, 
  LONG DstY, 
  LONG DstCx, 
  LONG DstCy,
  HANDLE hSrc, 
  LONG SrcX, 
  LONG SrcY, 
  LONG SrcCx, 
  LONG SrcCy, 
  COLORREF TransparentColor
);

Parameters

  • hdcDest
    [in] Handle to a device context.
  • DstX
    [in] Specifies the x-coordinate, in logical units, of the upper left corner of the destination rectangle.
  • DstY
    [in] Specifies the y-coordinate, in logical units, of the upper left corner of the destination rectangle.
  • DstCx
    [in] Specifies the width, in logical units, of the destination rectangle.
  • DstCy
    [in] Specifies the height, in logical units, of the destination rectangle.
  • hSrc
    [in] Specifies a source device context or a source bitmap.
  • SrcX
    [in] Specifies the x-coordinate, in logical units, of the upper left corner of the source rectangle.
  • SrcY
    [in] Specifies the y-coordinate, in logical units, of the upper left corner of the source rectangle.
  • SrcCx
    [in] Specifies the width, in logical units, of the source rectangle.
  • SrcCy
    [in] Specifies the height, in logical units, of the source rectangle.
  • TransparentColor
    [in] Indicates the color in the bitmap that will be rendered transparent.

Return Value

Nonzero indicates success.

Zero indicates failure.

To get extended error information, call GetLastError.

Remarks

If the hSrc parameter is a HBITMAP, then that bitmap must not be selected into a device context at the time TransparentImage is called.

The TransparentImage function supports all formats of source bitmaps. However, for 32-bpp bitmaps, it just copies the alpha value over.

If the source and destination rectangles are not the same size, the source bitmap is stretched to match the destination rectangle.

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

Requirements

Header

windows.h

Library

coredll.lib

See Also

Reference

GDI Functions
StretchBlt
MaskBlt
TransparentBlt