pub struct VectorTree { /* private fields */ }Expand description
Immutable, cheaply cloned group/path/image tree with unique ID lookup. Construction validates every branch, including invisible ones, under bounded depth (48), items (8192), IDs (1024 bytes each) and aggregate verbs (262144).
Implementations§
Source§impl VectorTree
impl VectorTree
Sourcepub fn write(
&self,
progress: f64,
options: WriteOptions,
) -> Result<Node, ValidationError>
pub fn write( &self, progress: f64, options: WriteOptions, ) -> Result<Node, ValidationError>
Draws paths in source reading order by their cumulative transformed arc length, then fades temporary contours into the original artwork. Endpoints are exact; finite progress clamps to 0..=1. Noninvertible writing matrices and existing curve-stroke budget violations fail explicitly.
Sourcepub fn write_mapped(
&self,
progress: f64,
options: WriteOptions,
map: &impl Fn(&[usize], Node) -> Node,
) -> Result<Node, ValidationError>
pub fn write_mapped( &self, progress: f64, options: WriteOptions, map: &impl Fn(&[usize], Node) -> Node, ) -> Result<Node, ValidationError>
Applies handwriting while mapping original vector addresses to authored nodes.
Source§impl VectorTree
impl VectorTree
Sourcepub fn surface(&self) -> Result<Arc<VectorSurface>, ValidationError>
pub fn surface(&self) -> Result<Arc<VectorSurface>, ValidationError>
Shares a single concurrent preparation at 0.0025 tree-unit Wang tolerance. The chord error bound is met with equality, so the inscribed polygon can lose up to about 2/3 of it times the perimeter in area.
Sourcepub fn surface_with_tolerance(
&self,
tolerance: f64,
) -> Result<VectorSurface, ValidationError>
pub fn surface_with_tolerance( &self, tolerance: f64, ) -> Result<VectorSurface, ValidationError>
Prepares a separate continuous geometric triangulation with an explicit positive finite curve tolerance. No rasterization or random rejection loop.
Sourcepub fn sample_points(
&self,
count: usize,
seed: u64,
) -> Result<Vec<Point>, ValidationError>
pub fn sample_points( &self, count: usize, seed: u64, ) -> Result<Vec<Point>, ValidationError>
Samples the filled geometric union by triangle area and seeded Halton points. At most one million points; clones share cached preparation.
Sourcepub fn sample_colored_points(
&self,
count: usize,
seed: u64,
) -> Result<Vec<(Point, [f32; 4])>, ValidationError>
pub fn sample_colored_points( &self, count: usize, seed: u64, ) -> Result<Vec<(Point, [f32; 4])>, ValidationError>
Area-uniform points with ordered fill color; paint alpha is never a sampling density.
Source§impl VectorTree
impl VectorTree
Sourcepub fn new(view_box: Rect, root: VectorGroup) -> Result<Self, ValidationError>
pub fn new(view_box: Rect, root: VectorGroup) -> Result<Self, ValidationError>
Freezes a checked semantic snapshot. No fonts, devices or files are loaded.
Sourcepub fn view_box(&self) -> Rect
pub fn view_box(&self) -> Rect
Original logical viewport, not a raster or an inferred visible pixel box.
Sourcepub fn root(&self) -> &VectorGroup
pub fn root(&self) -> &VectorGroup
Read-only paint-order root.
Sourcepub fn ids(&self) -> &BTreeMap<Arc<str>, Vec<usize>>
pub fn ids(&self) -> &BTreeMap<Arc<str>, Vec<usize>>
Stable ID-to-child-address index; the root group has an empty address.
Sourcepub fn get(&self, id: &str) -> Option<&VectorItem>
pub fn get(&self, id: &str) -> Option<&VectorItem>
Looks up a non-root occurrence by ID without searching or mutating the tree.
Sourcepub fn node_mapped(&self, map: &impl Fn(&[usize], Node) -> Node) -> Node
pub fn node_mapped(&self, map: &impl Fn(&[usize], Node) -> Node) -> Node
Builds nodes while applying an address-aware immutable modifier. Addresses follow the original shared tree, not the modified output nodes.
Sourcepub fn with_baseline(self, baseline: f64) -> Self
pub fn with_baseline(self, baseline: f64) -> Self
Records a content importer’s logical baseline for text-aware placement.
Sourcepub fn paint_leaves(&self) -> Vec<VectorLeaf<'_>>
pub fn paint_leaves(&self) -> Vec<VectorLeaf<'_>>
Paint-order occurrences with complete transforms and clip stacks.
Sourcepub fn leaves(&self) -> Vec<VectorLeaf<'_>>
pub fn leaves(&self) -> Vec<VectorLeaf<'_>>
Stable source reading order, independent of visual order (for example bidi). Leaves without provenance retain paint order after source-bearing leaves.