Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_FeatherAlphaBlendBitmap

Show in webframe

#include "l_bitmap.h"

L_LTIMGEFX_API L_INT L_FeatherAlphaBlendBitmap(pBitmapDst, nXDst, nYDst, nWidth, nHeight, pBitmapSrc, nXSrc, nYSrc, pBitmapMask, nXMaskShift, nYMaskShift, uFlags)

pBITMAPHANDLE pBitmapDst;

/* pointer to the bitmap handle */

L_INT nXDst;

/* x coordinate */

L_INT nYDst;

/* y coordinate */

L_INT nWidth;

/* width */

L_INT nHeight;

/* height */

pBITMAPHANDLE pBitmapSrc;

/* pointer to a bitmap handle */

L_INT nXSrc;

/* x coordinate */

L_INT nYSrc;

/* y coordinate */

pBITMAPHANDLE pBitmapMask;

/* pointer to a bitmap handle */

L_INT nXMaskShift;

/* x coordinate */

L_INT nYMaskShift;

/* y coordinate */

L_UINT32 uFlags;

/* flags*/

Combines image data from two bitmaps with feathering. The two bitmaps can be combined with a variable opacity applied by specifying the region of a fade mask.

Parameter

Description

pBitmapDst

Pointer to the bitmap handle that references the destination bitmap. The function will update this bitmap.

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 bitmap handle 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.

pBitmapMask

Pointer to the bitmap handle 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

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.

To combine two bitmaps with a fixed opacity, use the L_AlphaBlendBitmap function.

The L_FeatherAlphaBlendBitmap 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 are specified by the values of nXMaskShift and nYMaskShift parameters.

To create a bitmap that contains a fade mask, use L_CreateFadedMask function.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

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 in the Document and Medical Imaging 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, Linux.

See Also

Functions:

L_UnderlayBitmap, L_CombineBitmap, L_AlphaBlendBitmap, L_CreateFadedMask, L_TextureAlphaBlendBitmap, L_BricksTextureBitmap, L_CanvasBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_VignetteBitmap

Topics:

Raster Image Functions: Combining Images

 

Processing an Image

 

PNG Files and Transparency

 

Implementing Transparency

 

Raster Image Functions: Processing an Image

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 L_INT FeatherAlphaBlendBitmapExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE   BitmapDst;  /* Bitmap handle to hold the loaded image */
   BITMAPHANDLE   BitmapSrc;  /* source bitmap */
   BITMAPHANDLE   BitmapMask; /* Bitmap handle to the fade mask bitmap */
   RECT           rRgnRect;   /* Rectangle that defines the region */
   L_INT          XDst;       /* Column offset of the destination */
   L_INT          XSize;      /* Pixel width of the rectangle to combine */
   L_INT          YDst;       /* Row offset of the destination */
   L_INT          YSize;      /* Pixel height of the rectangle to combine */
   L_INT          XSrc;       /* Column offset of the source */
   L_INT          YSrc;       /* Column offset of the source */

   /* Load both bitmaps, at 24 bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &BitmapDst, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE2.CMP")), &BitmapSrc, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;

   /* Specify a position in the top left part of the displayed image */
   XDst = BITMAPWIDTH(&BitmapDst) / 8;
   YDst = BITMAPHEIGHT(&BitmapDst) / 8;
   /* Use the half size of the source bitmap */
   YSize = BITMAPHEIGHT(&BitmapSrc) / 2;
   XSize = BITMAPWIDTH(&BitmapSrc) / 2;
   XSrc = 0;
   YSrc = 0;
   // specify a rectangle 
   SetRect(&rRgnRect, XSrc, YSrc, XSrc + XSize , YSrc + YSize);
   /* Create a rectangular region */
   nRet = L_SetBitmapRgnRect (&BitmapSrc, NULL, &rRgnRect, L_RGN_SET);
   if(nRet != SUCCESS)
      return nRet;

   /* create the fade mask */
   nRet = L_CreateFadedMask(&BitmapSrc, &BitmapMask, sizeof(BITMAPHANDLE), 60, 20, 3, 0, FADE_DUMPFILL | FADE_NOTRANSPARENCY, 255,RGB(0, 0, 255));
   if(nRet != SUCCESS)
      return nRet;
   /* Combine BitmapSrc with BitmapDst, with fade mask bitmap  */
#if defined (LEADTOOLS_V16_OR_LATER)
   nRet = L_FeatherAlphaBlendBitmap (&BitmapDst, XDst, YDst, XSize, YSize,
       & BitmapSrc, XSrc, YSrc, &BitmapMask, 0,0, 0);
#else
   nRet = L_FeatherAlphaBlendBitmap (&BitmapDst, XDst, YDst, XSize, YSize,
       & BitmapSrc, XSrc, YSrc, &BitmapMask, 0,0);
#endif
   if(nRet != SUCCESS)
      return nRet;

   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &BitmapDst, FILE_BMP, 24, 0, NULL);
   if(nRet != SUCCESS)
      return nRet;

   /* Free the temporary bitmap */
   L_FreeBitmap(&BitmapSrc);
   L_FreeBitmap(&BitmapMask);
   L_FreeBitmap(&BitmapDst);
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.