Skip to main content

max / makeover-immediate

2.0 KB · 54 lines History Blame Raw
1 # makeover-immediate
2
3 The immediate-mode renderer for [`makeover-layout`]https://makenot.work/git/max/makeover-layout.
4
5 It is the harshest renderer the description has to survive: no `box-shadow`,
6 no `inset`, no cascade, no retained tree to mutate, and one stroke per widget
7 with no per-side control. A two-tone lit edge is not something egui can be
8 configured into producing, so it is painted by hand here, once, rather than in
9 every consuming app.
10
11 Named for the mode rather than the library, the way `makeover-tui` is named
12 for the target and not for ratatui. Immediate mode is the constraint that
13 separates this renderer from the other two; egui is the backend it is written
14 against.
15
16 ## What it owns
17
18 The expression, and nothing else. Two mitred polylines for a bevel and a
19 `Frame` for a filled region.
20
21 It owns no substitutions. makeover derives `surface-well` and every consumer
22 reads it, so `Palette::well` is a required `Color32` rather than an `Option`.
23
24 It owns no colours and no sizes. `Palette` is handed in already resolved, and
25 every radius, margin and stroke width arrives in `FrameStyle`. That is why there
26 is no dependency on `makeover`: the app already resolves a theme, and pinning a
27 renderer to a colour crate's version would buy nothing.
28
29 ## Usage
30
31 ```rust
32 use makeover_immediate::{frame, FrameStyle, Palette};
33 use makeover_layout::Depth;
34
35 frame(ui, Depth::Raised, &palette, style, |ui| {
36 ui.label("a card laid on the panel it sits in");
37 });
38 ```
39
40 A pressed control is `Depth::Raised.pressed()`. A stylesheet can say that once
41 and let the cascade carry it; an immediate-mode renderer has nowhere to put it,
42 so every call site decides, which is exactly why the description states the rule
43 instead of each widget re-deriving it.
44
45 ## Status
46
47 On crates.io. First consumer is audiofiles, the only Make Creative app that is
48 egui and the only one with no CSS. Design lives in the wiki note `makeover-immediate`; the backlog
49 is in GoingsOn under the project of the same name.
50
51 ## Licence
52
53 MIT.
54