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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnwindSafe for Tree
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)