# pupariaa/lucarne architecture

> Architecture diagram of the GitHub repository pupariaa/lucarne, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pupariaa/lucarne
- Repository: https://github.com/pupariaa/lucarne

## Overview

Lucarne is an embedded UI toolkit for Arduino and ESP32 SPI displays. The main device workflow is to initialize a display, compose screens from widgets, supply data and input, then render through the graphics and panel-driver layers. The README also documents a browser Studio for designing, simulating, and exporting C++, plus USB Live Preview. Studio is not present in the supplied source tree; its node and links are based on README statements. Other links rely on the README or SOURCE INDEX references, not inspection of unsampled implementations.

Main entry points: [`src/ui/LucarneUI.cpp`](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneUI.cpp) (UI runtime), [`src/display/LucarneDisplay.cpp`](https://github.com/pupariaa/lucarne/blob/main/src/display/LucarneDisplay.cpp) (Display API), [`src/ui/LucarneScreen.cpp`](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneScreen.cpp) (Screens and transitions), [`src/ui/LucarneWidget.cpp`](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneWidget.cpp) (Widgets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_display["Display and graphics"]
  node_display_api["Display API<br/>[LucarneDisplay.cpp]"]
  node_panel_drivers["ST77xx drivers<br/>[LucarneST77xx.h]"]
  node_gfx["Graphics primitives<br/>[LucarneGfx.cpp]"]
  node_fonts["Fonts and text"]
end

subgraph group_runtime["UI runtime"]
  node_ui_runtime["UI runtime<br/>[LucarneUI.cpp]"]
  node_screens["Screens and transitions<br/>[LucarneScreen.cpp]"]
  node_widgets["Widgets<br/>[LucarneWidget.cpp]"]
  node_menus["Menus<br/>[LucarneMenu.cpp]"]
  node_buttons["Buttons<br/>[LucarneButton.cpp]"]
  node_data_store[("Data binding<br/>[LucarneStore.cpp]")]
  node_theme["Theme<br/>[LucarneTheme.h]"]
end

subgraph group_assets["Assets and input"]
  node_input["Physical input<br/>[LucarneInput.cpp]"]
  node_image_loader["Image loading"]
  node_image_assets["Image assets"]
  node_icon_render["Icon rendering"]
  node_icon_animation["Animated icons<br/>[LucarneIconAnim.h]"]
end

subgraph group_authoring["Authoring and preview"]
  node_studio["Lucarne Studio"]
  node_live_preview["Live Preview"]
  node_usb_host(("Studio USB host"))
end

node_developer(("Application developer"))

node_developer -->|"initializes"| node_display_api
node_developer -->|"composes UI"| node_ui_runtime
node_ui_runtime -.->|"renders through"| node_display_api
node_display_api -->|"extends"| node_gfx
node_display_api -->|"uses panel layer"| node_panel_drivers
node_gfx -->|"draws text"| node_fonts
node_ui_runtime -->|"manages screens"| node_screens
node_ui_runtime -->|"binds data"| node_data_store
node_ui_runtime -->|"applies theme"| node_theme
node_screens -->|"contains widgets"| node_widgets
node_screens -.->|"routes menu selection"| node_menus
node_ui_runtime -->|"handles input"| node_input
node_widgets -->|"loads images"| node_image_loader
node_image_loader -->|"reads assets"| node_image_assets
node_widgets -->|"draws icons"| node_icon_render
node_icon_render -->|"renders animation"| node_icon_animation
node_developer -->|"designs and exports"| node_studio
node_studio -->|"streams preview"| node_live_preview
node_usb_host -->|"sends frames"| node_live_preview
node_live_preview -->|"blits frames"| node_display_api

click node_display_api "https://github.com/pupariaa/lucarne/blob/main/src/display/LucarneDisplay.cpp"
click node_panel_drivers "https://github.com/pupariaa/lucarne/blob/main/src/display/LucarneST77xx.h"
click node_gfx "https://github.com/pupariaa/lucarne/blob/main/src/core/LucarneGfx.cpp"
click node_fonts "https://github.com/pupariaa/lucarne/blob/main/src/core/LucarneClassicFont.cpp"
click node_ui_runtime "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneUI.cpp"
click node_screens "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneScreen.cpp"
click node_widgets "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneWidget.cpp"
click node_menus "https://github.com/pupariaa/lucarne/blob/main/src/ui/widgets/LucarneMenu.cpp"
click node_buttons "https://github.com/pupariaa/lucarne/blob/main/src/ui/widgets/LucarneButton.cpp"
click node_data_store "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneStore.cpp"
click node_theme "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneTheme.h"
click node_input "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneInput.cpp"
click node_image_loader "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneImageLoader.cpp"
click node_image_assets "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneImageAsset.h"
click node_icon_render "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneIconDraw.cpp"
click node_icon_animation "https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneIconAnim.h"
click node_live_preview "https://github.com/pupariaa/lucarne/blob/main/src/tools/LucarneLivePreview.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_display_api,node_panel_drivers,node_gfx,node_fonts toneBlue
class node_ui_runtime,node_screens,node_widgets,node_menus,node_buttons,node_data_store,node_theme toneAmber
class node_input,node_image_loader,node_image_assets,node_icon_render,node_icon_animation toneMint
class node_studio,node_live_preview,node_usb_host toneRose
class node_developer toneIndigo
```

## Components

### Display and graphics

- [Display API](https://github.com/pupariaa/lucarne/blob/main/src/display/LucarneDisplay.cpp): `src/display/LucarneDisplay.cpp`
- [ST77xx drivers](https://github.com/pupariaa/lucarne/blob/main/src/display/LucarneST77xx.h): `src/display/LucarneST77xx.h`
- [Graphics primitives](https://github.com/pupariaa/lucarne/blob/main/src/core/LucarneGfx.cpp): `src/core/LucarneGfx.cpp`
- [Fonts and text](https://github.com/pupariaa/lucarne/blob/main/src/core/LucarneClassicFont.cpp): `src/core/LucarneClassicFont.cpp`

### UI runtime

- [UI runtime](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneUI.cpp): `src/ui/LucarneUI.cpp`
- [Screens and transitions](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneScreen.cpp): `src/ui/LucarneScreen.cpp`
- [Widgets](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneWidget.cpp): `src/ui/LucarneWidget.cpp`
- [Menus](https://github.com/pupariaa/lucarne/blob/main/src/ui/widgets/LucarneMenu.cpp): `src/ui/widgets/LucarneMenu.cpp`
- [Buttons](https://github.com/pupariaa/lucarne/blob/main/src/ui/widgets/LucarneButton.cpp): `src/ui/widgets/LucarneButton.cpp`
- [Data binding](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneStore.cpp): `src/ui/LucarneStore.cpp`
- [Theme](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneTheme.h): `src/ui/LucarneTheme.h`

### Assets and input

- [Physical input](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneInput.cpp): `src/ui/LucarneInput.cpp`
- [Image loading](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneImageLoader.cpp): `src/ui/LucarneImageLoader.cpp`
- [Image assets](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneImageAsset.h): `src/ui/LucarneImageAsset.h`
- [Icon rendering](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneIconDraw.cpp): `src/ui/LucarneIconDraw.cpp`
- [Animated icons](https://github.com/pupariaa/lucarne/blob/main/src/ui/LucarneIconAnim.h): `src/ui/LucarneIconAnim.h`

### Authoring and preview

- **Lucarne Studio**
- [Live Preview](https://github.com/pupariaa/lucarne/blob/main/src/tools/LucarneLivePreview.h): `src/tools/LucarneLivePreview.h`
- **Studio USB host**

### Other components

- **Application developer**

## Connections

- Application developer → Display API: initializes (evidence: `README.md`)
- Application developer → UI runtime: composes UI (evidence: `README.md`)
- UI runtime → Display API: renders through
- Display API → Graphics primitives: extends
- Display API → ST77xx drivers: uses panel layer (evidence: `src/display/LucarneDisplay.cpp`)
- Graphics primitives → Fonts and text: draws text (evidence: `src/core/LucarneGfx.cpp`)
- UI runtime → Screens and transitions: manages screens (evidence: `src/ui/LucarneUI.cpp`)
- UI runtime → Data binding: binds data
- UI runtime → Theme: applies theme
- Screens and transitions → Widgets: contains widgets
- Screens and transitions → Menus: routes menu selection
- UI runtime → Physical input: handles input
- Widgets → Image loading: loads images (evidence: `src/ui/LucarneWidget.cpp`)
- Image loading → Image assets: reads assets
- Widgets → Icon rendering: draws icons (evidence: `src/ui/LucarneIconDraw.cpp`)
- Icon rendering → Animated icons: renders animation (evidence: `src/ui/LucarneIconDraw.cpp`)
- Application developer → Lucarne Studio: designs and exports (evidence: `README.md`)
- Lucarne Studio → Live Preview: streams preview (evidence: `README.md`)
- Studio USB host → Live Preview: sends frames (evidence: `src/tools/LucarneLivePreview.h`)
- Live Preview → Display API: blits frames (evidence: `src/tools/LucarneLivePreview.h`)
