pub struct Tree {
pub size: Size,
pub view_box: ViewBox,
pub root: Node<NodeKind>,
}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: Node<NodeKind>The 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<NodeKind>>
pub fn node_by_id(&self, id: &str) -> Option<Node<NodeKind>>
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>(&self, f: F)
pub fn paint_servers<F>(&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>(&self, f: F)
pub fn clip_paths<F>(&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>(&self, f: F)
pub fn masks<F>(&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>(&self, f: F)
pub fn filters<F>(&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.
Trait Implementations§
source§impl TreeParsing for Tree
impl TreeParsing for Tree
source§impl TreeTextToPath for Tree
impl TreeTextToPath for Tree
source§fn convert_text(&mut self, fontdb: &Database)
fn convert_text(&mut self, fontdb: &Database)
source§impl TreeWriting for Tree
impl TreeWriting for Tree
source§fn to_string(&self, opt: &XmlOptions) -> String
fn to_string(&self, opt: &XmlOptions) -> String
usvg::Tree back to SVG.