[][src]Struct nsvg::SvgImage

pub struct SvgImage { /* fields omitted */ }

Methods

impl SvgImage[src]

pub fn parse_file(
    svg_path: &Path,
    units: Units,
    dpi: f32
) -> Result<SvgImage, Error>
[src]

Loads SVG data from a file at the given Path.

Arguments

  • svg_path - Path to the SVG you want to load
  • units - The length unit identifier, you probably just want nsvg::Units::Pixel
  • dpi - Probably just want 96.0.

pub fn parse_str(
    svg_str: &str,
    units: Units,
    dpi: f32
) -> Result<SvgImage, Error>
[src]

Loads SVG data from the given SVG text contents.

Arguments

  • svg_str - Text contents of the SVG you want to load
  • units - The length unit identifier, you probably just want nsvg::Units::Pixel
  • dpi - Probably just want 96.0.

pub fn rasterize(&self, scale: f32) -> Result<RgbaImage, Error>[src]

Turns the loaded SVG into an RgbaImage bitmap

Argument

  • scale - The factor the vector will be scaled by when rasterizing. 1.0 is the original size.

pub fn rasterize_to_raw_rgba(
    &self,
    scale: f32
) -> Result<(u32, u32, Vec<u8>), Error>
[src]

Turns the loaded SVG into raw RGBA array data, along with width and height information.

Argument

  • scale - The factor the vector will be scaled by when rasterizing. 1.0 is the original size.

pub fn width(&self) -> f32[src]

The width of the original SVG document.

pub fn height(&self) -> f32[src]

The height of the original SVG document.

Trait Implementations

impl Drop for SvgImage[src]

Auto Trait Implementations

impl !Send for SvgImage

impl Unpin for SvgImage

impl !Sync for SvgImage

impl UnwindSafe for SvgImage

impl RefUnwindSafe for SvgImage

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.