Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

LBitmapBase::FeatherAlphaBlend

Show in webframe

#include "ltwrappr.h"

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

L_INT nXDst;

/* x coordinate */

L_INT nYDst;

/* y coordinate */

L_INT nWidth;

/* width */

L_INT nHeight;

/* height */

LBitmapBase * pBitmapSrc;

/* pointer to a LBitmapBase class */

L_INT nXSrc;

/* x coordinate */

L_INT nYSrc;

/* y coordinate */

LBitmapBase * pBitmapMsk;

/* pointer to a LBitmapBase class */

L_INT nXMaskShift;

/* x coordinate */

L_INT nYMaskShift;

/* y coordinate */

L_UINT32 uFlags;

/* flags */

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.

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 LBitmapBase class 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.

pBitmapMsk

Pointer to the LBitmapBase class that references the fade mask.

nXMaskShift

The X coordinate of the origin of the mask rectangle.

nYMaskShift

The Y coordinate of the origin of the mask rectangle.

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.

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

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

 

PNG Files and Transparency

 

Implementing Transparency

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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.