LMemoryFile::GetBitmapMemoryInfo

Summary

Gets information about a bitmaps memory allocation.

Syntax

#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)

Parameters

pBITMAPHANDLE pBitmap

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.

LBitmapBase *plBitmap

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.

L_UINT * puMemory

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.

L_SSIZE_T * puTileSize

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.

L_UINT * puTotalTiles

Pointer to a variable to be updated with the total number of tiles. Pass NULL if you do not wish to get this information.

L_UINT * puConvTiles

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.

L_UINT * puMaxTileViews

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.

L_UINT * puTileViews

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.

Returns

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

Comments

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).

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

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 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.