|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Generic canvas view exposed to WASM plugins for custom UIs. More...
#include <CanvasView.h>
Public Types | |
| enum class | WidgetType : uint8_t { None = 0 , Slider = 1 , Text = 2 , Button = 3 } |
| enum class | WidgetEvent : uint8_t { Changed = 1 , Committed = 2 , Cancelled = 3 } |
| enum | : uint8_t { ANIM_REFRESH_AUTO = 0 , ANIM_REFRESH_LIGHT = 1 } |
| Animation refresh policies (mirror HOST_CANVAS_ANIM_REFRESH_*). More... | |
| using | KeyCallback = void(*)(char key, uint32_t focused_widget) |
| using | WidgetCallback = void(*)(uint32_t widget_id, WidgetEvent event) |
| using | LongPressCallback = void(*)(char key) |
| using | AnimCallback |
Public Member Functions | |
| void | init (const char *title) |
| void | setEditMutex (SemaphoreHandle_t mutex) |
| void | setKeyCallback (KeyCallback cb) |
| void | setWidgetCallback (WidgetCallback cb) |
| void | setLongPressCallback (LongPressCallback cb) |
| void | setFooter (const char *hint) |
| void | setKeyRepeat (uint16_t initial_ms, uint16_t repeat_ms) |
| void | getBodySize (uint16_t *w, uint16_t *h) const |
| void | clearBody (bool keep_sprites=false) |
| void | setTextSize (uint8_t size) |
| void | setTextInverted (bool inverted) |
| void | setFontId (uint8_t font_id) |
| Select one of the canonical font ids (see cdc_views/Fonts.h). | |
| void | setShade (uint8_t shade) |
| Fill ink for subsequent filled shapes: 0=none, 255=solid, between=dither. | |
| void | setInkWhite (bool white) |
| Draw subsequent shapes in white instead of black (eraser/wipes). | |
| void | drawText (int16_t x, int16_t y, const char *text) |
| void | drawTextAligned (int16_t x, int16_t y, int16_t w, const char *text, uint8_t align) |
| void | drawRect (int16_t x, int16_t y, int16_t w, int16_t h, bool filled) |
| void | drawPixel (int16_t x, int16_t y) |
| void | drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1) |
| void | drawCircle (int16_t x, int16_t y, int16_t r, bool filled) |
| void | drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool filled) |
| void | drawRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, bool filled) |
| void | drawBitmap (int16_t x, int16_t y, int16_t w, int16_t h, const uint8_t *data, uint32_t len) |
| void | drawHLine (int16_t x, int16_t y, int16_t w) |
| void | drawVLine (int16_t x, int16_t y, int16_t h) |
| void | commit (bool full_refresh) |
| bool | beginElem (uint32_t id) |
| void | endElem () |
| Stop tagging draw calls with an element id. | |
| bool | elemSetOffset (uint32_t id, int16_t ox, int16_t oy) |
| Set the element's replay offset relative to its recorded coordinates. | |
| bool | elemMove (uint32_t id, int16_t dx, int16_t dy) |
| Shift the element's replay offset by a delta. | |
| bool | elemShow (uint32_t id, bool visible) |
| Show or hide the element (hidden elements are skipped on replay). | |
| bool | elemRemove (uint32_t id) |
| bool | elemClear (uint32_t id) |
| bool | elemSetZ (uint32_t id, int8_t z) |
| bool | elemGetOffset (uint32_t id, int16_t *ox, int16_t *oy) const |
| Read the element's current replay offset. | |
| bool | elemGetBounds (uint32_t id, int16_t *x, int16_t *y, uint16_t *w, uint16_t *h) |
| int32_t | spriteCreate (uint16_t w, uint16_t h, uint16_t frame_count, const uint8_t *data, uint32_t len) |
| bool | spriteSetMask (uint32_t handle, const uint8_t *mask, uint32_t len) |
| bool | spriteSetFlags (uint32_t handle, uint8_t flags) |
| bool | spriteSetScale (uint32_t handle, uint8_t scale) |
| Integer upscale 1..4 applied whenever the sprite is drawn. | |
| bool | spriteSetFrame (uint32_t handle, uint16_t frame) |
| int32_t | spriteGetFrame (uint32_t handle) const |
| bool | spriteSetFrameDurations (uint32_t handle, const uint16_t *ms, uint16_t count) |
| bool | spritePlay (uint32_t handle, uint8_t mode, uint16_t frame_ms, uint16_t repeat, uint32_t done_action_id) |
| bool | spriteStop (uint32_t handle) |
| bool | spriteDestroy (uint32_t handle) |
| void | drawSprite (int16_t x, int16_t y, uint32_t handle) |
| Record a draw-by-reference of the sprite's current frame at (x, y). | |
| bool | spriteFrameView (uint32_t handle, anim::SpriteStore::FrameView *out) const |
| int32_t | marquee (int16_t x, int16_t y, int16_t window_w, const char *text, uint16_t step_px, uint16_t frame_ms) |
| uint32_t | animStart (const anim::TweenConfig &cfg) |
| uint32_t | animBlink (uint32_t elem_id, uint16_t period_ms, uint16_t count, uint32_t done_action_id) |
| bool | animCancel (uint32_t handle) |
| Handle 0 cancels all (no events). | |
| bool | animPause (uint32_t handle, bool paused) |
| int8_t | animState (uint32_t handle) const |
| uint8_t | animActiveCount () const |
| Live tweens plus playing sprites. | |
| void | setAnimCallback (AnimCallback cb) |
| bool | setAnimPolicy (uint8_t policy, uint8_t max_fps) |
| Configure refresh policy and step-rate cap (0 = default 4 fps). | |
| bool | addSlider (uint32_t id, int32_t min, int32_t max, int32_t initial, int32_t step) |
| bool | addText (uint32_t id, uint16_t max_len, const char *initial) |
| bool | addButton (uint32_t id) |
| bool | removeWidget (uint32_t id) |
| bool | setValue (uint32_t id, int32_t value) |
| bool | getValue (uint32_t id, int32_t *out) const |
| bool | setText (uint32_t id, const char *text) |
| int | getText (uint32_t id, char *out, size_t cap) const |
| bool | setFocus (uint32_t id) |
| uint32_t | getFocus () const |
| void | render (bool partial) override |
| InputResult | onKey (char key) override |
| InputResult | onLongPress (char key) override |
| void | onEnter (void *context) override |
| void | onResume () override |
| void | onPause () override |
| void | onExit () override |
| void | onTick (uint32_t nowMs) override |
| const char * | getName () const override |
| hal::RefreshMode | preferredEnterRefresh () const override |
| bool | prefersLightRefresh () const override |
| Public Member Functions inherited from cdc::ui::ViewBase | |
| virtual | ~ViewBase ()=default |
| void | onEnter (void *context) override |
| void | onExit () override |
| void | onResume () override |
| void | onPause () override |
| void | setLifecycleHooks (void(*onHide)(void *), void(*onShow)(void *), void *userData) override |
| bool | needsRender () const override |
| void | markDirty () override |
| void | clearDirty () override |
| void | setFooterHint (const char *hint) override |
| const char * | getFooterHint () const override |
| Public Member Functions inherited from cdc::ui::IView | |
| virtual | ~IView ()=default |
Static Public Attributes | |
| static constexpr uint8_t | MAX_WIDGETS = 8 |
| static constexpr uint8_t | MAX_ELEMS = 16 |
| static constexpr uint16_t | MAX_TEXT_LEN = 256 |
| static constexpr uint16_t | T9_SETTLE_MS = 800 |
| static constexpr uint16_t | MAX_CMDS = 128 |
| static constexpr uint16_t | TEXT_ARENA = 2048 |
| static constexpr uint16_t | BLOB_ARENA = 8192 |
| Pixel-data arena for recorded bitmaps. 8 KB holds one full-body mono bitmap. | |
| static constexpr uint32_t | SPRITE_ARENA = 65536 |
| Pixel arena for sprite frame sheets (lazy PSRAM allocation). | |
| static constexpr uint8_t | ANIM_FPS_DEFAULT = 4 |
| static constexpr uint8_t | ANIM_FPS_MAX = 5 |
| static constexpr uint16_t | ANIM_CLEANUP_IDLE_MS = 1000 |
| Idle time after the last animation before the AUTO ghost-cleanup FAST. | |
| static constexpr uint8_t | ANIM_HYGIENE_COMMITS = 128 |
| Endless animations get one hygiene FAST every this many anim commits. | |
Additional Inherited Members | |
| Protected Member Functions inherited from cdc::ui::ViewBase | |
| void | setTitle (const char *title) |
| const char * | getTitle () const |
| Protected Attributes inherited from cdc::ui::ViewBase | |
| bool | dirty_ = true |
| const char * | title_ = nullptr |
| const char * | customFooter_ = nullptr |
| void(* | onHide_ )(void *) = nullptr |
| void(* | onShow_ )(void *) = nullptr |
| void * | lifecycleUserData_ = nullptr |
Generic canvas view exposed to WASM plugins for custom UIs.
The plugin draws into the body area via host_view_canvas_* draw primitives. Inline widgets (slider, text-input, button) have host-owned input state while their visual representation is rendered by the plugin reading the widget value/text on each frame.
Coordinates are body-local: (0,0) is the top-left of the body area (display rows after the header up to the footer bar).
Definition at line 26 of file CanvasView.h.
Fired outside the edit mutex for every finished tween/sprite playback that carries a done-action id.
Definition at line 74 of file CanvasView.h.
| using cdc::ui::CanvasView::KeyCallback = void(*)(char key, uint32_t focused_widget) |
Definition at line 69 of file CanvasView.h.
| using cdc::ui::CanvasView::LongPressCallback = void(*)(char key) |
Definition at line 71 of file CanvasView.h.
| using cdc::ui::CanvasView::WidgetCallback = void(*)(uint32_t widget_id, WidgetEvent event) |
Definition at line 70 of file CanvasView.h.
| anonymous enum : uint8_t |
Animation refresh policies (mirror HOST_CANVAS_ANIM_REFRESH_*).
| Enumerator | |
|---|---|
| ANIM_REFRESH_AUTO | PARTIAL_LIGHT while running + FAST cleanup. |
| ANIM_REFRESH_LIGHT | PARTIAL_LIGHT always, no automatic cleanup. |
Definition at line 56 of file CanvasView.h.
|
strong |
| Enumerator | |
|---|---|
| Changed | |
| Committed | |
| Cancelled | |
Definition at line 35 of file CanvasView.h.
|
strong |
| Enumerator | |
|---|---|
| None | |
| Slider | |
| Text | |
| Button | |
Definition at line 28 of file CanvasView.h.
| bool cdc::ui::CanvasView::addButton | ( | uint32_t | id | ) |
Definition at line 1136 of file CanvasView.cpp.
References Button, and MAX_WIDGETS.
| bool cdc::ui::CanvasView::addSlider | ( | uint32_t | id, |
| int32_t | min, | ||
| int32_t | max, | ||
| int32_t | initial, | ||
| int32_t | step ) |
Definition at line 1102 of file CanvasView.cpp.
References MAX_WIDGETS, and Slider.
| bool cdc::ui::CanvasView::addText | ( | uint32_t | id, |
| uint16_t | max_len, | ||
| const char * | initial ) |
Definition at line 1118 of file CanvasView.cpp.
References MAX_TEXT_LEN, MAX_WIDGETS, and Text.
| uint8_t cdc::ui::CanvasView::animActiveCount | ( | ) | const |
Live tweens plus playing sprites.
Definition at line 1041 of file CanvasView.cpp.
| uint32_t cdc::ui::CanvasView::animBlink | ( | uint32_t | elem_id, |
| uint16_t | period_ms, | ||
| uint16_t | count, | ||
| uint32_t | done_action_id ) |
Blink an element: count on/off cycles of period_ms per phase, ending visible. Occupies one tween slot.
Definition at line 1013 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::animCancel | ( | uint32_t | handle | ) |
Handle 0 cancels all (no events).
Definition at line 1026 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::animPause | ( | uint32_t | handle, |
| bool | paused ) |
Definition at line 1031 of file CanvasView.cpp.
| uint32_t cdc::ui::CanvasView::animStart | ( | const anim::TweenConfig & | cfg | ) |
Definition at line 1001 of file CanvasView.cpp.
References cdc::ui::anim::TweenConfig::elemId, and cdc::ui::ViewBase::markDirty().
| int8_t cdc::ui::CanvasView::animState | ( | uint32_t | handle | ) | const |
anim::STATE_* or -1.
Definition at line 1036 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::beginElem | ( | uint32_t | id | ) |
Start recording subsequent draw calls under element id (creates the element on first use). Elements are named groups of draw commands that can later be moved, hidden or removed without rebuilding the whole display list — the building block for animations.
Definition at line 438 of file CanvasView.cpp.
| void cdc::ui::CanvasView::clearBody | ( | bool | keep_sprites = false | ) |
Drop the display list, elements and their tweens. With keep_sprites the sprite assets (frames, masks, flags, current frame) survive; their playback is stopped so orphans cannot keep the animation clock busy.
Definition at line 134 of file CanvasView.cpp.
References SPRITE_ARENA.
| void cdc::ui::CanvasView::commit | ( | bool | full_refresh | ) |
Definition at line 852 of file CanvasView.cpp.
References cdc::ui::ViewBase::markDirty().
| void cdc::ui::CanvasView::drawBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| const uint8_t * | data, | ||
| uint32_t | len ) |
Draw a 1-bpp bitmap (rows byte-padded, MSB first). Set bits draw black, unset bits are transparent. Pixel data is copied into the canvas arena.
Definition at line 351 of file CanvasView.cpp.
References BLOB_ARENA, LOG_W, and MAX_CMDS.
| void cdc::ui::CanvasView::drawCircle | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | r, | ||
| bool | filled ) |
Definition at line 303 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawHLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w ) |
Definition at line 376 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawLine | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | x1, | ||
| int16_t | y1 ) |
Definition at line 290 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawPixel | ( | int16_t | x, |
| int16_t | y ) |
Definition at line 279 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| bool | filled ) |
Definition at line 264 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawRoundRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| int16_t | r, | ||
| bool | filled ) |
Definition at line 335 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawSprite | ( | int16_t | x, |
| int16_t | y, | ||
| uint32_t | handle ) |
Record a draw-by-reference of the sprite's current frame at (x, y).
Definition at line 986 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawText | ( | int16_t | x, |
| int16_t | y, | ||
| const char * | text ) |
Definition at line 221 of file CanvasView.cpp.
| void cdc::ui::CanvasView::drawTextAligned | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| const char * | text, | ||
| uint8_t | align ) |
Definition at line 241 of file CanvasView.cpp.
| void cdc::ui::CanvasView::drawTriangle | ( | int16_t | x0, |
| int16_t | y0, | ||
| int16_t | x1, | ||
| int16_t | y1, | ||
| int16_t | x2, | ||
| int16_t | y2, | ||
| bool | filled ) |
Definition at line 317 of file CanvasView.cpp.
References MAX_CMDS.
| void cdc::ui::CanvasView::drawVLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | h ) |
Definition at line 388 of file CanvasView.cpp.
References MAX_CMDS.
| bool cdc::ui::CanvasView::elemClear | ( | uint32_t | id | ) |
Drop only the element's draw commands, keeping the element (offset, visibility, z, running tweens) for re-recording in place.
Definition at line 521 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemGetBounds | ( | uint32_t | id, |
| int16_t * | x, | ||
| int16_t * | y, | ||
| uint16_t * | w, | ||
| uint16_t * | h ) |
Bounding box of the element's recorded commands with its offset applied, in body-local pixels. False when unknown or empty.
Definition at line 545 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemGetOffset | ( | uint32_t | id, |
| int16_t * | ox, | ||
| int16_t * | oy ) const |
Read the element's current replay offset.
Definition at line 536 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemMove | ( | uint32_t | id, |
| int16_t | dx, | ||
| int16_t | dy ) |
Shift the element's replay offset by a delta.
Definition at line 471 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemRemove | ( | uint32_t | id | ) |
Drop the element and all its draw commands; arena space is reclaimed. Tweens bound to the element are cancelled silently.
Definition at line 503 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemSetOffset | ( | uint32_t | id, |
| int16_t | ox, | ||
| int16_t | oy ) |
Set the element's replay offset relative to its recorded coordinates.
Definition at line 462 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemSetZ | ( | uint32_t | id, |
| int8_t | z ) |
Set the element's replay layer (-128..127, default 0). Lower layers draw first; untagged commands draw in layer 0. Ties keep recording order.
Definition at line 528 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::elemShow | ( | uint32_t | id, |
| bool | visible ) |
Show or hide the element (hidden elements are skipped on replay).
Definition at line 480 of file CanvasView.cpp.
| void cdc::ui::CanvasView::endElem | ( | ) |
Stop tagging draw calls with an element id.
Definition at line 457 of file CanvasView.cpp.
| void cdc::ui::CanvasView::getBodySize | ( | uint16_t * | w, |
| uint16_t * | h ) const |
Definition at line 123 of file CanvasView.cpp.
References cdc::ui::display, and cdc::hal::getDisplayInstance().
|
inline |
Definition at line 223 of file CanvasView.h.
|
inlineoverridevirtual |
| int cdc::ui::CanvasView::getText | ( | uint32_t | id, |
| char * | out, | ||
| size_t | cap ) const |
Definition at line 1189 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::getValue | ( | uint32_t | id, |
| int32_t * | out ) const |
Definition at line 1169 of file CanvasView.cpp.
| void cdc::ui::CanvasView::init | ( | const char * | title | ) |
Definition at line 72 of file CanvasView.cpp.
References ANIM_FPS_DEFAULT, ANIM_REFRESH_AUTO, cdc::ui::ViewBase::customFooter_, cdc::ui::ViewBase::dirty_, SPRITE_ARENA, and cdc::ui::ViewBase::title_.
| int32_t cdc::ui::CanvasView::marquee | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | window_w, | ||
| const char * | text, | ||
| uint16_t | step_px, | ||
| uint16_t | frame_ms ) |
Record a host-driven text marquee: the text is rendered once into an internal sprite and a window_w-wide window scrolls through it seamlessly (content + a window-sized blank gap). Uses the current font/size. Returns the backing sprite handle (stop/destroy like any sprite) or 0/-1 like spriteCreate.
Definition at line 897 of file CanvasView.cpp.
References cdc::ui::MonoSurface::buffer(), cdc::ui::MonoSurface::byteSize(), cdc::ui::render::drawText(), cdc::ui::getGfxFont(), cdc::ui::ViewBase::markDirty(), MAX_CMDS, cdc::ui::render::measureText(), and cdc::ui::MonoSurface::ok().
|
overridevirtual |
Called when view becomes active (pushed or becomes top)
| context | Optional context data from parent |
Implements cdc::ui::IView.
Definition at line 1374 of file CanvasView.cpp.
References cdc::ui::ViewBase::onEnter().
|
overridevirtual |
Called when view is being removed from stack
Implements cdc::ui::IView.
Definition at line 1399 of file CanvasView.cpp.
References cdc::hal::IKeypad::DEFER_SRC_VIEW, cdc::hal::getKeypadInstance(), cdc::ui::ViewBase::onExit(), and SPRITE_ARENA.
|
overridevirtual |
Handle key press
| key | Key character ('0'-'9', 'Y', 'N', etc.) |
Implements cdc::ui::IView.
Definition at line 1331 of file CanvasView.cpp.
References cdc::ui::CONSUMED, cdc::ui::IGNORED, cdc::ui::KEY_NO, and cdc::ui::REQUEST_POP.
|
overridevirtual |
Handle long key press (optional)
| key | Key character |
Reimplemented from cdc::ui::IView.
Definition at line 1366 of file CanvasView.cpp.
References cdc::ui::CONSUMED, and cdc::ui::IGNORED.
|
overridevirtual |
Called when the view is covered by another view or modal (still on the stack but no longer active). Counterpart to onResume(). Default no-op.
Reimplemented from cdc::ui::IView.
Definition at line 1394 of file CanvasView.cpp.
References cdc::ui::ViewBase::onPause().
|
overridevirtual |
Called when view becomes visible again (child popped)
Implements cdc::ui::IView.
Definition at line 1379 of file CanvasView.cpp.
References cdc::ui::ViewBase::onResume().
|
overridevirtual |
Called periodically for animations/timers
| nowMs | Current time in milliseconds |
Reimplemented from cdc::ui::IView.
Definition at line 1420 of file CanvasView.cpp.
References ANIM_CLEANUP_IDLE_MS, ANIM_HYGIENE_COMMITS, ANIM_REFRESH_AUTO, cdc::hal::FAST, cdc::ui::ViewStack::forceRefresh(), cdc::ui::ViewStack::instance(), and cdc::ui::ViewBase::markDirty().
|
inlineoverridevirtual |
Plugin free-draw surfaces accumulate churn; a single-flash FAST refresh gives them a mostly clean base without the full multi-flash waveform.
Reimplemented from cdc::ui::IView.
Definition at line 237 of file CanvasView.h.
References cdc::hal::FAST.
|
inlineoverridevirtual |
While animations run, partial refreshes must not escalate to a FAST mid-motion flash; ghost hygiene is handled by the anim policy instead.
Reimplemented from cdc::ui::IView.
Definition at line 241 of file CanvasView.h.
| bool cdc::ui::CanvasView::removeWidget | ( | uint32_t | id | ) |
Definition at line 1147 of file CanvasView.cpp.
|
overridevirtual |
Render view content to display buffer
| partial | True for partial update, false for full refresh |
Implements cdc::ui::IView.
Definition at line 1477 of file CanvasView.cpp.
References cdc::ui::ViewBase::customFooter_, cdc::ui::ViewBase::dirty_, cdc::ui::display, cdc::ui::render::drawFooterBar(), cdc::ui::render::drawHeaderLeft(), cdc::hal::getDisplayInstance(), cdc::ui::ViewBase::title_, and cdc::ui::TITLE_Y.
|
inline |
Definition at line 208 of file CanvasView.h.
| bool cdc::ui::CanvasView::setAnimPolicy | ( | uint8_t | policy, |
| uint8_t | max_fps ) |
Configure refresh policy and step-rate cap (0 = default 4 fps).
Definition at line 1048 of file CanvasView.cpp.
References ANIM_FPS_DEFAULT, ANIM_FPS_MAX, and ANIM_REFRESH_LIGHT.
|
inline |
Set an optional recursive mutex serialising display-list access.
When set (non-null), the draw/element mutators and the render-time replay acquire it. A cross-task writer (plugin host calls on the plg_tick task) mutates the command list and arenas while the UI task replays them, so both sides must hold the same mutex. Null (default) disables locking entirely for single-task use.
Definition at line 88 of file CanvasView.h.
References mutex.
| bool cdc::ui::CanvasView::setFocus | ( | uint32_t | id | ) |
Definition at line 1198 of file CanvasView.cpp.
|
inline |
Select one of the canonical font ids (see cdc_views/Fonts.h).
Definition at line 106 of file CanvasView.h.
| void cdc::ui::CanvasView::setFooter | ( | const char * | hint | ) |
Definition at line 112 of file CanvasView.cpp.
References cdc::ui::ViewBase::customFooter_.
|
inline |
Draw subsequent shapes in white instead of black (eraser/wipes).
Definition at line 110 of file CanvasView.h.
|
inline |
Definition at line 90 of file CanvasView.h.
| void cdc::ui::CanvasView::setKeyRepeat | ( | uint16_t | initial_ms, |
| uint16_t | repeat_ms ) |
Definition at line 117 of file CanvasView.cpp.
| void cdc::ui::CanvasView::setLongPressCallback | ( | LongPressCallback | cb | ) |
Register a plugin long-press handler. Setting a non-null callback opts this canvas into deferred short-press keypad mode while it is active.
Definition at line 1361 of file CanvasView.cpp.
|
inline |
Fill ink for subsequent filled shapes: 0=none, 255=solid, between=dither.
Definition at line 108 of file CanvasView.h.
| bool cdc::ui::CanvasView::setText | ( | uint32_t | id, |
| const char * | text ) |
Definition at line 1176 of file CanvasView.cpp.
References Text.
|
inline |
Definition at line 104 of file CanvasView.h.
|
inline |
Definition at line 103 of file CanvasView.h.
| bool cdc::ui::CanvasView::setValue | ( | uint32_t | id, |
| int32_t | value ) |
Definition at line 1162 of file CanvasView.cpp.
References Slider.
|
inline |
Definition at line 91 of file CanvasView.h.
| int32_t cdc::ui::CanvasView::spriteCreate | ( | uint16_t | w, |
| uint16_t | h, | ||
| uint16_t | frame_count, | ||
| const uint8_t * | data, | ||
| uint32_t | len ) |
Copy a vertically stacked frame sheet into the sprite arena.
Definition at line 872 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::spriteDestroy | ( | uint32_t | handle | ) |
Destroy the sprite; recorded draw-sprite commands referencing it are skipped on replay from then on.
Definition at line 975 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::spriteFrameView | ( | uint32_t | handle, |
| anim::SpriteStore::FrameView * | out ) const |
Snapshot the sprite's current frame pixels (for stamping onto surfaces). Pointers stay valid until the next sprite mutation.
Definition at line 980 of file CanvasView.cpp.
| int32_t cdc::ui::CanvasView::spriteGetFrame | ( | uint32_t | handle | ) | const |
Definition at line 947 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::spritePlay | ( | uint32_t | handle, |
| uint8_t | mode, | ||
| uint16_t | frame_ms, | ||
| uint16_t | repeat, | ||
| uint32_t | done_action_id ) |
Definition at line 958 of file CanvasView.cpp.
References cdc::ui::ViewBase::markDirty().
| bool cdc::ui::CanvasView::spriteSetFlags | ( | uint32_t | handle, |
| uint8_t | flags ) |
Definition at line 884 of file CanvasView.cpp.
References flags.
| bool cdc::ui::CanvasView::spriteSetFrame | ( | uint32_t | handle, |
| uint16_t | frame ) |
Definition at line 942 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::spriteSetFrameDurations | ( | uint32_t | handle, |
| const uint16_t * | ms, | ||
| uint16_t | count ) |
Definition at line 952 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::spriteSetMask | ( | uint32_t | handle, |
| const uint8_t * | mask, | ||
| uint32_t | len ) |
Definition at line 879 of file CanvasView.cpp.
| bool cdc::ui::CanvasView::spriteSetScale | ( | uint32_t | handle, |
| uint8_t | scale ) |
Integer upscale 1..4 applied whenever the sprite is drawn.
Definition at line 889 of file CanvasView.cpp.
References cdc::ui::scale.
| bool cdc::ui::CanvasView::spriteStop | ( | uint32_t | handle | ) |
Definition at line 970 of file CanvasView.cpp.
|
staticconstexpr |
Idle time after the last animation before the AUTO ghost-cleanup FAST.
Definition at line 65 of file CanvasView.h.
Referenced by onTick().
|
staticconstexpr |
Animation step-rate cap. The partial waveform (~200-300 ms) bounds the panel to ~5 Hz; anything above just burns replay CPU.
Definition at line 62 of file CanvasView.h.
Referenced by init(), and setAnimPolicy().
|
staticconstexpr |
Definition at line 63 of file CanvasView.h.
Referenced by setAnimPolicy().
|
staticconstexpr |
Endless animations get one hygiene FAST every this many anim commits.
Definition at line 67 of file CanvasView.h.
Referenced by onTick().
|
staticconstexpr |
Pixel-data arena for recorded bitmaps. 8 KB holds one full-body mono bitmap.
Definition at line 51 of file CanvasView.h.
Referenced by drawBitmap().
|
staticconstexpr |
Retained display list: draw primitives are recorded here and replayed in render() after the framework clears the screen. Arenas are PSRAM-backed.
Definition at line 48 of file CanvasView.h.
Referenced by drawBitmap(), drawCircle(), drawHLine(), drawLine(), drawPixel(), drawRect(), drawRoundRect(), drawSprite(), drawText(), drawTextAligned(), drawTriangle(), drawVLine(), and marquee().
|
staticconstexpr |
Definition at line 42 of file CanvasView.h.
Referenced by beginElem().
|
staticconstexpr |
Definition at line 43 of file CanvasView.h.
Referenced by addText().
|
staticconstexpr |
Definition at line 41 of file CanvasView.h.
Referenced by addButton(), addSlider(), and addText().
|
staticconstexpr |
Pixel arena for sprite frame sheets (lazy PSRAM allocation).
Definition at line 53 of file CanvasView.h.
Referenced by clearBody(), init(), and onExit().
|
staticconstexpr |
Definition at line 44 of file CanvasView.h.
|
staticconstexpr |
Definition at line 49 of file CanvasView.h.