共用方式為


CImage::AlphaBlend

Displays bitmaps that have transparent or semitransparent pixels.

BOOL AlphaBlend(
   HDC hDestDC,
   int xDest,
   int yDest,
   BYTE bSrcAlpha = 0xff,
   BYTE bBlendOp = AC_SRC_OVER 
) const throw( );
BOOL AlphaBlend(
   HDC hDestDC,
   const POINT& pointDest,
   BYTE bSrcAlpha = 0xff,
   BYTE bBlendOp = AC_SRC_OVER 
) const throw( );
BOOL AlphaBlend(
   HDC hDestDC,
   int xDest,
   int yDest,
   int nDestWidth,
   int nDestHeight,
   int xSrc,
   int ySrc,
   int nSrcWidth,
   int nSrcHeight,
   BYTE bSrcAlpha = 0xff,
   BYTE bBlendOp = AC_SRC_OVER 
);
BOOL AlphaBlend(
   HDC hDestDC,
   const RECT& rectDest,
   const RECT& rectSrc,
   BYTE bSrcAlpha = 0xff,
   BYTE bBlendOp = AC_SRC_OVER 
);

Parameters

  • hDestDC
    Handle to the destination device context.

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

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

  • bSrcAlpha
    An alpha transparency value to be used on the entire source bitmap. The default 0xff (255) assumes that your image is opaque, and that you want to use per-pixel alpha values only.

  • bBlendOp
    The alpha-blending function for source and destination bitmaps, a global alpha value to be applied to the entire source bitmap, and format information for the source bitmap. The source and destination blend functions are currently limited to AC_SRC_OVER.

  • pointDest
    A reference to a POINT structure that identifies the upper left corner of the destination rectangle, in logical units.

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

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

  • xSrc
    The logical x-coordinate of the upper left corner of the source rectangle.

  • ySrc
    The logical y-coordinate of the upper left corner of the source rectangle.

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

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

  • rectDest
    A reference to a RECT structure, identifying the destination.

  • rectSrc
    A reference to a RECT structure, identifying the source.

Return Value

Nonzero if successful; otherwise 0.

Remarks

Alpha-blend bitmaps support color blending on a per-pixel basis.

When bBlendOp is set to the default of AC_SRC_OVER, the source bitmap is placed over the destination bitmap based on the alpha values of the source pixels.

This method is applicable to Microsoft Windows 2000, Windows 98, and later systems. See AlphaBlend in the Windows SDK and CImage Limitations with Earlier Operating Systems for more detailed information.

Requirements

Header: atlimage.h

See Also

Concepts

CImage Class

CImage Members

BLENDFUNCTION