[][src]Trait resvg::Render

pub trait Render {
    fn render_to_image(
        &self,
        tree: &Tree,
        opt: &Options
    ) -> Option<Box<dyn OutputImage>>;
fn render_node_to_image(
        &self,
        node: &Node,
        opt: &Options
    ) -> Option<Box<dyn OutputImage>>;
fn calc_node_bbox(&self, node: &Node, opt: &Options) -> Option<Rect>; }

A generic interface for image rendering.

Instead of using backend implementation directly, you can use this trait to write backend-independent code.

Required methods

fn render_to_image(
    &self,
    tree: &Tree,
    opt: &Options
) -> Option<Box<dyn OutputImage>>

Renders SVG to image.

Returns None if an image allocation failed.

fn render_node_to_image(
    &self,
    node: &Node,
    opt: &Options
) -> Option<Box<dyn OutputImage>>

Renders SVG node to image.

Returns None if an image allocation failed.

fn calc_node_bbox(&self, node: &Node, opt: &Options) -> Option<Rect>

Calculates node's absolute bounding box.

Note: this method can be pretty expensive.

Loading content...

Implementors

Loading content...