L_TextureAlphaBlendBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_TextureAlphaBlendBitmap(pBitmapDst, nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, pBitmapMask, nOpacity, pBitmapUnderlay, pOffset)

pBITMAPHANDLE pBitmapDst;

/* pointer to the destination bitmap handle */

L_INT nXDst;

/* x coordinate */

L_INT nYDst;

/* y coordinate */

L_INT nWidth;

/* width */

L_INT nHeight;

/* height */

pBITMAPHANDLE pBitmapSrc;

/* pointer to the source bitmap handle */

L_INT nXSrc;

/* x coordinate */

L_INT nYSrc;

/* y coordinate */

pBITMAPHANDLE pBitmapMask;

/* pointer to a mask bitmap handle */

L_INT nOpacity;

/* opacity value */

pBITMAPHANDLE pBitmapUnderlay;

/* pointer to the underlay bitmap handle */

LPPOINT pOffset;

/* pointer to an underlay bitmap offset */

Combines image data from two bitmaps with feathering and constant opacity; by combining the two bitmaps with a variable opacity that depends on a fade mask then combine the result with the destination bitmap with a constant opacity. This function is available in the Raster Pro and above toolkits.

Parameter

Description

pBitmapDst

Pointer to the bitmap handle that references the destination bitmap. The function will update this bitmap.

nXDst

The X coordinate of the origin of the destination rectangle.

nYDst

The Y coordinate of the origin of the destination rectangle.

nWidth

Width of the area to be combined, in pixels. This width applies to both the source and the destination areas.

nHeight

Height of the area to be combined, in pixels. This height applies to both the source and the destination areas.

pBitmapSrc

Pointer to the bitmap handle that references the source bitmap.

nXSrc

The X coordinate of the origin of the source rectangle.

nYSrc

The Y coordinate of the origin of the source rectangle.

pBitmapMask

Pointer to the bitmap handle that references the fade mask, if you want to combine the two bitmaps just with opacity set this parameter to NULL.

nOpacity

Opacity value used when combining the areas from the result of feathering and destination bitmaps. Valid values range from 0 - 65535 for 64-bit, 48-bit and 16-bit grayscale images and from 0 - 4095 for 12-bit grayscale images. Otherwise, it is from 0 to 255.

pBitmapUnderlay

Pointer to the bitmap handle that references the bitmap to be used as the underlying image. The function will use this bitmap to underlay the mask bitmap. You could ignore this parameter effect by passing NULL.

pOffset

Pointer to an underlay bitmap offset with respect to the destination bitmap. The function will use this point to calculate the parts of the underlay bitmap that will be applied to the mask bitmap. Using this point will give the user the ability to give the feel of continuous texture when applying this function to neighboring parts inside the destination bitmap using the same or different mask, if the pBitmapUnderlay parameter is set to NULL also set this parameter to NULL.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To combine two bitmaps with a fixed opacity, use the L_AlphaBlendBitmap function.

To combine two bitmaps with a feather, use the L_FeatherAlphaBlendBitmap function.

The L_TextureAlphaBlendBitmap function does the two operations; at first combine the two images with feather using the fade mask bitmap then combine the result with the destination bitmap with a fixed opacity.

To create a bitmap that contains a fade mask, use L_CreateFadedMask.

This function can also underlay the fade mask bitmap with the underlay bitmap before using it in the feather combine operation.

This function also combines the fade mask bitmap with the underlay bitmap so that it appears to be an underlying texture for the fade mask bitmap.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

The following is an example for the resulted image using this functions with the following characteristics:

The source bitmap is a red image.

The destination bitmap is a white image.

The opacity is set to 255.

The right image is the result of applying the function without texture bitmap.

The left image is the result of applying the function with texture bitmap.

image\TABB.gif

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries

LTIMG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_UnderlayBitmap, L_CombineBitmap, L_AlphaBlendBitmap, L_FeatherAlphaBlendBitmap, L_CreateFadedMask, L_BricksTextureBitmap, L_CanvasBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_VignetteBitmap, L_CanvasBitmap, L_CloudsBitmap, L_ColoredBallsBitmap, L_DiffuseGlowBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_HalfTonePatternBitmap, L_MaskConvolutionBitmap, L_MosaicTilesBitmap, L_OffsetBitmap, L_PerspectiveBitmap, L_PlasmaFilterBitmap, L_PointillistBitmap, L_RomanMosaicBitmap, L_VignetteBitmap, L_ZigZagBitmap

Topics:

Raster Image Functions: Combining Images

 

Processing an Image

 

Raster Image Functions: Processing an Image

Example

BITMAPHANDLE BitmapDst; /* Bitmap handle to hold the loaded image */
BITMAPHANDLE BitmapSrc; /* source bitmap */
BITMAPHANDLE BitmapMask; /* Bitmap handle to the fade mask bitmap */
L_INT XDst, YDst, XSize, YSize, XSrc, YSrc;

/* Load both bitmaps, at 24 bits per pixel */
L_LoadBitmap
 (TEXT("IMAGE1.CMP"), &BitmapDst, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
L_LoadBitmap (TEXT("IMAGE2.BMP"), &BitmapSrc, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);

/* Load the fade mask bitmaps */
L_LoadBitmap (TEXT("FADEMASK.CMP"), &BitmapMask, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL); 

/* Combine BitmapSrc with BitmapDst, with fade mask bitmap and a 100 opacity*/
L_TextureAlphaBlendBitmap
 (&BitmapDst, XDst, YDst, XSize, YSize, &BitmapSrc, XSrc, YSrc, &BitmapMask, 100, NULL, NULL);

/* Free the temporary bitmaps */
L_FreeBitmap
 (&BitmapSrc);
L_FreeBitmap(&BitmapSrc);