LBitmapList::RemoveItem

#include "ltwrappr.h"

virtual L_INT LBitmapList::RemoveItem(uIndex, pRemovedBitmap)

L_UINT uIndex;

/* position of the bitmap in the list */

LBitmapBase * pRemovedBitmap;

/* pointer to an LBitmapBase object */

Removes a bitmap from the 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. When you remove a bitmap from a list, the indexes of other bitmaps change to accommodate the removal.

pRemovedBitmap

Pointer to the bitmap object that references the removed bitmap. You can use this object afterward to work with the individual bitmap.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function does not free the bitmap. If you want to remove a bitmap from a bitmap list and free the bitmap, you should 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_INT LBitmapList__RemoveItemExample(HWND hWnd)
{
   L_INT nRet;
   LBitmapList BitmapList;
   LBitmapBase Bitmap, PaintBitmap;
   HDC hDC;
   RECT rcClientRect;
   // load three images and insert them in the list
   Bitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image1.cmp"), 0,ORDER_BGR);
   BitmapList.Create ();
   BitmapList.InsertItem (&Bitmap);
   Bitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image2.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);
   Bitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image3.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);
    // Set the DC and the Destination rectangle
   GetClientRect(hWnd, &rcClientRect);
   hDC = GetDC(hWnd);
   PaintBitmap.Paint()->SetDC(hDC);
   PaintBitmap.SetDstRect(&rcClientRect);
   // Remove an item and paint the removed item
   nRet =BitmapList.RemoveItem (2, &PaintBitmap);
   if(nRet !=SUCCESS)
      return nRet;
   PaintBitmap.Paint()->PaintDC();
   ReleaseDC(hWnd, hDC);
   return SUCCESS;
}