LMemoryFile::GetBitmapMemoryInfo

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

pBITMAPHANDLE pBitmap;

pointer to a bitmap handle

LBitmapBase *plBitmap;

pointer to a bitmap class object

L_UINT * puMemory;

pointer to the variable to be updated with the memory type

L_SSIZE_T * puTileSize;

pointer to the variable to be updated with the tile size

L_UINT * puTotalTiles;

pointer to the variable to be updated with the number of tiles in the image

L_UINT * puConvTiles;

pointer to a variable to be updated with the number of tiles present in conventional memory

L_UINT * puMaxTileViews;

pointer to a variable to be updated with the maximum number of tiles which will be accessible at one time

L_UINT * puTileViews;

pointer to the current number of tiles which can be accessible at one time

Gets information about a bitmaps memory allocation.

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

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

LTFIL
File format DLLs

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LFileSettings::SetTempDirectory, LFileSettings::GetTempDirectory, Class Members

Topics:

Memory Storage Types for Bitmaps

 

Raster Image Functions: Creating and Deleting Images

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 20.0.2020.4.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help