LBitmap::TextureAlphaBlend

#include "ltwrappr.h"

virtual L_INT LBitmap::TextureAlphaBlend (nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, pBitmapMask, nOpacity, pBitmapUnderlay, pOffset, uFlags = 0)

virtual L_INT LBitmap::TextureAlphaBlend (nXDst, nYDst, nWidth, nHeight, plBitmapSrc, nXSrc, nYSrc, plBitmapMask, nOpacity, plBitmapUnderlay, pOffset, uFlags = 0)

L_INT nXDst;

x coordinate in destination bitmap

L_INT nYDst;

y coordinate in destination bitmap

L_INT nWidth;

width

L_INT nHeight;

height

pBITMAPHANDLE pBitmapSrc;

pointer to a bitmap handle

L_INT nXSrc;

x coordinate in source bitmap

L_INT nYSrc;

y coordinate in source bitmap

pBITMAPHANDLE pBitmapMask;

pointer to a bitmap handle

L_INT nOpacity;

opacity value

pBITMAPHANDLE pBitmapUnderlay;

pointer to the underlay bitmap handle

LPPOINT pOffset;

pointer to an underlay bitmap offset

LBitmapBase *plBitmapSrc;

pointer to a bitmap object

LBitmapBase *plBitmapMask;

pointer to a bitmap object

LBitmapBase *plBitmapUnderlay;

pointer to the underlay bitmap object

L_UINT32 uFlags;

flags

Combines image data from pBitmapMask and pBitmapUnderlay with an underlay effect. The result is used as a fade mask that will be used to combine pBitmapSrc and caller object with variable opacity. The result is combined again with caller object using a constant opacity (using nOpacity).

Parameter

Description

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. This applies to pBitmapSrc, pBitmapMask.

nYSrc

The Y coordinate of the origin of the source rectangle. This applies to pBitmapSrc, pBitmapMask.

pBitmapMask

Pointer to the bitmap handle that references the fade mask. This parameter can be set to NULL, in which case the combine is performed with a constant opacity (nOpacity).

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. This parameter will be used only if pBitmapUnderlay is not NULL.

plBitmapSrc

Pointer to the bitmap object that references the source bitmap.

plBitmapMask

Pointer to the bitmap object that references the fade mask. This parameter can be set to NULL, in which case the combine is performed with a constant opacity (nOpacity).

plBitmapUnderlay

Pointer to the bitmap object 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.

uFlags

Reserved for future use. Must be 0.

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 LBitmapBase::AlphaBlend function.

To combine two bitmaps with feathering, use the LBitmapBase::FeatherAlphaBlend function.

This function works as follows:

If pBitmapUnderlay is not NULL, pBitmapUnderlay is applied with an underlay operation to pBitmapMask. If present, pOffset is used to shift the starting point for the underlay pattern. If pBitmapMask is NULL, pBitmapUnderlay is not used.

If pBitmapMask is not NULL, it is used to combine pBitmapSrc with caller object using a variable opacity. If pBitmapMask is NULL, this step is skipped. (A local copy of pBitmapSrc will be used the original bitmap passed as pBitmapSrc will not be affected).

pBitmapSrc will be combined with caller object using fixed opacity (nOpacity).

To create a bitmap that contains a fade mask, use LBitmapBase::CreateFadedMask.

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

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.

As an example:

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\TextureAlphaBlend.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.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGEFX

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

Win32, x64.

See Also

Functions:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::Clouds, LBitmap::ColoredBalls, LBitmap::DiffuseGlow, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::HalfTonePattern, LBitmap::MaskConvolution, LBitmap::MosaicTiles, LBitmap::Offset, LBitmap::Perspective, LBitmap::PlasmaFilter, LBitmap::Pointillist, LBitmap::RomanMosaic, LBitmap::Vignette, LBitmap::ZigZag, LBitmapBase::Underlay, LBitmapBase::Combine, LBitmapBase::AlphaBlend, LBitmapBase::FeatherAlphaBlend, LBitmapBase::CreateFadedMask.

Topics:

Raster Image Functions: Combining Images

 

Processing an Image

 

Raster Image Functions: Processing an Image

Example

L_INT LBitmap__TextureAlphaBlendExample(LBitmap *pBitmapSrc, LBitmap *pBitmapDst, LBitmap *pBitmapMask) 
{ 
   L_INT nRet; 
   /* Combine BitmapSrc with BitmapDst, with fade mask bitmap and a 100 opacity*/ 
   nRet = pBitmapDst->TextureAlphaBlend (0, 0, 100, 100, pBitmapSrc, 100, 100, 
   pBitmapMask, 100, NULL, NULL); 
   /* Free the temporary bitmaps */ 
   pBitmapSrc->Free (); 
   pBitmapMask->Free (); 
   return nRet; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help