Class TTileStorage
Unit
Declaration
type TTileStorage = class(TObject)
Description
Class that encapsulates memory and file cache of tile images. It operates 3-level in-memory cache: TBitmap
's, TPngImage
's and TMemoryStream
's. According to benchmarks, different actions take following percents of time:
Load PNG from file to memory - 30%
Read PNG from memory to image - 63% (!)
Convert PNG image to Bitmap - 6%
Drawing Bitmap to another one - 0.4%
Alas, each PNG occupies 3 GDI handles (on Windows) and each Bitmap takes about 250 kB of memory and 1 GDI handle. So we have to find balance between speed and resource consumption.
Hierarchy
- TObject
- TTileStorage
Overview
Methods
![]() |
constructor Create(CacheSize: Cardinal; const TilePathPatt: string = DefaultTilePathPatt); overload; |
![]() |
constructor Create(const CacheLimits: TCacheLimits; const TilePathPatt: string = DefaultTilePathPatt); overload; |
![]() |
destructor Destroy; override; |
![]() |
function GetTile(const Tile: TTile): TBitmap; |
![]() |
procedure StoreTile(const Tile: TTile; var Ms: TMemoryStream); |
![]() |
procedure ClearCache; |
Properties
![]() |
property Options: TTileStorageOptions read FOptions write FOptions; |
![]() |
property FileCacheBaseDir: string read FFileCacheBaseDir write SetFileCacheBaseDir; |
Description
Methods
![]() |
constructor Create(CacheSize: Cardinal; const TilePathPatt: string = DefaultTilePathPatt); overload; |
Simplified constructor. Divides memory limit equally between bitmaps, PNGs and streams. Limits number of bitmaps and PNGs by Parameters
|
![]() |
constructor Create(const CacheLimits: TCacheLimits; const TilePathPatt: string = DefaultTilePathPatt); overload; |
Constructor with detailed cache limits. Parameters
|
![]() |
destructor Destroy; override; |
This item has no description. |
![]() |
function GetTile(const Tile: TTile): TBitmap; |
Tries to get bitmap for ReturnsBitmap or |
![]() |
procedure StoreTile(const Tile: TTile; var Ms: TMemoryStream); |
Adds memory stream Parameters
Exceptions raised
|
![]() |
procedure ClearCache; |
Empty all caches |
Properties
![]() |
property Options: TTileStorageOptions read FOptions write FOptions; |
Storage options |
![]() |
property FileCacheBaseDir: string read FFileCacheBaseDir write SetFileCacheBaseDir; |
Base directory of file cache. All cached images are released on path change |
Generated by PasDoc 0.16.0.