Share via


Gdi::AlphaBlend_I (Windows Embedded CE 6.0)

1/6/2010

This method displays bitmaps that have transparent or semitransparent pixels.

Syntax

BOOL AlphaBlend(
  HDC           hdcDest,
  int           nXOriginDest,
  int           nYOriginDest,
  int           nWidthDest,
  int           nHeightDest,
  HDC           hdcSrc,
  int           nXOriginSrc,
  int           nYOriginSrc,
  int           nWidthSrc,
  int           nHeightSrc,
  BLENDFUNCTION blendFunction
);

Parameters

  • hdcDest
    [in] Handle to the destination device context.
  • nXOriginDest
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
  • nYOriginDest
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
  • nWidthDest
    [in] Specifies the width, in logical units, of the destination rectangle. This value cannot be negative.
  • nHeightDest
    [in] Specifies the height, in logical units, of the destination rectangle. This value cannot be negative.
  • hdcSrc
    [in] Handle to the source device context.
  • nXOriginSrc
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle.
  • nYOriginSrc
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle.
  • nWidthSrc
    [in] Specifies the width, in logical units, of the source rectangle. This value cannot be negative.
  • nHeightSrc
    [in] Specifies the height, in logical units, of the source rectangle. This value cannot be negative.
  • blendFunction
    [in] A BLENDFUNCTION structure that specifies 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.

Return Value

If the method succeeds, the return value is TRUE.

If the method fails, the return value is FALSE.

To get retrieve error information, call GetLastError. This can return the following value.

Value Description

ERROR_INVALID_PARAMETER

One or more of the input parameters is invalid.

Remarks

If the source rectangle and destination rectangle are not the same size, the source bitmap is stretched to match the destination rectangle. If the SetStretchBltMode function is used, the iStretchMode value is automatically converted to COLORONCOLOR for this function.

The destination coordinates are transformed by using the transformation currently specified for the destination device context. The source coordinates are transformed by using the transformation currently specified for the source device context.

If the source device context identifies an enhanced metafile device context, an error occurs and the function returns FALSE.

If destination and source bitmaps do not have the same color format, Gdi::AlphaBlend_I converts the source bitmap to match the destination bitmap.

Gdi::AlphaBlend_I does not support mirroring.   If either the width or height of the source or destination is negative, the call to Gdi::AlphaBlend_I will fail.

When rendering to a printer, first call GetDeviceCaps with SHADEBLENDCAPS to determine if the printer supports blending with Gdi::AlphaBlend_I. Note that, for a display DC, all blending operations are supported and these flags represent whether the operations are accelerated.

The source rectangle must lie completely within the source surface, otherwise an error occurs and the function returns FALSE.

The SourceConstantaAlpha member of the BLENDFUNCTION structure specifies an alpha transparency value to be used on the entire source bitmap. The SourceConstantAlpha value is combined with any per-pixel alpha values. If SourceConstantAlpha is 0, it is assumed that the image is transparent. To use only per-pixel alpha values, set the SourceConstantAlpha value to 255 to indicate that the image is opaque.

Requirements

Header gdi.hpp
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

Gdi
BLENDFUNCTION
SetStretchBltMode
GetDeviceCaps