pub struct Tree {
pub(crate) size: Size,
pub(crate) root: Group,
pub(crate) linear_gradients: Vec<Arc<LinearGradient>>,
pub(crate) radial_gradients: Vec<Arc<RadialGradient>>,
pub(crate) patterns: Vec<Arc<Pattern>>,
pub(crate) clip_paths: Vec<Arc<ClipPath>>,
pub(crate) masks: Vec<Arc<Mask>>,
pub(crate) filters: Vec<Arc<Filter>>,
pub(crate) fontdb: Arc<Database>,
}Expand description
A nodes tree container.
Fields§
§size: Size§root: Group§linear_gradients: Vec<Arc<LinearGradient>>§radial_gradients: Vec<Arc<RadialGradient>>§patterns: Vec<Arc<Pattern>>§clip_paths: Vec<Arc<ClipPath>>§masks: Vec<Arc<Mask>>§filters: Vec<Arc<Filter>>§fontdb: Arc<Database>Implementations§
Source§impl Tree
impl Tree
Sourcepub fn from_data(data: &[u8], opt: &Options<'_>) -> Result<Self, Error>
pub fn from_data(data: &[u8], opt: &Options<'_>) -> Result<Self, Error>
Parses Tree from an SVG data.
Can contain an SVG string or a gzip compressed data.
Sourcepub fn from_data_nested(data: &[u8], opt: &Options<'_>) -> Result<Self, Error>
pub fn from_data_nested(data: &[u8], opt: &Options<'_>) -> Result<Self, Error>
Similar to the from_data method, except that it ignores all image elements linking to
external files, as required by the SVG specification when SVG files are loaded
for <image href="..." /> tags.
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 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 has_defs_nodes(&self) -> bool
pub fn has_defs_nodes(&self) -> bool
Checks if the current tree has any defs 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.
Sourcepub fn fontdb(&self) -> &Arc<Database>
pub fn fontdb(&self) -> &Arc<Database>
Returns the font database that applies to all text nodes in the tree.