pub struct Tree {
pub size: Size,
pub view_box: ViewBox,
pub root: Node,
}Expand description
A nodes tree container.
Fields§
§size: SizeImage size.
Size of an image that should be created to fit the SVG.
width and height in SVG.
view_box: ViewBoxSVG viewbox.
Specifies which part of the SVG image should be rendered.
viewBox and preserveAspectRatio in SVG.
root: NodeThe root element of the SVG tree.
The root node is always Group.
Implementations§
source§impl Tree
impl Tree
sourcepub fn node_by_id(&self, id: &str) -> Option<Node>
pub fn node_by_id(&self, id: &str) -> Option<Node>
Returns renderable node by ID.
If an empty ID is provided, than this method will always return None.
Even if tree has nodes with empty ID.
sourcepub fn has_text_nodes(&self) -> bool
pub fn has_text_nodes(&self) -> bool
Checks if the current tree has any text nodes.
sourcepub fn paint_servers<F: FnMut(&Paint)>(&self, f: F)
pub fn paint_servers<F: FnMut(&Paint)>(&self, f: F)
Calls a closure for each Paint in the tree.
Doesn’t guarantee to have unique paint servers. A caller must deduplicate them manually.
sourcepub fn clip_paths<F: FnMut(Rc<ClipPath>)>(&self, f: F)
pub fn clip_paths<F: FnMut(Rc<ClipPath>)>(&self, f: F)
Calls a closure for each ClipPath in the tree.
Doesn’t guarantee to have unique clip paths. A caller must deduplicate them manually.
sourcepub fn masks<F: FnMut(Rc<Mask>)>(&self, f: F)
pub fn masks<F: FnMut(Rc<Mask>)>(&self, f: F)
Calls a closure for each Mask in the tree.
Doesn’t guarantee to have unique masks. A caller must deduplicate them manually.
sourcepub fn filters<F: FnMut(Rc<Filter>)>(&self, f: F)
pub fn filters<F: FnMut(Rc<Filter>)>(&self, f: F)
Calls a closure for each Filter in the tree.
Doesn’t guarantee to have unique filters. A caller must deduplicate them manually.
sourcepub fn calculate_abs_transforms(&mut self)
pub fn calculate_abs_transforms(&mut self)
Calculates absolute transforms for all nodes in the tree.
As of now, sets Group::abs_transform.
Automatically called by the parser and ideally should be called manually after each tree modification.