L_ReplaceBitmapListItem

#include "l_bitmap.h"

L_LTKRN_API L_INT L_ReplaceBitmapListItem(hList, uIndex, pNewBitmap, pOldBitmap, uStructSize)

Removes a bitmap from the list, and lets you treat it as an individual bitmap.

Parameters

HBITMAPLIST hList

Handle to the list of bitmaps.

L_UINT uIndex

Position of the bitmap in the list. Use zero-based indexing. For example, if there are 10 bitmaps in a list, the index of the last one is 9. When you remove a bitmap from a list, the indexes of other bitmaps change to accommodate the removal.

pBITMAPHANDLE pNewBitmap

Pointer to the bitmap handle that will replace the existing bitmap handle in the list.

pBITMAPHANDLE pOldBitmap

Pointer to the bitmap handle that will be updated with the existing bitmap handle from the list.

L_UINT uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

After calling this function, the bitmap handle in the list references the original image data, not a copy. Therefore, you should not free the bitmap that you pass in, but should instead manage the memory using the related list functions (L_DeleteBitmapListItems and L_DestroyBitmapList).

This function does not free the old bitmap. If you want to remove a bitmap from a list and free the bitmap, you should use L_DeleteBitmapListItems.

You cannot use this function to update a bitmap list while it is being used in an animation playback.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example replaces the 3rd item from the bitmap list.

L_INT ReplaceBitmapListItemExample(HBITMAPLIST hList, BITMAPHANDLE * pNewBitmap) 
{ 
   L_INT nRet; 
   BITMAPHANDLE   OldBitmap;  /* OldBitmap */ 
 
   /* Replace item #3, and free the old bitmap */ 
   nRet = L_ReplaceBitmapListItem(hList, 3, pNewBitmap, &OldBitmap, sizeof(BITMAPHANDLE)); 
   if(nRet != SUCCESS) 
      return nRet; 
   L_FreeBitmap(&OldBitmap); 
   return SUCCESS; 
} 

Help Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.