A small load-once icon store keyed by resource id, shared across a face so each icon picture loads a single time and frees in one place. Alongside it sits the palette tint and an optional auto-trim that measures each icon's transparent border so a caller can pin the visible art instead of the padded bitmap box. More...
#include <pebble.h>Go to the source code of this file.
Data Structures | |
| struct | IconMargins |
| The transparent border around an icon's opaque art, in pixels per side. More... | |
Macros | |
| #define | ICON_AUTOTRIM 1 |
| #define | ICON_TRIM_LOG 0 |
Functions | |
| GBitmap * | icon_get (uint32_t res) |
| Hands back an icon picture from the cache, loading it the first time it is asked for. | |
| GSize | icon_size (uint32_t res) |
| The size of an icon in pixels. Gives back GSize(0,0) if it could not load. | |
| IconMargins | icon_margins (uint32_t res) |
| The measured transparent margins of a cached icon. Loads and measures it the first time, then returns the cached numbers. All zero when auto-trim is off or the icon could not load. | |
| IconMargins | icon_margins_of (GBitmap *bmp) |
| Measures the transparent margins of any bitmap, for icons that live outside the shared cache such as a weather picture that reloads as the weather changes. All zero when auto-trim is off or the bitmap is NULL. | |
| void | icon_tint (GBitmap *bmp, GColor color) |
| Paints an icon a different colour. It only works on icons saved as little colour-table pictures. Other kinds it just leaves alone. The see-through pixels stay see-through so the edges keep looking clean. | |
| void | icon_align_trim (GAlign align, IconMargins margins, int *trim_dx, int *trim_dy) |
| The extra offset that pins the opaque box rather than the full bitmap at a given anchor. A right or bottom edge kills the trailing margin. A left or top edge kills the leading one. A centred axis splits the difference so the visible art centres. | |
| void | icons_cleanup (void) |
| Frees every icon picture in the cache. | |
A small load-once icon store keyed by resource id, shared across a face so each icon picture loads a single time and frees in one place. Alongside it sits the palette tint and an optional auto-trim that measures each icon's transparent border so a caller can pin the visible art instead of the padded bitmap box.