LBitmapList::GetItem

#include "ltwrappr.h"

virtual L_INT LBitmapList::GetItem(uIndex, pLBitmap, uStructSize, bReflectIndex=TRUE)

Gets an LBitmapBase object that references a bitmap in the class object's bitmap list.

Parameters

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.

LBitmapBase * pLBitmap

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

L_UINT uStructSize

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

L_BOOL bReflectIndex

Flag that indicates whether to set the current index to the passed index. Possible values are:

Value Meaning
TRUE Set the class objects current index to the passed index.
FALSE Do not set the class objects current index to the passed index.

Returns

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

Comments

The bitmap handle that this function gets and attaches to the passed LBitmapBase object is a copy of the bitmap handle stored internally in the list. If you modify the bitmap, you can update the class object's internal bitmap handle to reflect the changes by using the LBitmapList::SetItem function.

You should not free the bitmap. Instead, use LBitmapList::DeleteItems.

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.

See Also

Functions

Topics

Example

L_INT LBitmapList__GetItemExample(HWND hWnd) 
{ 
   UNREFERENCED_PARAMETER(hWnd); 
 
   UNREFERENCED_PARAMETER(hWnd); 
 
   L_INT nRet; 
   LBitmapList BitmapList; 
   LBitmap Bitmap; 
   L_INT nCount, i; 
 
   nRet =BitmapList.Create (); 
   if(nRet !=SUCCESS) 
      return nRet; 
   // load three images and insert them in the list 
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =BitmapList.InsertItem (&Bitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image2.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =BitmapList.InsertItem (&Bitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   BitmapList.InsertItem (&Bitmap); 
 
   nCount = BitmapList.GetItemsCount (); 
   /* Change the hue of each bitmap in the list,  
   and restore the transparent color as the last color in the palette */ 
   for (i = 0; i < nCount; ++i) 
   { 
      nRet =BitmapList.GetItem (i, &Bitmap, sizeof(BITMAPHANDLE)); 
      if(nRet !=SUCCESS) 
         return nRet; 
      nRet =Bitmap.ChangeHue(i * 10); 
      if(nRet !=SUCCESS) 
         return nRet; 
      nRet =BitmapList.SetItem (i, &Bitmap); 
      if(nRet !=SUCCESS) 
         return nRet; 
   } 
   //... 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

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