The backends
| Crate | What | Where it fits |
|---|---|---|
fusuma-render-integer | Integer drawing: smooth text, shapes and images in integer maths, no FPU, no allocator. | The lightest. Chips that must keep their RAM free, from an ESP32-C6 up. |
fusuma-render-vello-cpu | Anti-aliased drawing on vello_cpu. | The richest CPU renderer. A chip with PSRAM, or a machine without a GPU. |
fusuma-render-vello | Anti-aliased GPU drawing on vello_gpu and wgpu. | Desktop and anything with a usable GPU. |
Side by side
| Integer | Vello CPU | Vello GPU | |
|---|---|---|---|
| Draws with | integer arithmetic into an RGB565 target | vello_cpu, anti-aliased | vello_gpu on wgpu |
| Text | glyph atlases made at build time | Parley, from outlines | Parley, from outlines |
| Allocator | none | needed | needed |
| Floating point | none | libm where the chip has no FPU | on the GPU |
| Threads | no | optional worker threads | the GPU |
| Fits | a chip, from an ESP32-C6 up | a chip with PSRAM, or a machine without a GPU | desktop and the web |
One trait
Every backend implements Renderer and passes the same conformance suite, so the same scene goes through the same rules on each: one rule for images, one for gradients, one for dashes. Something a backend cannot do says so, its method returns false or Capabilities says it, and the toolkit draws the plain version instead of failing.
pub trait Renderer {
type Error;
fn capabilities(&self) -> Capabilities;
fn clear(&mut self, color: Color) -> Result<(), Self::Error>;
fn fill_rect(&mut self, rect: Rect, radius: u32, color: Color) -> Result<(), Self::Error>;
fn fill_path(&mut self, path: &[PathCmd], color: Color) -> Result<(), Self::Error>;
fn stroke_path(&mut self, path: &[PathCmd], width: u32, color: Color) -> Result<(), Self::Error>;
fn draw_text(&mut self, text: &str, at: Point, style: &TextStyle) -> Result<(), Self::Error>;
fn measure_text(&self, text: &str, style: &TextStyle) -> Size;
// Clips, images, gradients, shadows, dashes and layers have defaults
// built from the methods above; a backend overrides the ones it does better.
}A widget never sees a renderer’s type: it draws on a canvas that moves and clips the renderer to its box. You can write a widget of your own and it draws the same way as the built-in ones.
Choosing one
fusuma-platform reads the screen and the chip (RAM, PSRAM, FPU, GPU) and picks a renderer, with a reason for its answer. fusuma.toml overrides it:
[render]
backend = "auto" # auto, integer, vello-cpu or vello-gpu
[fonts]
preset = "legible" # fusuma, material, legible, plex or noto
[theme]
palette = "washi" # one of 27Features add up in a build, so linking two renderers links both; the platform chooses among those linked. On the desktop, --renderer vello-cpu (or vello-gpu, integer, auto) overrides it for a run, and RUST_LOG=info shows the choice.
Effects
Rounded clips, gradients, soft shadows, blend layers, backdrop blur, dashed strokes and shaders are all in the trait, and each backend does what it can. The integer renderer does them in one pass over integers: sparse strips for fills, a blur in a ring buffer, layers only when the board has room for a layer store. The gallery’s Effects and Shape pages show them.
Layers
A renderer crate never depends on a toolkit crate, and a platform crate draws nothing itself. A firmware that only draws gets no toolkit code; CI checks both rules.