LBitmapList::GetItem

#include "ltwrappr.h"

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

L_UINT uIndex;

position of the bitmap in the list

LBitmapBase * pLBitmap;

pointer to an LBitmapBase object

L_UINT uStructSize;

size in bytes, of the structure pointed to by pLBitmap

L_BOOL bReflectIndex;

flag that indicates whether to set the current index to the passed index

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

Parameter Description
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.
pLBitmap Pointer to the bitmap object that will reference the bitmap in the list.
uStructSize Size in bytes, of the structure pointed to by pLBitmap. Use sizeof(BITMAPHANDLE).
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

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

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.

Platforms

Win32, x64.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Playing Animated Images

 

Implementing Animation

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help