Trait usvg_tree::NodeExt

source ·
pub trait NodeExt {
    // Required methods
    fn id(&self) -> Ref<'_, str>;
    fn transform(&self) -> Transform;
    fn abs_transform(&self) -> Transform;
    fn append_kind(&self, kind: NodeKind) -> Node;
    fn calculate_bbox(&self) -> Option<PathBbox>;
    fn filter_background_start_node(&self, filter: &Filter) -> Option<Node>;
}
Expand description

Additional Node methods.

Required Methods§

source

fn id(&self) -> Ref<'_, str>

Returns node’s ID.

If a current node doesn’t support ID - an empty string will be returned.

source

fn transform(&self) -> Transform

Returns node’s transform.

If a current node doesn’t support transformation - a default transform will be returned.

source

fn abs_transform(&self) -> Transform

Returns node’s absolute transform.

If a current node doesn’t support transformation - a default transform will be returned.

source

fn append_kind(&self, kind: NodeKind) -> Node

Appends kind as a node child.

Shorthand for Node::append(Node::new(Box::new(kind))).

source

fn calculate_bbox(&self) -> Option<PathBbox>

Calculates node’s absolute bounding box.

Can be expensive on large paths and groups.

Always returns None for NodeKind::Text since we cannot calculate its bbox without converting it into paths first.

source

fn filter_background_start_node(&self, filter: &Filter) -> Option<Node>

Returns the node starting from which the filter background should be rendered.

Implementors§