Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function 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 BLENDFUNCTIONstructure 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 function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.
To get extended error information, call GetLastError. GetLastErrorcan 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 different sizes, the source bitmap is stretched to match the destination rectangle. If the SetStretchBltModefunction is used, the iStretchModevalue 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, AlphaBlendconverts the source bitmap to match the destination bitmap.
AlphaBlenddoes not support mirroring. If either the width or height of the source or destination is negative, the call to AlphaBlendwill fail.
When rendering to a printer, first call GetDeviceCapswith SHADEBLENDCAPS to determine if the printer supports blending with AlphaBlend. 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 SourceConstantaAlphamember of the BLENDFUNCTIONstructure specifies an alpha transparency value to be used on the entire source bitmap. The SourceConstantAlphavalue is combined with any per-pixel alpha values. If SourceConstantAlphais 0, it is assumed that the image is transparent. To use only per-pixel alpha values, set the SourceConstantAlphavalue to 255 to indicate that the image is opaque.
Requirements
Header | windows.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 5.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |