Struct resvg::Tree

source ·
pub struct Tree {
    pub size: Size,
    pub view_box: ViewBox,
    pub content_area: Option<Rect>,
    /* private fields */
}
Expand description

A render tree.

Fields§

§size: Size

Image size.

Size of an image that should be created to fit the SVG.

width and height in SVG.

§view_box: ViewBox

SVG viewbox.

Specifies which part of the SVG image should be rendered.

viewBox and preserveAspectRatio in SVG.

§content_area: Option<Rect>

Content area.

A bounding box of all elements. Includes strokes and filter regions.

Can be None when the tree has no children.

Implementations§

source§

impl Tree

source

pub fn render(&self, transform: Transform, pixmap: &mut PixmapMut<'_>)

Renders the tree onto the pixmap.

transform will be used as a root transform. Can be used to position SVG inside the pixmap.

The produced content is in the sRGB color space.

source§

impl Tree

source

pub fn from_usvg(tree: &Tree) -> Self

Creates a rendering tree from [usvg::Tree].

Text nodes should be already converted into paths using [usvg::TreeTextToPath::convert_text].

source

pub fn from_usvg_node(node: &Node) -> Option<Self>

Creates a rendering tree from [usvg::Node].

Text nodes should be already converted into paths using [usvg::TreeTextToPath::convert_text].

Returns None when node has a zero size.

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.