L_GetBitmapMemoryInfo
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_GetBitmapMemoryInfo(pBitmap, puMemoryType, puTileSize, puTotalTiles, puConvTiles, puMaxTileViews, puTileViews);
pBITMAPHANDLE pBitmap; |
/* pointer to a bitmap handle */ |
/* pointer to the variable to be updated with the memory type */ | |
/* pointer to the variable to be updated with the tile size */ | |
/* pointer to the variable to be updated with the number of tiles in the image */ | |
/* pointer to a variable to be updated with the number of tiles present in conventional memory */ | |
/* pointer to a variable to be updated with the maximum number of tiles which will be accessible at one time */ | |
/* pointer to the current number of tiles which can be accessible at one time */ |
Gets information about a bitmap’s 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. |
|
puMemoryType |
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. |
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. |
Comments
You can pass NULL for all parameters except pBitmap and puMemoryType 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
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTKRN 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
Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.
See Also
Functions: |
L_SetMemoryThresholds, L_GetMemoryThresholds, L_SetBitmapMemoryInfo, L_SetTempDirectory, L_GetTempDirectory |
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_UINT uMemoryType;
L_UINT uMaxTileViews;
L_UINT uTotalTiles;
L_UINT uConvTiles;
L_UINT uTileViews;
BITMAPHANDLE Bitmap;
L_GetBitmapMemoryInfo(&Bitmap, &uMemoryType, NULL, &uTotalTiles, &uConvTiles, &uMaxTileViews, uTileViews);
if(uMemoryType == TYPE_TILED)
{
uMaxTileViews = min(uTileViews * 2, uTotalTiles – uConvTiles);
L_SetBitmapMemoryInfo (&Bitmap, 0, 0, 0, 0, uMaxTileViews, 0, SETMEM_MAXTILEVIEWS);
}