Skip to main content

VectorTree

Struct VectorTree 

Source
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

Source

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.

Source

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

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn new(view_box: Rect, root: VectorGroup) -> Result<Self, ValidationError>

Freezes a checked semantic snapshot. No fonts, devices or files are loaded.

Source

pub fn view_box(&self) -> Rect

Original logical viewport, not a raster or an inferred visible pixel box.

Source

pub fn root(&self) -> &VectorGroup

Read-only paint-order root.

Source

pub fn ids(&self) -> &BTreeMap<Arc<str>, Vec<usize>>

Stable ID-to-child-address index; the root group has an empty address.

Source

pub fn get(&self, id: &str) -> Option<&VectorItem>

Looks up a non-root occurrence by ID without searching or mutating the tree.

Source

pub fn node(&self) -> Node

Converts the same content to ordinary Node groups and drawables.

Source

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.

Source

pub fn with_baseline(self, baseline: f64) -> Self

Records a content importer’s logical baseline for text-aware placement.

Source

pub fn paint_leaves(&self) -> Vec<VectorLeaf<'_>>

Paint-order occurrences with complete transforms and clip stacks.

Source

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.

Trait Implementations§

Source§

impl Clone for VectorTree

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VectorTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.