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.namehas the themes’ two. - Image
- An
Image’s file: its address in the served folder and whichImageFilein the scene it shows. - Image
File - 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_SIDEa 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 oneImageFile, 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 anytheme.reference reached its nodes. - Shadow
- Text
Style - 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
- Text
Align - 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::SIDEpixels 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 mostmaxpixels 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
Nonewhen it climbs out of the served folder. - resolve
- Resolves the design at
path, reporting every problem found. - rgba
- A
#rgb,#rgba,#rrggbbor#rrggbbaacolor.
Type Aliases§
- Image
Files - A scene’s image files by id, each decoded once however many
Images show it.