LBitmapBase::FeatherAlphaBlend

#include "ltwrappr.h"

virtual L_INT LBitmapBase::FeatherAlphaBlend (nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, pBitmapMask)

L_INT nXDst;

/* x coordinate */

L_INT nYDst;

/* y coordinate */

L_INT nWidth;

/* width */

L_INT nHeight;

/* height */

LBitmapBase * pBitmapSrc;

/* pointer to a bitmap handle */

L_INT nXSrc;

/* x coordinate */

L_INT nYSrc;

/* y coordinate */

LBitmapBase * pBitmapMask;

/* pointer to a bitmap handle */

Combines image data from the class object's bitmap and the pBitmapSrc bitmap, with feathering, by combining the two bitmaps with a variable opacity that depends on a fade mask. The class object's bitmap is considered the destination bitmap and it will be updated with the result of the operation. This function is available in the Raster Pro and above toolkits.

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.

nYSrc

The Y coordinate of the origin of the source rectangle.

pBitmapMask

Pointer to the bitmap handle that references the fade mask.

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.

The LBitmapBase::FeatherAlphaBlend function achieves feathering between two bitmaps by using variable opacity values, obtained from the fade mask referenced by pBitmapMask.

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.

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

LTDIS
LTFIL
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.

See Also

Functions:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, LBitmapBase::Underlay, LBitmapBase::Combine, LBitmapBase::AlphaBlend, LBitmapBase::CreateFadedMask.

Topics:

Raster Image Functions: Combining Images

 

Processing an Image

 

Raster Image Functions: Processing an Image

Example

L_VOID TestFunction(LBitmapBase & Bitmap, L_TCHAR * szFile1,
                    L_TCHAR * szFile2)
{
   LBitmapBase BitmapSrc;
   LBitmapBase BitmapMsk;
   LBitmapRgn Region;
   L_INT nXDst, nYDst, nWidth, nHeight;
   RECT rect;

   Bitmap.Load(szFile1);
   BitmapSrc.Load(szFile2);
   
   BitmapSrc.Size(2 * Bitmap.GetWidth() / 3,
                  2 * Bitmap.GetHeight() / 3,
                  SIZE_RESAMPLE);

   nXDst = Bitmap.GetWidth() / 6;
   nYDst = Bitmap.GetHeight() / 6;
   nWidth = BitmapSrc.GetWidth();
   nHeight = BitmapSrc.GetHeight();

   SetRect(&rect, 0, 0, nWidth, nHeight);

   Region.SetBitmap(&BitmapSrc);
   Region.SetRgnRect(&rect);

   BitmapSrc.CreateFadedMask(&BitmapMsk, sizeof(BITMAPHANDLE),
                             min(BitmapSrc.GetWidth() / 3, 
                                 BitmapSrc.GetHeight() / 3),
                             15, 3, 0,
                             FADE_DUMPFILL | FADE_NOTRANSPARENCY,
                             255, RGB(0, 0, 255));

   Bitmap.FeatherAlphaBlend(nXDst, nYDst, nWidth, nHeight,
                            &BitmapSrc, 0, 0, &BitmapMsk);
}