SavvyUI C++ UI Library
Loading...
Searching...
No Matches
ImageCache Class Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ ImageCache()

ImageCache::ImageCache ( )

Constructs an empty ImageCache.

◆ ~ImageCache()

virtual ImageCache::~ImageCache ( )
virtual

Destructor clears and releases all cached images.

Member Function Documentation

◆ addImage()

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.

Parameters
keyThe string key to identify the cached image.
filePathThe file path of the image to load.
Returns
TRUE if the image was loaded and cached successfully, FALSE otherwise.

◆ clear()

void ImageCache::clear ( )

Clears all cached images, releasing their memory.

◆ drawImage()

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.

Parameters
hDCHandle to the device context where the image will be drawn.
keyThe key identifying the cached image.
rectThe target rectangle for drawing the image.
alignmentAlignment of the image within the rectangle (e.g., "topLeft", "middleCenter").
showBorderIf TRUE, draws a border around the image.
Returns
TRUE if the image was found and drawn successfully, FALSE otherwise.

The documentation for this class was generated from the following file: