Skip to main content

Crate devpage_design

Crate devpage_design 

Source
Expand description

The design engine: parses .design files, resolves them into scenes, lays them out and paints them. It does no I/O, so the same code runs natively in devpage and compiled to WebAssembly in the browser.

Re-exports§

pub use render::Renderer;
pub use resolve::Files;
pub use resolve::Scene;
pub use resolve::Theme;
pub use resolve::resolve;

Modules§

atlas
Whether a drawing’s images fit the GPU, and where. vello copies every image a frame paints into one atlas texture, at most SIDE pixels a side, and an image that finds no room there is silently left out of the frame. So the engine asks this model first, and a drawing whose images don’t fit is the design’s problem rather than a picture with holes.
parse
Text → syntax tree: the JSX subset a .design file is written in.
proto
The watch stream’s messages, generated from proto/design.proto — with the server feature, the Designs service’s server side too — and the conversion of a scene into them and back.
render
Scene → pixels. The engine lays a scene out once (taffy, parley) and turns it into a display list of vello drawing commands; a backend draws the list — vello_cpu here, for the PNG.
resolve
Syntax tree → scene: imports and props substituted, every attribute checked, typed and defaulted.
shadow
Shadows: a box’s shape blurred by a true Gaussian, as display-list commands both backends replay.
wire
Scenes on the wire: a scene to its proto::Scene and back, and the patch between two scenes. Each image file travels once: a scene carries every one its nodes show, a patch only those the scene before it didn’t have.

Structs§

Problem
Something wrong with a design, at a place in one of its files.

Functions§

png
Paints a scene’s whole drawing at 1× in theme and encodes it as a PNG, or says why it can’t: see Renderer::drawing.