Expand description
Deterministic vector geometry for alpha2 shapes.
A shape content tree evaluated at one time (EvaluatedItem) becomes a VectorScene of
fills and stroke outlines in device pixels, in drawing order, with their group layers.
raster::rasterize turns a path into tile coverage, and queries (bounds, hit tests,
lengths, trims) share the same code.
Results are bit-identical on every target: geometry is f64, trigonometry uses libm, arc
lengths and flattening use only + - * / and sqrt, and coverage accumulates in scalar f32
in a fixed order. If another crate enables kurbo’s std, stroke outlines and scene keys may
differ in the last bits, so shared hash goldens compare coverage only.
Re-exports§
pub use kurbo;
Modules§
- affine
- Affine transforms and lengths built from
libmandsqrt, bit-identical on every target. - arclen
- Arc lengths of path segments, from
+ - * /andsqrtalone. - query
- Shape queries (bounds, hit tests, lengths, trimming, resampling, conversion) built on the renderer’s own geometry code.
- raster
- Path coverage in 16 by 16 tiles: per pixel, the average winding number over its area, mapped by the fill rule.
- shapes
- Parametric shapes as Bezier paths in pixel space, with the start points and directions After Effects and Lottie use so trims cut them in the same places.
- spatial
- Motion along spatial curves. A position keyframed with tangents travels along the cubic between keyframes by arc length, at the speed its timing curve sets.
- trim
- Trim paths: keeping a span of geometry’s length.
Structs§
- Canvas
Size - The canvas size in device pixels. Normalized
(1, 1)maps to(width, height), and normalized 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, with points normalized to the paint’s space and a transform from device pixels into that space.
- Scene
Stop - One stop of a scene paint: its offset and straight, sRGB-encoded color.
- Stable
Hash - Two FNV-style lanes over the written bytes, matching the render graph’s keys.
- 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 before it is projected.
Functions§
- build_
scene - The scene
itemsdraw on a picture ofsize. - build_
scene_ in - The operations
itemsdraw in aspace-sized box placed atoriginoncanvas, like an SVG viewBox. Positions and paints are normalized tospace, and output is clipped tocanvas.build_sceneis the casespace == canvasat the origin. - build_
scene_ with_ items - The scene
itemsdraw, with each operation’s item name (empty for layer push and pop). - item_
paths - Every item’s outline or painted area in document order, for queries.
- project_
far pathunchanged when it stays withinMAX_DEVICEof awidthbyheightcanvas, otherwise projected onto the canvas plus a 64-pixel margin with every subpath closed. A non-finite coordinate yields an empty path.- scene_
paint paintas a scene paint, mapped byinversefrom device pixels into aspace-sized paint space.- stroke_
outline - The outline
stylecovers alongpath, transformed to device pixels byto_device.