| Herd Software Development
|=
DaVinci Graphics Library
|==
DaVinci Documentation Home Search Order


Leonardo: Function DIBAlphaBlend

Copies a section of an overlay DIB onto a base DIB in a fashion similar to StretchDIB2DIBBlt or WinAPI function StretchDIBits. DIBAlphaBlend uses the alpha channel information in the overlay DIB in a fashion similar to the Win98/NT5 API function AlphaBlend.

BOOL FAR PASCAL DIBAlphaBlend (
HDIB hdibDst,
int xDst,
int yDst,
int dxDst,
int dyDst,
HDIB hdibSrc,
int xSrc,
int ySrc,
int dxSrc,
int dySrc,
int iGlobalAlpha)

hDibDst Handle of the base or "target" DIB of either 24 or 32 bit colour depth.

The converted handle remains valid.

xDst, yDst Lower left coordinate of the rectangle in the overlay DIB

dxDst, dyDst Size of the target rectangle in the base DIB

hdibSrc Handle of the source DIB used as the overlay. Must use either 24 or 32 bit colour depth.

The converted handle remains valid.

xDst, yDst Lower left coordinate of the rectangle in the overlay DIB

dxDst, dyDst Size of the rectangle in the overlay DIB

iGlobalAlpha Supplementary alpha value (range 0..255)

Return value

The returned value is during successful execution of the function not equal to 0.

Prerequisites

The iGlobalAlpha value is used to define transparency for even if the source DIB (hdibSrc) is not in RGBA-Format.

The base (target) DIB must have a biBitCount of 24 or 32. Applications can use ConvertDIB and CopyHandle to convert DIBs of other bit depths to the required depth.

The source and target rectangles specified by the function must both be within bounding rectangles of the corresponding DIBs.

DIBAlphaBlend can stretch and shrink but it cannot mirror; i.e. dxDst, dyDst, dxSrc and dySrc cannot be negative.

If any of the above-mentioned conditions are not met, DIBAlphaBlend calls the function StretchDIB2DIBBlt and the operation is performed without transparency.

Memory requirements

DIBAlphaBlend uses very small temporary memory blocks. Memory requirements are defined almost exclusively by the input and output DIBs.

Computing speed

The speed of this function is almost exclusively determined by the size of the destination rectange defined by dxDst and dyDst. The output of a large image in a small window can therefore be done quite rapidly.

Remarks

Win98/NT5 APIs include the new AlphaBlend API function which can be used to achieve similar results on supported platforms, it is likely that graphic adapters with corresponding hardware support can perform the alpha blending operation faster than the DIBAlphaBlend function. DirectX also provides alpha channel capabilities.

See also:

Þ RGBA graphics overview

Þ The BITMAPV4HEADER structure

Þ The StretchDIB2DIBBlt function