Skip to main content

Module resolve

Module resolve 

Source
Expand description

Syntax tree → scene: imports and props substituted, every attribute checked, typed and defaulted.

Structs§

Color
A color in a scene: its value in each theme. A color written as #… has the same value in both; theme.name has the themes’ two.
Image
An Image’s file: its address in the served folder and which ImageFile in the scene it shows.
ImageFile
A decoded image file: its bytes, its own size, and the pixels it is drawn from — the file’s own, or resampled to at most MAX_IMAGE_SIDE a side.
ImageId
An image file’s identity: the SHA-256 of its bytes. Two Images showing the same bytes — the same file used twice, or two copies of it — share one ImageFile, decoded once and sent once.
Node
One node of a scene.
Origin
Where an attribute was written, for a problem found only once the design is laid out and painted. It is never part of what a node draws: two nodes that differ only in it are equal, and it doesn’t travel on the wire.
Rgba
One color’s value: straight-alpha RGBA.
Scene
A resolved design: its tree, each distinct image file its Images show, the files it was made from, and whether it is themed — whether any theme. reference reached its nodes.
Shadow
TextStyle
Vector
A Vector’s path and the box of path coordinates it is drawn from.

Enums§

Align
Fill
How a box is filled: one color, or a CSS-style linear gradient.
Kind
Layout
Size
TextAlign
Theme
Which of a design’s two themes it is drawn in.

Constants§

MAX_IMAGE_SIDE
The most pixels a side an image is drawn from. The GPU keeps every image a drawing paints in one atlas of crate::atlas::SIDE pixels a side, so a larger file is resampled to fit this, keeping its aspect, when it is decoded — and both backends draw those same pixels.
THEMES_FILE
The file a folder’s themes are in.

Traits§

Files
Reads a design’s files by their path from the top of the served folder.

Functions§

decode
A PNG or JPEG file’s pixels, as straight-alpha RGBA, or why it has none.
fit
rgba, width × height, resampled to at most max pixels a side with its aspect kept, or as it is when it already fits. Each new pixel is the area-weighted average of the pixels under it, in premultiplied alpha so a transparent pixel lends no color.
join
A path relative to a design’s file, from the top of the served folder, or None when it climbs out of the served folder.
resolve
Resolves the design at path, reporting every problem found.
rgba
A #rgb, #rgba, #rrggbb or #rrggbbaa color.

Type Aliases§

ImageFiles
A scene’s image files by id, each decoded once however many Images show it.