Skip to main content

Module query

Module query 

Source
Expand description

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.

Inputs and outputs are normalized as the model is, on a picture of a given size; lengths and distances are in its pixels.

Structs§

Nearest
The point of a path nearest another.

Functions§

from_bez
A pixel path as vertices and tangents, normalized. Quadratic segments are raised to cubics; a closed subpath’s closing line back to its start is left implicit.
hit_test
The front-most fill or stroke that paints the normalized point, by its fill rule (a stroke by its outline): the item’s place in the tree.
items
Every item’s ItemPath (place in the tree, device path, and bounds), in document order.
nearest_point
The point of path nearest the normalized point, measured in pixels.
path_lengths
Each subpath’s length in pixels.
resample_path
path with counts[i] vertices on subpath i, spaced evenly along its pixel length, with tangents along the curve a third of the spacing long: paths of different vertex counts made ready to morph. A subpath with no count, or a count under 2 (3 when closed), is left as it is.
shape_bounds
The normalized bounds of every item, in document order: geometry’s outline, a paint’s area (a stroke’s with its width), a group’s items’. Trims are not listed; an item with nothing to show has None.
to_path
geometry as a path of the same outline, normalized: the editor’s “convert to path”.
trim_path
path trimmed as a trim item trims it, together: the kept span of its subpaths’ lengths in pixels, normalized again.