LBitmapBase::TranslateColor

#include "ltwrappr.h"

virtual COLORREF LBitmapBase::TranslateColor(LBitmapSrc, crColor)

LBitmapBase& LBitmapSrc;

/* the source bitmap object */

COLORREF crColor;

/* the color in the source bitmap */

Translates the specified color in the source class object's bitmap, and returns the nearest matching color in the calling object's bitmap.

Parameter

Description

LBitmapSrc

The source bitmap object.

crColor

The COLORREF value that specifies the color in the source bitmap to be translated. You can get the value from a palette entry or by using LBitmapBase::GetPixelColor.

Returns

The COLORREF value or the palette index of the nearest matching color in calling object's bitmap. If the calling object's bitmap is 8 bits per pixel or less, this is always the palette index. Otherwise, it is the COLORREF value.

Comments

When creating a target bitmap for animation, you can use this function to ensure that the correct color is specified as the background color.

Note:

The LBitmapSrc paramater is passed by reference, and is a required parameter.

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.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Creating and Maintaining Lists of Images

 

Raster Image Functions: Palettes

 

Color Resolution and Dithering

 

Implementing Animation

 

Using Color Values in LEADTOOLS

Example

L_INT LBitmapBase__TranslateColorExample()
{
   L_INT nRet;
   LBitmapBase MyBitmap, Bitmap2;
   MyBitmap.SetFileName(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image1.cmp"));
   nRet =MyBitmap.Load(32);  //load at 32 bit per pixel
   if(nRet != SUCCESS )
      return nRet;
   COLORREF Color=MyBitmap.GetPixelColor(100,200);
   nRet =Bitmap2.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image2.cmp"));
   if(nRet !=SUCCESS)
      return nRet;
   Color=MyBitmap.TranslateColor(Bitmap2, Color);
   return SUCCESS;
}