pub struct Tree {
pub size: Size,
pub view_box: ViewBox,
pub root: Node,
}
Expand description
A nodes tree container.
Fields§
§size: Size
Image size.
Size of an image that should be created to fit the SVG.
width
and height
in SVG.
view_box: ViewBox
SVG viewbox.
Specifies which part of the SVG image should be rendered.
viewBox
and preserveAspectRatio
in SVG.
root: Node
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>
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.