Struct usvg::Tree
[−]
[src]
pub struct Tree { /* fields omitted */ }
A nodes tree container.
Methods
impl Tree
[src]
pub fn from_data(data: &[u8], opt: &Options) -> Result<Self, Error>
[src]
Parsers Tree
from the SVG data.
Can contain SVG string or gzip compressed data.
pub fn from_str(text: &str, opt: &Options) -> Self
[src]
Parsers Tree
from the SVG string.
An empty Tree
will be returned on any error.
pub fn from_dom(doc: Document, opt: &Options) -> Self
[src]
Parsers Tree
from the svgdom::Document
.
An empty Tree
will be returned on any error.
pub fn from_file<P: AsRef<Path>>(path: P, opt: &Options) -> Result<Self, Error>
[src]
Parsers Tree
from the file.
pub fn create(svg: Svg) -> Self
[src]
Creates a new Tree
.
pub fn root(&self) -> Node
[src]
Returns the Svg
node.
pub fn svg_node(&self) -> Ref<Svg>
[src]
Returns the Svg
node value.
pub fn defs(&self) -> Node
[src]
Returns the Defs
node.
pub fn is_in_defs(&self, node: &Node) -> bool
[src]
Checks that node
is part of the Defs
children.
pub fn append_to_defs(&mut self, kind: NodeKind) -> Node
[src]
Appends NodeKind
to the Defs
node.
pub fn defs_by_id(&self, id: &str) -> Option<Node>
[src]
Returns defs
child node by ID.
pub fn node_by_id(&self, id: &str) -> Option<Node>
[src]
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.
pub fn to_svgdom(&self) -> Document
[src]
Converts the document to svgdom::Document
.
Used to save document to file for debug purposes.