pub struct Tree {
pub size: Size,
pub view_box: ViewBox,
pub root: Group,
}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: GroupThe root element of the SVG tree.
Implementations§
source§impl Tree
impl Tree
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 a renderable node by ID.
If an empty ID is provided, than this method will always return None.
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(SharedClipPath)>(&self, f: F)
pub fn clip_paths<F: FnMut(SharedClipPath)>(&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(SharedMask)>(&self, f: F)
pub fn masks<F: FnMut(SharedMask)>(&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(SharedFilter)>(&self, f: F)
pub fn filters<F: FnMut(SharedFilter)>(&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.
A low-level method. Prefer usvg::Tree::postprocess instead.
sourcepub fn calculate_bounding_boxes(&mut self)
pub fn calculate_bounding_boxes(&mut self)
Calculates bounding boxes for all nodes in the tree.
A low-level method. Prefer usvg::Tree::postprocess instead.
sourcepub fn postprocess(&mut self, steps: PostProcessingSteps, fontdb: &Database)
pub fn postprocess(&mut self, steps: PostProcessingSteps, fontdb: &Database)
Postprocesses the usvg::Tree.
Must be called after parsing a usvg::Tree.
steps contains a list of additional post-processing steps.
This methods performs some operations even when steps is PostProcessingSteps::default().
fontdb is needed only for PostProcessingSteps::convert_text_into_paths.
Otherwise you can pass just fontdb::Database::new().