L_GetBitmapMemoryInfo

#include "l_bitmap.h"

L_LTKRN_API L_INT L_GetBitmapMemoryInfo(pBitmap, puMemory, puTileSize, puTotalTiles, puConvTiles, puMaxTileViews, puTileViews);

Gets information about a bitmaps memory allocation.

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.

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 or 1-bit Fax G4). The other parameters will be ignored.
TYPE_TILED The bitmap is tiles 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.

Comments

You can pass NULL for all parameters except pBitmap and puMemory if you are not interested in some parameters.

This function is used for informational purposes. You can use L_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).

Returns

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

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

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 GetBitmapMemoryInfoExample(pBITMAPHANDLE Bitmap) 
{ 
   L_INT nRet; 
   L_UINT       uMemoryType;  
   L_UINT       uMaxTileViews;  
   L_UINT       uTotalTiles;  
   L_UINT       uConvTiles;  
   L_UINT       uTileViews;  
   //BITMAPHANDLE Bitmap; 
 
 
   nRet = L_GetBitmapMemoryInfo(Bitmap, &uMemoryType, NULL, &uTotalTiles, &uConvTiles, &uMaxTileViews, &uTileViews);  
   if(nRet != SUCCESS) 
      return nRet; 
 
   if(uMemoryType == TYPE_TILED)  
   { 
      uMaxTileViews = min(uTileViews * 2, uTotalTiles - uConvTiles); 
      nRet = L_SetBitmapMemoryInfo (Bitmap, 0, 0, 0, 0, uMaxTileViews, 0, SETMEM_MAXTILEVIEWS);  
      if(nRet != SUCCESS) 
         return nRet; 
 
      nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), Bitmap, FILE_BMP, 24, 0, NULL); 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
   return SUCCESS; 
} 

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help