Trait resvg::Render
[−]
[src]
pub trait Render { fn render_to_image(
&self,
tree: &Tree,
opt: &Options
) -> Option<Box<OutputImage>>; fn render_node_to_image(
&self,
node: &Node,
opt: &Options
) -> Option<Box<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<OutputImage>>
&self,
tree: &Tree,
opt: &Options
) -> Option<Box<OutputImage>>
Renders SVG to image.
Returns None
if an image allocation failed.
fn render_node_to_image(
&self,
node: &Node,
opt: &Options
) -> Option<Box<OutputImage>>
&self,
node: &Node,
opt: &Options
) -> Option<Box<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.