LBitmapList::GetFirstItem

Summary

Gets the first item of the bitmap list object.

Syntax

#include "ltwrappr.h"

L_INT LBitmapList::GetFirstItem(pLBitmap)

Parameters

LBitmapBase * pLBitmap

Pointer to an allocated bitmap object that will receive the first item of the bitmap list.

Returns

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

Comments

This function updates the current index to the first item in the list.

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.

In order to use this function, you must first allocate an LBitmapBase object (or an object derived from LBitmapBase). Pass the address of the LBitmapBase object, and it will be filled with the item from the bitmap list.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmapList__GetFirstItemExample(HWND hWnd) 
{ 
   L_INT nRet; 
   LBitmapList BitmapList; 
   LBitmapBase Bitmap, PaintBitmap; 
   HDC hDC; 
   RECT rcClientRect; 
 
   // 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.Create (); 
   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; 
   nRet =BitmapList.InsertItem (&Bitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   // Set the DC and the Destination rectangle 
   GetClientRect(hWnd, &rcClientRect); 
   hDC = GetDC(hWnd); 
   PaintBitmap.Paint()->SetDC(hDC); 
   PaintBitmap.SetDstRect(&rcClientRect); 
 
   // Get first item in the list 
   BitmapList.GetFirstItem(&PaintBitmap); 
   PaintBitmap.Paint()->PaintDC(); 
   MessageBox(hWnd, TEXT("This is the first image in list.\nPress OK to display next item in List"), TEXT("LBitmapList"), MB_OK); 
   // Get next item in the list 
   nRet =BitmapList.GetNextItem (&PaintBitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   PaintBitmap.Paint()->PaintDC(); 
   MessageBox(hWnd, TEXT("This is the first image in list.\nPress OK to display last item in List"), TEXT("LBitmapList"), MB_OK); 
   // Get last item in the list 
   nRet =BitmapList.GetLastItem (&PaintBitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   PaintBitmap.Paint()->PaintDC(); 
   MessageBox(hWnd, TEXT("This is the last image in list.\nPress OK to display previous item in List"), TEXT("LBitmapList"), MB_OK); 
   // Get previous item in the list 
   nRet =BitmapList.GetPreviousItem (&PaintBitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   PaintBitmap.Paint()->PaintDC(); 
   // destroy the list 
   BitmapList.Destroy (); 
   ReleaseDC(hWnd, hDC); 
 
   return SUCCESS; 
} 
Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

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