Expand description
Deterministic vector geometry for alpha2 shapes.
A shapes generator’s content tree, evaluated at one time
(EvaluatedItem), becomes a VectorScene: fills and stroke outlines
in device pixels, in drawing order, with the group layers that fade them.
raster::rasterize turns one of its paths into tile coverage. Queries
the editor needs (bounds, hit tests, lengths, trims) use the same code.
Every result is the same bits on every target. Geometry is f64,
trigonometry is libm’s, arc lengths and flattening use only + - * /
and sqrt, and coverage is accumulated in scalar f32 in a fixed order.
Stroke expansion is kurbo’s, and its transcendental calls are libm’s
too, unless another crate in the build turns on kurbo’s std: then
outlines and scene keys can differ in the last bits, and the shared hash
goldens compare coverage only.
Re-exports§
pub use kurbo;
Modules§
- affine
- Affine transforms built from
libm, and lengths fromsqrtalone, so they are the same bits on every target. - arclen
- Arc lengths of path segments, from
+ - * /andsqrtalone. - query
- What an editor asks of shapes: where items are, which one is under a point, how long a path is, and paths cut, resampled, or converted. Each answer comes from the code the renderer draws with.
- raster
- Coverage of a path: per pixel, the average winding number over the pixel’s area, mapped by the fill rule, in 16 by 16 pixel tiles.
- shapes
- Parametric shapes as Bezier paths in pixel space, with the start points and directions After Effects and Lottie give them, so a trim cuts them where it cuts there.
- spatial
- Motion along spatial curves: a position keyframed with tangents travels along the cubic Bezier between its keyframes at the speed its timing curve sets, along the curve’s length.
- trim
- Trim paths: keeping a span of geometry’s length.
Structs§
- Canvas
Size - The size, in device pixels, of the picture a content tree is drawn on:
normalized
(1, 1)is(width, height), and lengths are fractions of the shorter side. - Evaluated
Path - A path evaluated at one time.
- Evaluated
Subpath - A subpath evaluated at one time.
- Evaluated
Transform - A group’s transform evaluated at one time, normalized.
- Evaluated
Vertex - A path vertex evaluated at one time, normalized.
- IRect
- A half-open rectangle of device pixels.
- Item
Path - What
item_pathsreports of one item. - Scene
Paint - The paint of a fill, as the generator pass reads a paint: points in the normalized coordinates of the paint’s space, and the transform from device pixels into that space’s pixels.
- Scene
Stop - One stop of a scene paint: its offset and straight, sRGB-encoded color.
- Stable
Hash - Two FNV-style lanes over the bytes written, as the render graph keys its results.
- Stroke
Style - A stroke’s style, in the pixels of the space it is drawn in.
- Vector
Scene - Everything a content tree draws at one time and size.
Enums§
- Evaluated
Geometry - A geometry item evaluated at one time.
- Evaluated
Item - One content-tree item evaluated at one time.
- Paint
Kind - What kind of paint covers a fill.
- Vector
Op - One drawing operation of a
VectorScene.
Constants§
- MAX_
DEVICE - How far past the canvas, in device pixels, a path may reach and still be rasterized as it is.
Functions§
- build_
scene - The scene
itemsdraw on a picture ofsize. - build_
scene_ in - The operations
itemsdraw on a picture ofspacewhose top-left corner lies atoriginon a canvas ofcanvas, as an SVG viewBox places its picture: positions are normalized tospace, lengths are fractions of its shorter side, and paints are in it. What they cover is clipped tocanvas.build_sceneis the casespace == canvasat the origin. - build_
scene_ with_ items - The scene
itemsdraw, with the item each of its operations was drawn for (empty for a layer’s push and pop). - item_
paths - Every item’s outline or painted area, in document order, for the editor’s queries.
- project_
far pathas it fills awidthbyheightcanvas: itself when it stays withinMAX_DEVICEof the canvas, or projected onto the canvas and a 64-pixel margin around it. Every subpath of the projection is closed, as filling closes it. A non-finite coordinate leaves nothing.- scene_
paint paintas the scene paints it, throughinversefrom device pixels into a paint space ofspacepixels.- stroke_
outline - The outline
stylecovers alongpath, both in the spaceto_devicetakes to device pixels, there. The pen is round inpath’s space, so a non-uniform transform makes it an ellipse, as After Effects draws it. Empty for a width of zero or less.