Class · aurore
aurore::ThemeImages
On this page
#include <aurore/core/theme_image.hpp>
class aurore::ThemeImagesDescription
The one loader of theme pictures. load() hands back the image at once, still loading: it is decoded on the decode thread (Threading::asyncDecode), made smaller when larger than MAX_WIDTH x MAX_HEIGHT (its ratio kept), and its texture is made on the UI thread (aurore::sync), which draws again. A file that cannot be read is logged once and stays FAILED.
The images are shared by path and flags while someone holds them, and freed when the last holder lets go: whoever draws a theme's picture keeps the shared_ptr while that theme is in use (Application does for the background), and drops it when the theme changes.
PNG and JPEG (what stb_image decodes; not WebP). Paths are files, resources ("@res/...") or romfs files.
Static functions 8
static std::shared_ptr< ThemeImage > load( const std::string &path,int flags = 0)The image at path, made with flags (NVG_IMAGE_REPEATX...): loading, or ready when someone holds it already. From the UI thread.
static std::shared_ptr< ThemeImage > load( const std::string &path,const ThemeImageOptions &options)The same, with its size cap and mask (ThemeImageOptions): shared by path and options.
theme_image.hpp:123static Event< const ThemeImage * > * getLoadedEvent() Fired on the UI thread when an image loaded with load() is ready or failed (its texture made), before the frame that can draw it.
theme_image.hpp:129The average colour of the picture at path (opaque), for the contrast checks: remembered once known (a load() computes it on the decode thread); else decoded here, on the calling thread: not from the UI thread (a check, a test). False when the file cannot be read.
The same, only when already known: never decodes.
theme_image.hpp:142Whether there is a file at path (a resource, or a file on disk), without reading it.
How many pictures the decode thread is decoding now. A test waits for none, in real time, before it counts frames: the frames drawn while a picture decodes then do not depend on the machine's speed.
theme_image.hpp:155Deletes every texture still held, before the NVG context goes away (Application::exit): an image held afterwards is FAILED, empty.
theme_image.hpp:161Static attributes 5
Read from Aurore's headers by Doxygen at each build · library/include