SavvyUI C++ UI Library
|
Manages caching of GDI+ images to improve rendering performance. More...
#include <ImageCache.h>
Public Member Functions | |
ImageCache () | |
Constructs an empty ImageCache. | |
virtual | ~ImageCache () |
Destructor clears and releases all cached images. | |
void | clear () |
Clears all cached images, releasing their memory. | |
BOOL | addImage (const wstring &key, const wstring &filePath) |
Loads an image from a file and adds it to the cache with the specified key. | |
BOOL | drawImage (Graphics *g, const wstring &key, Bounds rect, const ImageAlignment &alignment, BOOL showBorder) |
Draws a cached image identified by key onto a device context. |
Manages caching of GDI+ images to improve rendering performance.
This class stores images keyed by a string, loads images from files, and draws cached images to device contexts with specified alignment and optional border.
ImageCache::ImageCache | ( | ) |
Constructs an empty ImageCache.
|
virtual |
Destructor clears and releases all cached images.
BOOL ImageCache::addImage | ( | const wstring & | key, |
const wstring & | filePath ) |
Loads an image from a file and adds it to the cache with the specified key.
key | The string key to identify the cached image. |
filePath | The file path of the image to load. |
void ImageCache::clear | ( | ) |
Clears all cached images, releasing their memory.
BOOL ImageCache::drawImage | ( | Graphics * | g, |
const wstring & | key, | ||
Bounds | rect, | ||
const ImageAlignment & | alignment, | ||
BOOL | showBorder ) |
Draws a cached image identified by key onto a device context.
hDC | Handle to the device context where the image will be drawn. |
key | The key identifying the cached image. |
rect | The target rectangle for drawing the image. |
alignment | Alignment of the image within the rectangle (e.g., "topLeft", "middleCenter"). |
showBorder | If TRUE, draws a border around the image. |