#include "ltwrappr.h"
L_INT LBitmapList::GetFirstItem(pLBitmap)
LBitmapBase * pLBitmap; |
pointer to an LBitmapBase object |
Gets the first item of the bitmap list object.
Parameter |
Description |
pLBitmap |
Pointer to an allocated bitmap object that will receive the first item of the bitmap list. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
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
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. |
Win32, x64.
Functions: |
|
Topics: |
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
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;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET