LBitmapBase::CopyPalette

Summary

Copies the palette of a source bitmap and places it into a destination bitmap. Only the palette field of the bitmap handle is copied.

Syntax

#include "ltwrappr.h"

virtual L_INT LBitmapBase::CopyPalette(pLSrcBitmap)

Parameters

LBitmapBase * pLSrcBitmap

Pointer to the source bitmap handle. You must have a valid image loaded into the bitmap for this function to work.

Returns

Value Meaning
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.

The destination bitmap must be allocated and must be 8-bit or less before this function is called. The source bitmap and destination bitmap must have the same bits per pixel.

The destination bitmaps existing palette will be destroyed before the copy is made.

When the destination bitmap is freed, the palette will also be destroyed.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmapBase__CopyPaletteExample() 
{ 
   L_INT nRet; 
   LBitmapBase LeadBitmap;   /* Bitmap handle to hold the loaded image. */ 
   pBITMAPHANDLE pLeadBitmapHandle = LeadBitmap.GetHandle(); 
 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0, ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   LBitmapBase TmpBitmap; 
   pBITMAPHANDLE pTmpBitmapHandle = TmpBitmap.GetHandle(); 
 
   nRet =  TmpBitmap.Copy(LeadBitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet = TmpBitmap.CopyPalette(&LeadBitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   //free bitmap  
   if(pLeadBitmapHandle->Flags.Allocated)   
      L_FreeBitmap(pLeadBitmapHandle);   
 
   if(pTmpBitmapHandle->Flags.Allocated)   
      L_FreeBitmap(pTmpBitmapHandle);   
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.