Gets information about a bitmaps memory allocation.
#include "ltwrappr.h"
static L_INT LMemoryFile::GetBitmapMemoryInfo(pBitmap, puMemory, puTileSize, puTotalTiles, puConvTiles, puMaxTileViews, puTileViews)
static L_INT LMemoryFile::GetBitmapMemoryInfo(plBitmap, puMemory, puTileSize, puTotalTiles, puConvTiles, puMaxTileViews, puTileViews)
Pointer to the BITMAPHANDLE that references the bitmap for which to get the memory information. This bitmap must be allocated and this pointer cannot be NULL.
Pointer to the LBitmapBase object that references the bitmap for which to get the memory information. This bitmap must be allocated and this pointer cannot be NULL.
Pointer to a variable to be updated with the memory type. Possible values are:
Value | Meaning |
---|---|
TYPE_CONV | The bitmap is allocated in conventional memory. The other parameters will be ignored. |
TYPE_DISK | The bitmap is allocated entirely on disk. The other parameters will be ignored. |
TYPE_COMPRESSED | The bitmap is allocated in conventional memory and it is using run-length 1-bit compression. The other parameters will be ignored. |
TYPE_SUPERCOMPRESSED | The bitmap is allocated in conventional memory and is using SuperCompression (JPEG24-bit, 8-bit, or 1-bit Fax G4). The other parameters will be ignored. |
TYPE_TILED | The bitmap is tiled and can contain a combination of conventional tiles and disk tiles. The other parameters will be updated with information about the tiles. |
Pointer to a variable to be updated with the tile size. Each tile will contain a full number of rows. You can obtain the number of rows in each tile by dividing the tile size by pBitmap->BytesPerLine. All the tiles in the bitmap (except the last tile) will have the same size. The last tile contains the leftover rows. The size of the last tile can be calculated using the following formula:
pBitmap->Size (*puTotalTiles 1) * *puTileSize
Pass NULL if you do not wish to get this information.
Pointer to a variable to be updated with the total number of tiles. Pass NULL if you do not wish to get this information.
Pointer to a variable to be updated with the number of tiles stored in conventional memory. Pass NULL if you do not wish to get this information.
Pointer to a variable to be updated with the maximum number of tile views. The tile views are used to cache the disk access. Pass NULL if you do not wish to get this information.
Pointer to a variable to be updated with the number of cache views currently allocated. Pass NULL if you do not wish to get this information.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
You can pass NULL for all parameters except pBitmap/plBitmap and puMemory if you are not interested in some parameters.
This function is used for informational purposes. You can use LMemoryFile::SetBitmapMemoryInfo to change one of more of these parameters. For example, you might increase or decrease the maximum number of tile views at one time (to increase the access time for this bitmap).
Tiled bitmaps are allocated when there is not enough conventional memory to allocate the whole bitmap in conventional memory in one big contiguous chunk. This is often the case for huge bitmaps (500MB or above).
Win32, x64.
Double the maximum number of disk tile views. But does not allow the maximum number of tile views to exceed the number of disk tiles. The toolkit will also automatically do that, but we will do this here so you see how to calculate the number of disk tiles.
L_INT LMemoryFile__GetBitmapMemoryInfoExample(LBitmapBase* pLeadBitmap)
{
L_INT nRet;
L_UINT uMemoryType;
L_UINT uMaxTileViews;
L_UINT uTotalTiles;
L_UINT uConvTiles;
L_UINT uTileViews = 0;
nRet = LMemoryFile::GetBitmapMemoryInfo(pLeadBitmap, &uMemoryType, NULL, &uTotalTiles, &uConvTiles, &uMaxTileViews, NULL);
if(nRet != SUCCESS)
return nRet;
if(uMemoryType == TYPE_TILED)
{
uMaxTileViews = min(uTileViews * 2, uTotalTiles - uConvTiles);
nRet = LMemoryFile::SetBitmapMemoryInfo(pLeadBitmap, 0, 0, 0, 0, uMaxTileViews, 0, SETMEM_MAXTILEVIEWS);
if(nRet != SUCCESS)
return nRet;
}
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