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.
#include "ltwrappr.h"
virtual L_INT LBitmapBase::FeatherAlphaBlend (nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, pBitmapMsk, nXMaskShift, nYMaskShift, uFlags=0)
The X coordinate of the origin of the destination rectangle.
The Y coordinate of the origin of the destination rectangle.
Width of the area to be combined, in pixels. This width applies to both the source and the destination areas.
Height of the area to be combined, in pixels. This height applies to both the source and the destination areas.
Pointer to the LBitmapBase class that references the source bitmap.
The X coordinate of the origin of the source rectangle.
The Y coordinate of the origin of the source rectangle.
Pointer to the LBitmapBase class that references the fade mask.
The X coordinate of the origin of the mask rectangle.
The Y coordinate of the origin of the mask rectangle.
Reserved for future use. Must be 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
Feather Alpha Blend Function - Before
Feather Alpha Blend Function - After
View additional platform support for this Feather Alpha Blend function.
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document