Expand description
The theme-aware drawing adapter.
Style is a thin bridge between the app’s semantic roles and the
palette-based Renderer. It bundles a borrowed Theme with a borrowed
renderer backend and resolves every Role / RoleStroke to a
Swatch / PaletteStroke before forwarding the draw down to the canvas
— so the canvas never sees a role or a theme, and the whole render path can
name a Role instead of a literal color. It adds no drawing vocabulary of
its own — its one piece of state beyond the two borrows is the opacity a
Style::with_opacity run folds into every swatch it resolves, which is why
fading needs no backend support.
The methods mirror the Renderer API name-for-name (taking a Role where
the renderer takes a Swatch), so a geometry helper drives a Style with no
body changes. Where the backend is a live Canvas, the second impl block
forwards the on-screen conveniences — cursor, in-place editor, pointer,
animation, repaint — so a tool reaches them through the Style it already
holds and never names a toolkit.
Structs§
- Style
- Theme-aware drawing surface: a
&Themepaired with a&mutrenderer backend. See the module docs.