JVCL Help:AlphaBlend

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

The AlphaBlend function displays bitmaps that have transparent or semitransparent pixels.

run\JvCaptionButton.pas


Pascal

 run\JvCaptionButton.pas
 functionAlphaBlend(hdcDest: HDC; nXOriginDest: Integer; nYOriginDest: Integer; nWidthDest: Integer; nHeightDest: Integer; hdcSrc: HDC; nXOriginSrc: Integer; nYOriginSrc: Integer; nWidthSrc: Integer; nHeightSrc: Integer; BlendFunction: BLENDFUNCTION): BOOL; stdcall;


Parameters

Parameters Description
hdcDest: HDC Handle to the destination device context.
nXOriginDest: Integer Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nYOriginDest: Integer Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nWidthDest: Integer Specifies the width, in logical units, of the destination rectangle.
nHeightDest: Integer Specifies the height, in logical units, of the destination rectangle.
hdcSrc: HDC Handle to the source device context.
nXOriginSrc: Integer Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle.
nYOriginSrc: Integer Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle.
nWidthSrc: Integer Specifies the width, in logical units, of the source rectangle.
nHeightSrc: Integer Specifies the height, in logical units, of the source rectangle.
BlendFunction: BLENDFUNCTION 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. See the BLENDFUNCTION and EMRALPHABLEND structures.

run\JvCaptionButton.pas


Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.

run\JvCaptionButton.pas


Description

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 (that is, BLACKONWHITE, WHITEONBLACK, and HALFTONE are changed to COLORONCOLOR). 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. An error occurs (and the function returns FALSE) if the source device context identifies an enhanced metafile device context. If destination and source bitmaps do not have the same color format, AlphaBlend converts the source bitmap to match the destination bitmap. AlphaBlend does not support mirroring. If either the width or height of the source or destination is negative, this call will fail. When rendering to a printer, first call GetDeviceCaps with 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. If the source and destination are the same surface, that is, they are both the screen or the same memory bitmap and the source and destination rectangles overlap, an error occurs and the function returns FALSE. The source rectangle must lie completely within the source surface, otherwise an error occurs and the function returns FALSE. AlphaBlend fails if the width or height of the source or destination is negative.

run\JvCaptionButton.pas


About

Notes

The SourceConstantAlpha member of BLENDFUNCTION 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. Set the Sourc ConstantAlpha value to 255 (which indicates that the image is opaque) when you only want to use per-pixel alpha values.
AlphaBlend is supported starting with Windows 98. With previous versions, it does nothing.

run\JvCaptionButton.pas


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page