Module part_paint
Expand description
Part painters: the host side of the theme SDK (tilo_theme_sdk,
docs/architecture/theming.md, “Part painters”).
A theme’s painter set (PainterSet, a PartPainter) draws parts;
this module is everything around it that the toolkit owns:
- the sets a document can name: the built-in Default, Glass and Block
(
builtin) and those a theme installs (register_painter_set,painter_set), its own loaded from wasm (wasm); the set drawing each surface role is the role’scrate::tokens::Finish(Theme::painter); - the values a part is drawn with (
part_tokens); - drawing a painted part into the frame, with its backdrop filled by the
backdrop pass and held legible (
paint_part), and the cache that keeps a settled part’s drawing ([draw]); - the clock its transitions run on (
PartMotion); - the painted shape that takes the pointer (
hit_contains).
A set paints what it chooses to; a part it returns None for is drawn by
the toolkit’s own painters, so a theme draws only the parts it changes.
Modules§
- builtin
- The painter sets the toolkit ships: Default, Glass and Block
(
docs/architecture/theming.md, “Part painters”). They implement the samePartPaintera theme’s own set does and draw through the same host; a theme document names them as it would any other set. - wasm
- Painter sets loaded from wasm: a theme’s own painters, run in the UI host
with nothing to reach (
docs/architecture/theming.md, “Part painters”).
Structs§
- Lens
- How the backdrop is bent and filtered where a part shows it.
- Moment
- Where a part is in its motion: the states it is moving between and how far it has come.
- Painted
- A part as the toolkit drew it.
- Painted
Part - A part as its painter drew it.
- Painter
Set - A painter set the toolkit draws with: its name, as a theme document names it, and the painter.
- Param
- A named number from the theme document, for the painter set that reads
it (a glass set’s
refraction, a dither set’slevels). - Param
Spec - A parameter a painter set takes from the theme document: its name, the
value it has when a document leaves it out (
None: a document must state it), the band a document may state it in, and the band the theme is built at. - Part
Image - A small picture a painter tiles a fill with: an ordered-dither threshold pattern, a hatch, a pixel texture. Straight-alpha RGBA8, rows top to bottom.
- Part
Motion - One part’s motion between states, run on the toolkit’s clock.
- Part
Scene - A part, drawn: operations in paint order.
- Part
State - Where a part is: the states it is in now, and the ones it is leaving (equal once a transition settled).
- Part
Tokens - The theme’s values for one part, resolved for its role and state: the
colours already carry the theme’s contrast guarantees, so a painter that
lays
inkonfillis legible. - Shader
Source - A surface shader as it travels from a theme document to the renderer:
WGSL and the static
timeit is given. It is checked when the theme is read, before it reaches here. - Sides
- The sides of a part that stand on the display’s own edge.
- States
- The states a part is in at once.
- Stop
- A colour stop of a gradient.
Enums§
- Brush
- What a path is filled or stroked with.
- Easing
- A curve for
Transition::Eased. - Op
- One drawing operation, in part coordinates (origin at the part’s top left, logical pixels).
- Part
- A part a
uicomponent declares. A theme reaches parts, never an app’s view tree. - Sampling
- How a backdrop sample is filtered.
- Transition
- How a part moves from one set of states to another.
Traits§
- Part
Painter - A painter set: how a theme draws every part.
Functions§
- cached_
parts - How many settled parts this thread holds drawn (for tests and the performance overlay).
- hit_
contains - Whether
point(in the coordinateshitis in) lies in the painted shapehit, by the non-zero rule the shape was filled with. - paint_
part - Draw
partofsetinrect(in the coordinatestransformmaps intoscene’s), atmomentof its motion, withtokens.Nonewhen the set leaves the part to the toolkit’s own painters, which the caller then draws. - painter_
set - The set a document calls
name: a built-in one, or one registered. - part_
tokens - The values a part of
roleis drawn with undertheme:fill,inkandedgeas its role and state resolved them,groundwhat it stands on, and the parameters the role’s finish states. No backdrop: the toolkit says where a part shows one. - register_
painter_ set - Make
setone a theme document can name. A set registered under a name already taken replaces it: a theme’s author installing a fixed version. The built-in sets’ names are the toolkit’s:false, and nothing registered, for a set that claims one.