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)
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).
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 bitmap handle that references the source bitmap.
The X coordinate of the origin of the source rectangle. This applies to pBitmapSrc, pBitmapMask.
The Y coordinate of the origin of the source rectangle. This applies to pBitmapSrc, 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).
Opacity value used when combining the areas from the result of feathering and destination bitmaps. Valid values ranges are:
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.
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.
Pointer to the bitmap object that references the source bitmap.
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).
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.
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.
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.
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.
Win32, x64.
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 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