|
Aurore
A Switch-like interface for your app, on every screen
|
#include <aurore/core/theme_image.hpp>
Static Public Member Functions | |
| static std::shared_ptr< ThemeImage > | load (const std::string &path, int flags=0) |
| static std::shared_ptr< ThemeImage > | load (const std::string &path, const ThemeImageOptions &options) |
| static Event< const ThemeImage * > * | getLoadedEvent () |
| static bool | meanColor (const std::string &path, NVGcolor *color) |
| static bool | knownMeanColor (const std::string &path, NVGcolor *color) |
| static bool | exists (const std::string &path) |
| static int | decoding () |
| static void | releaseAll () |
Static Public Attributes | |
| static constexpr int | MAX_WIDTH = 1920 |
| static constexpr int | MAX_HEIGHT = 1080 |
| static constexpr int | LOGO_SIZE = 256 |
| static constexpr int | ICON_SIZE = 128 |
| static constexpr int | PREVIEW_SIZE = 128 |
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 |
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.
|
static |
Whether there is a file at path (a resource, or a file on disk), without reading it.
|
static |
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.
|
static |
The same, only when already known: never decodes.
|
static |
The same, with its size cap and mask (ThemeImageOptions): shared by path and options.
|
static |
The image at path, made with flags (NVG_IMAGE_REPEATX...): loading, or ready when someone holds it already. From the UI thread.
|
static |
The 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.
|
static |
Deletes every texture still held, before the NVG context goes away (Application::exit): an image held afterwards is FAILED, empty.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |