L_INT LBitmapList::GetFirstItem(pLBitmap)
Gets the first item of the bitmap list object.
Pointer to an allocated bitmap object that will receive the first item of the bitmap list.
Value | Meaning |
---|---|
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.
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document