Skip to main content

Crate vello_svg

Crate vello_svg 

Source
Expand description

Render an SVG document to any backend implementing RenderSink.

Vello support is enabled by default. Raster images require a custom RenderSink::draw_image implementation.

This currently lacks support for a number of important SVG features.

This is also intended to be the preferred integration between Vello and usvg, so consider contributing if you need a feature which is missing.

§Usage

let svg = r#"<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
    <circle cx="50" cy="50" r="40" fill="red"/>
</svg>"#;
let scene = vello_svg::render(svg).expect("valid SVG");

Use append or append_tree to render into an existing scene or custom sink.

§Unsupported features

Unsupported or incomplete features include:

  • clipping beyond a single path
  • masking
  • filter effects
  • group background
  • path shape-rendering
  • patterns

Re-exports§

pub use vello;vello
pub use kurbo;
pub use peniko;
pub use usvg;

Modules§

util

Enums§

Error
Triggered when there is an issue parsing user input.

Traits§

RenderSink
A rendering backend for SVG documents.

Functions§

append
Append an SVG to a RenderSink, with default error handling.
append_tree
Append an usvg::Tree to a RenderSink, with default error handling.
append_tree_with
Append an usvg::Tree to a RenderSink, with user-provided error handling logic.
append_tree_with_transform
Append an usvg::Tree to a RenderSink with a base transform applied to all elements.
append_with
Append an SVG to a RenderSink, with user-provided error handling logic.
rendervello
Render an SVG string to a new Vello scene.
render_treevello
Render a usvg::Tree to a new Vello scene.