pub struct Tree { /* private fields */ }Expand description
A nodes tree container.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn from_data(
data: &[u8],
opt: &Options<'_>,
fontdb: &Database,
) -> Result<Self, Error>
pub fn from_data( data: &[u8], opt: &Options<'_>, fontdb: &Database, ) -> Result<Self, Error>
Parses Tree from an SVG data.
Can contain an SVG string or a gzip compressed data.
Sourcepub fn from_str(
text: &str,
opt: &Options<'_>,
fontdb: &Database,
) -> Result<Self, Error>
pub fn from_str( text: &str, opt: &Options<'_>, fontdb: &Database, ) -> Result<Self, Error>
Parses Tree from an SVG string.
Sourcepub fn from_xmltree_with_cache(
doc: &Document<'_>,
opt: &Options<'_>,
cache: &mut Cache,
fontdb: &Database,
) -> Result<Self, Error>
pub fn from_xmltree_with_cache( doc: &Document<'_>, opt: &Options<'_>, cache: &mut Cache, fontdb: &Database, ) -> Result<Self, Error>
Parses Tree from roxmltree::Document with a cache.
Sourcepub fn from_xmltree(
doc: &Document<'_>,
opt: &Options<'_>,
fontdb: &Database,
) -> Result<Self, Error>
pub fn from_xmltree( doc: &Document<'_>, opt: &Options<'_>, fontdb: &Database, ) -> Result<Self, Error>
Parses Tree from roxmltree::Document.
Sourcepub fn from_nested_svgtree(
doc: &NestedSvgDocument<'_>,
opt: &Options<'_>,
fontdb: &Database,
) -> Result<Self, Error>
pub fn from_nested_svgtree( doc: &NestedSvgDocument<'_>, opt: &Options<'_>, fontdb: &Database, ) -> Result<Self, Error>
Parses Tree from svgtree::NestedSvgDocument.
Sourcepub fn from_nested_svgtree_with_cache(
doc: &NestedSvgDocument<'_>,
opt: &Options<'_>,
cache: &mut Cache,
fontdb: &Database,
) -> Result<Self, Error>
pub fn from_nested_svgtree_with_cache( doc: &NestedSvgDocument<'_>, opt: &Options<'_>, cache: &mut Cache, fontdb: &Database, ) -> Result<Self, Error>
Parses Tree from svgtree::NestedSvgDocument with a cache.
Source§impl Tree
impl Tree
Sourcepub fn size(&self) -> Size
pub fn size(&self) -> Size
Image size.
Size of an image that should be created to fit the SVG.
width and height in SVG.
Sourcepub fn view_box(&self) -> ViewBox
pub fn view_box(&self) -> ViewBox
SVG viewbox.
Specifies which part of the SVG image should be rendered.
viewBox and preserveAspectRatio in SVG.
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 linear_gradients(&self) -> &[Arc<LinearGradient>]
pub fn linear_gradients(&self) -> &[Arc<LinearGradient>]
Returns a list of all unique LinearGradients in the tree.
Sourcepub fn radial_gradients(&self) -> &[Arc<RadialGradient>]
pub fn radial_gradients(&self) -> &[Arc<RadialGradient>]
Returns a list of all unique RadialGradients in the tree.
Sourcepub fn clip_paths(&self) -> &[Arc<ClipPath>]
pub fn clip_paths(&self) -> &[Arc<ClipPath>]
Returns a list of all unique ClipPaths in the tree.