The 16 colours the framebuffer's indices stand for, and a fade applied on top of them.
More...
|
| void | gfx_setPalette (const uint16_t *rgb565, uint8_t count) |
| | Sets the first count palette entries.
|
| |
| void | gfx_setPaletteEntry (uint8_t index, uint16_t rgb565) |
| | Sets one palette entry.
|
| |
| void | gfx_setFade (uint8_t amount, uint16_t rgb565=0x0000) |
| | Fades every colour toward one colour (black by default).
|
| |
| uint8_t | gfx_fade (void) |
| | The current fade amount.
|
| |
| uint16_t | gfx_paletteOut (uint8_t index) |
| | The colour a palette index actually reaches the panel as, fade included.
|
| |
| static uint16_t | gfx_rgb (uint8_t r, uint8_t g, uint8_t b) |
| | Packs an 8-bit-per-channel colour into RGB565.
|
| |
| uint8_t | gfx_nearest (uint16_t rgb565) |
| | Nearest palette index for a full RGB565 colour.
|
| |
|
| uint16_t | gfx_pal [16] |
| | The 16 palette colours as set, in RGB565.
|
| |
The 16 colours the framebuffer's indices stand for, and a fade applied on top of them.
Palette changes are STAGED: they take effect when the next flush starts, never part-way through one in flight, so these are safe to call at any time - including between gfx_flushAsync() and gfx_wait(). Every frame is re-sent through the palette, so animating it (cycling a slot, pulsing a highlight, a fade) costs a 256-entry table rebuild per frame and no drawing at all.
◆ gfx_setPalette()
| void gfx_setPalette |
( |
const uint16_t * |
rgb565, |
|
|
uint8_t |
count |
|
) |
| |
Sets the first count palette entries.
- Parameters
-
| rgb565 | The colours, in RGB565 (see gfx_rgb()). Passing gfx_pal itself just re-stages the palette. |
| count | How many entries to set, from index 0; at most 16 are used. |
◆ gfx_setPaletteEntry()
| void gfx_setPaletteEntry |
( |
uint8_t |
index, |
|
|
uint16_t |
rgb565 |
|
) |
| |
Sets one palette entry.
- Parameters
-
| index | Palette index, 0..15 (only the low 4 bits are used). |
| rgb565 | The colour, in RGB565. |
◆ gfx_setFade()
| void gfx_setFade |
( |
uint8_t |
amount, |
|
|
uint16_t |
rgb565 = 0x0000 |
|
) |
| |
Fades every colour toward one colour (black by default).
Applied while the expansion table is built, so gfx_pal[] keeps the true colours and gfx_nearest() still matches against them. Staged like the palette.
- Parameters
-
| amount | 0 = the palette as set, 255 = solid rgb565. |
| rgb565 | The colour faded toward, in RGB565 (default black). |
◆ gfx_fade()
| uint8_t gfx_fade |
( |
void |
| ) |
|
The current fade amount.
- Returns
- 0 (no fade) to 255 (every colour is the fade colour).
◆ gfx_paletteOut()
| uint16_t gfx_paletteOut |
( |
uint8_t |
index | ) |
|
The colour a palette index actually reaches the panel as, fade included.
- Parameters
-
| index | Palette index, 0..15. |
- Returns
- The colour in RGB565.
◆ gfx_rgb()
| static uint16_t gfx_rgb |
( |
uint8_t |
r, |
|
|
uint8_t |
g, |
|
|
uint8_t |
b |
|
) |
| |
|
inlinestatic |
Packs an 8-bit-per-channel colour into RGB565.
- Parameters
-
| r | Red, 0..255 (the top 5 bits are kept). |
| g | Green, 0..255 (the top 6 bits are kept). |
| b | Blue, 0..255 (the top 5 bits are kept). |
- Returns
- The colour in RGB565, for gfx_setPalette() and the like.
◆ gfx_nearest()
| uint8_t gfx_nearest |
( |
uint16_t |
rgb565 | ) |
|
Nearest palette index for a full RGB565 colour.
Linear search over 16 entries, by weighted distance, against the palette as set (not as faded) - fine at setup time to build named constants, far too slow to call per pixel.
- Parameters
-
| rgb565 | The colour, in RGB565. |
- Returns
- The palette index, 0..15, closest to it.
◆ gfx_pal