#include "l_bitmap.h"
L_LTKRN_API L_INT L_GetBitmapListItem(hList, uIndex, pBitmap, uStructSize)
Gets a bitmap handle that references a bitmap in a list.
Handle to the list of bitmaps.
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.
Pointer to the bitmap handle that will reference the bitmap in the list.
Size in bytes, of the structure pointed to by pBitmap
, for versioning. Use sizeof(BITMAPHANDLE).
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The bitmap handle that this function gets is a copy of the bitmap handle stored internally in the list. If you modify the bitmap using this handle, you can update the internal bitmap handle to reflect the changes by using the L_SetBitmapListItem function.
You should not use this handle to free the bitmap. Instead, use L_DeleteBitmapListItems.
You cannot use this function to update a bitmap list while it is being used in an animation playback.
Required DLLs and Libraries
Win32, x64, Linux.
For complete sample code, refer to the CHILD.C module of the DEMO example. This example changes the hue of bitmaps in a list, then updates the paint palette and the target bitmap's palette for animation playback. When changing the hue, it preserves the transparent color.
L_INT GetBitmapListItemExample(HWND hWnd,
HBITMAPLIST hList,
LPRGBQUAD TransparentColor,
pBITMAPHANDLE pBitmap,
HPALETTE hpalPaint /* Paint palette handle */)
{
HDC hdc; /* Device context of the current window */
BITMAPHANDLE TmpBitmap; /* Temporary bitmap for manipulating the list */
L_UINT i; /* Loop counter */
L_UINT uCount; /* Number of bitmaps in the list */
L_INT nRet;
/* Change the hue of each bitmap in the list,
and restore the transparent color as the last color in the palette */
nRet = L_GetBitmapListCount(hList, &uCount);
if(nRet != SUCCESS)
return nRet;
for (i = 0; i < uCount; ++i)
{
nRet = L_GetBitmapListItem(hList, i, &TmpBitmap, sizeof(BITMAPHANDLE));
if(nRet != SUCCESS)
return nRet;
nRet = L_ChangeBitmapHue(&TmpBitmap, i * 10, 0);
if(nRet != SUCCESS)
return nRet;
if(TmpBitmap.BitsPerPixel<=8)
{
nRet = L_PutBitmapColors(&TmpBitmap, 255, 1, TransparentColor);
if(nRet != SUCCESS)
return nRet;
}
nRet = L_SetBitmapListItem(hList, i, &TmpBitmap);
if(nRet != SUCCESS)
return nRet;
}
/* Get an optimized palette for the whole list */
nRet = L_ColorResBitmapList(hList, 8,
CRF_NODITHERING|CRF_OPTIMIZEDPALETTE,
NULL, NULL, 0);
if(nRet != SUCCESS)
return nRet;
/* Update the paint palette that is used for playback */
nRet = L_GetBitmapListItem(hList, 0, &TmpBitmap, sizeof(BITMAPHANDLE));
if(nRet != SUCCESS)
return nRet;
hdc = GetDC (hWnd);
hpalPaint = L_CreatePaintPalette (hdc, &TmpBitmap);
ReleaseDC (hWnd, hdc);
/* Update the target bitmap's background color, based on the new palette */
pBitmap->Background = L_TranslateBitmapColor(&TmpBitmap, pBitmap, pBitmap->Background);
/* Copy the new palette to the target bitmap */
nRet = L_CopyBitmapPalette(pBitmap, &TmpBitmap);
return nRet;
}
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