#include "l_bitmap.h"

L_LTKRN_API L_INT L_GetBitmapListItem(hList, uIndex, pBitmap, uStructSize)


handle to the list of bitmaps

L_UINT uIndex;

position of the bitmap in the list


pointer to the bitmap handle

L_UINT uStructSize;

size in bytes, of the structure pointed to by pBitmap

Gets a bitmap handle that references a bitmap in a list. 




Handle to the list of bitmaps.


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.


Pointer to the bitmap handle that will reference the bitmap in the list.


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



The function was successful.

< 1

An error occurred. Refer to Return Codes.


The bitmap handle that this function gets is a copy of the bitmap handle stored internally in the list. If you modify the bitmap using this handle, you can update the internal bitmap handle to reflect the changes by using the L_SetBitmapListItem function.

You should not use this handle to free the bitmap. Instead, 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


For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.


Win32, x64, Linux.

See Also


L_LoadBitmapList, L_SaveBitmapList, L_CreateBitmapList, L_DestroyBitmapList, L_CopyBitmapListItems, L_GetBitmapListCount, L_InsertBitmapListItem, L_RemoveBitmapListItem, L_DeleteBitmapListItems, L_SetBitmapListItem, L_ColorResBitmapList, L_TranslateBitmapColorL_AddPageNumbersToBitmapList


Raster Image Functions: Playing Animated Images


Raster Image Functions: Creating and Maintaining Lists of Images


Implementing Animation


For complete sample code, refer to the CHILD.C module of the DEMO example. This example changes the hue of bitmaps in a list, then updates the paint palette and the target bitmap's palette for animation playback. When changing the hue, it preserves the transparent color.

L_INT GetBitmapListItemExample(HWND            hWnd, 
                                              HBITMAPLIST     hList, 
                                              LPRGBQUAD       TransparentColor, 
                                              pBITMAPHANDLE   pBitmap, 
                                              HPALETTE        hpalPaint  /* Paint palette handle */) 
   HDC            hdc;        /* Device context of the current window */ 
   BITMAPHANDLE   TmpBitmap;  /* Temporary bitmap for manipulating the list */ 
   L_UINT         i;          /* Loop counter */ 
   L_UINT         uCount;     /* Number of bitmaps in the list */ 
   L_INT          nRet; 
   /* Change the hue of each bitmap in the list,  
   and restore the transparent color as the last color in the palette */ 
   nRet = L_GetBitmapListCount(hList, &uCount); 
   if(nRet != SUCCESS) 
      return nRet; 
   for (i = 0; i < uCount; ++i) 
      nRet = L_GetBitmapListItem(hList, i, &TmpBitmap, sizeof(BITMAPHANDLE)); 
      if(nRet != SUCCESS) 
         return nRet; 
      nRet = L_ChangeBitmapHue(&TmpBitmap, i * 10, 0); 
      if(nRet != SUCCESS) 
         return nRet; 
         nRet = L_PutBitmapColors(&TmpBitmap, 255, 1, TransparentColor); 
         if(nRet != SUCCESS) 
            return nRet; 
      nRet = L_SetBitmapListItem(hList, i, &TmpBitmap); 
      if(nRet != SUCCESS) 
         return nRet; 
   /* Get an optimized palette for the whole list */ 
   nRet = L_ColorResBitmapList(hList, 8, 
                              NULL, NULL, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Update the paint palette that is used for playback */ 
   nRet = L_GetBitmapListItem(hList, 0, &TmpBitmap, sizeof(BITMAPHANDLE)); 
   if(nRet != SUCCESS) 
      return nRet; 
   hdc = GetDC (hWnd); 
   hpalPaint = L_CreatePaintPalette (hdc, &TmpBitmap); 
   ReleaseDC (hWnd, hdc); 
   /* Update the target bitmap's background color, based on the new palette */ 
   pBitmap->Background = L_TranslateBitmapColor(&TmpBitmap, pBitmap, pBitmap->Background); 
   /* Copy the new palette to the target bitmap */ 
   nRet = L_CopyBitmapPalette(pBitmap, &TmpBitmap); 
   return nRet; 

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

LEADTOOLS Raster Imaging C API Help