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 L_FAR * 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 object’s current index to the passed index.

 

FALSE

Do not set the class object’s 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.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Playing Animated Images

 

Implementing Animation

Example

L_VOID TestGetItem(HWND hWnd)
{
   LBitmapList BitmapList;
   LBitmap Bitmap;
   L_INT nCount, i;

   BitmapList.Create ();
   // load three images and insert them in the list
   Bitmap.Load(TEXT("image1.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);
   Bitmap.Load(TEXT("image2.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);
   Bitmap.Load(TEXT("image3.cmp"), 0,ORDER_BGR);
   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)
   {
      BitmapList.GetItem (i, &Bitmap, sizeof(BITMAPHANDLE));
      Bitmap.ChangeHue(i * 10);
      BitmapList.SetItem (i, &Bitmap);
   }
   //...
}