LBitmapBase::FeatherAlphaBlend

#include "ltwrappr.h"

virtual L_INT LBitmapBase::FeatherAlphaBlend (nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, pBitmapMsk, nXMaskShift, nYMaskShift, uFlags=0)

Combines image data from the class object's bitmap and the pBitmapSrc bitmap, with feathering by combining the two bitmaps with a variable opacity applied by specifying the region of a fade mask. The class object's bitmap is considered the destination bitmap and it will be updated with the result of the operation.

Parameters

L_INT nXDst

The X coordinate of the origin of the destination rectangle.

L_INT nYDst

The Y coordinate of the origin of the destination rectangle.

L_INT nWidth

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

L_INT nHeight

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

LBitmapBase * pBitmapSrc

Pointer to the LBitmapBase class that references the source bitmap.

L_INT nXSrc

The X coordinate of the origin of the source rectangle.

L_INT nYSrc

The Y coordinate of the origin of the source rectangle.

LBitmapBase * pBitmapMsk

Pointer to the LBitmapBase class that references the fade mask.

L_INT nXMaskShift

The X coordinate of the origin of the mask rectangle.

L_INT nYMaskShift

The Y coordinate of the origin of the mask rectangle.

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

Value Meaning
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. The origin coordinates of the region of the fade mask bitmap referenced are specified by the values of nXMaskShift and nYMaskShift parameters.

To create a bitmap that contains a fade mask, call the LBitmapBase::ConvertToGrayScale function.

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

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 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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmapBase__FeatherAlphaBlendExample(LBitmapBase & Bitmap, L_TCHAR * szFile1, 
                                                             L_TCHAR * szFile2) 
{ 
   L_INT nRet; 
   LBitmapBase BitmapSrc; 
   LBitmapBase BitmapMsk; 
   LBitmapRgn Region; 
   L_INT nXDst, nYDst, nWidth, nHeight; 
   RECT rect; 
 
   nRet =Bitmap.Load(szFile1); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =BitmapSrc.Load(szFile2); 
   if(nRet !=SUCCESS) 
      return nRet; 
    
   nRet =BitmapSrc.Size(2 * Bitmap.GetWidth() / 3, 
                  2 * Bitmap.GetHeight() / 3, 
                  SIZE_RESAMPLE); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   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); 
 
   nRet =BitmapSrc.CreateFadedMask(&BitmapMsk, sizeof(BITMAPHANDLE), 
                             min(BitmapSrc.GetWidth() / 3,  
                                 BitmapSrc.GetHeight() / 3), 
                             15, 3, 0, 
                             FADE_DUMPFILL | FADE_NOTRANSPARENCY, 
                             255, RGB(0, 0, 255)); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =Bitmap.FeatherAlphaBlend(nXDst, nYDst, nWidth, nHeight, 
                                 &BitmapSrc, 0, 0, &BitmapMsk,0,0); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help