Crate nsvg

Source
Expand description

A friendly Rust wrapper around the excellent NanoSVG C library. Offering simple SVG parsing and rasterizing.

§Example

extern crate nsvg;

use std::path::Path;

fn main() {
  let path = Path::new("examples/example.svg");

  // Load and parse the svg
  let svg = nsvg::parse_file(path, nsvg::Units::Pixel, 96.0).unwrap();

  // Create a scaled raster
  let scale = 2.0;
  let image = svg.rasterize(scale);
}

Re-exports§

pub extern crate image;

Structs§

SvgImage

Enums§

Error
Units

Functions§

parse_file
Loads SVG data from a file at the given Path.
parse_str
Loads SVG data from the given SVG text contents.