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

Show in webframe

#include "ltwrappr.h"

virtual L_INT LBitmapBase::SetAlpha(LBitmapAlpha)

LBitmapBase& LBitmapAlpha;

/* an LBitmap object */

Replaces the class object's existing alpha channel data or creates new alpha channel data in the class object's bitmap using the specified class object's bitmap.

Parameter

Description

LBitmapAlpha

A bitmap object that has an allocated bitmap to be set as the alpha channel for the calling objects bitmap.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Typically, an alpha channel contains a mask that is used for transparency. This function, together with the LEADTOOLS region processing functions, lets you use the alpha channel to implement transparency.

Only 16- and 32-bit images can have an alpha channel. If pBitmap references a bitmap of any other color resolution, this function converts the pBitmap bitmap to 32-bit before it replaces the alpha channel. (If you want 16-bit, you should change it using LBitmapBase::ColorRes, if necessary, before calling this function.)

The pAlpha bitmap does not have to be grayscale. This function converts the data from the pAlpha bitmap to the necessary grayscale or 1-bit format as it replaces the alpha channel in pBitmap. (The pAlpha bitmap, itself, remains unchanged.)

Note:

The LBitmapAlpha parameter is passed by reference, and is a required parameter.

This function does not support signed data images, unless they are DICOM images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image that is not a DICOM image is passed to this function.

Required DLLs and Libraries

LTDIS
LTFIL

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:

LFile::LoadCMYKArray, LFile::SaveCMYKArray, LPaint::PaintDCCMYKArray, LBitmapBase::CreateAlphaBitmap, Class Members

Topics:

Defining and Using a Bitmap Region

 

Implementing Transparency

 

Saving a Region

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapBase__SetAlphaExample()
{
   L_INT nRet;
   LBitmapBase MyBitmap,Bitmap2;
   MyBitmap.SetFileName(MAKE_IMAGE_PATH(TEXT("image1.cmp")));
   nRet =MyBitmap.Load(32);
   if(nRet !=SUCCESS)//load at 32 bit per pixel
      return nRet;
   nRet =Bitmap2.CreateAlphaBitmap(MyBitmap);
   if(nRet !=SUCCESS)
      return nRet;
   nRet =MyBitmap.Load(MAKE_IMAGE_PATH(TEXT("image2.cmp")),32);
   if(nRet !=SUCCESS)
      return nRet;//load at 32 bit per pixel
   nRet =MyBitmap.SetAlpha(Bitmap2);
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.