LBitmapBase::AlphaBlend

#include "ltwrappr.h"

virtual L_INT LBitmapBase::AlphaBlend (nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, nOpacity, uFlags=0)

Combines image data of both the class object's bitmap and the specified bitmap, using the specified opacity value. The class object's bitmap is considered as the destination bitmap and it will be updated with the result of the operation. The specified bitmap is considered as the source bitmap.

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 that contains 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.

L_INT nOpacity

Opacity value used when combining the areas from the source and destination bitmaps. The valid ranges are:

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

The opacity determines how much the destination bitmap will show through the source bitmap. For example, if the opacity is 255 (completely opaque) then the source image will appear and the destination image will not show through the source image at all. If the opacity is 128 (half opacity), then the pixels for that area will consist of 50 percent from the source image and 50 percent from the destination image.

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.

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__AlphaBlendExample(LBitmapBase & Bitmap, L_TCHAR * szFile1,  
                                                         L_TCHAR * szFile2) 
{ 
   L_INT nRet; 
   LBitmapBase BitmapSrc; 
 
   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; 
 
   nRet =Bitmap.AlphaBlend(Bitmap.GetWidth() / 6, 
                     Bitmap.GetHeight() / 6, 
                     BitmapSrc.GetWidth(), 
                     BitmapSrc.GetHeight(), 
                     &BitmapSrc, 
                     0, 
                     0, 
                     150); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.8
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help