[−][src]Struct nsvg::SvgImage
Methods
impl SvgImage
[src]
pub fn parse_file(
svg_path: &Path,
units: Units,
dpi: f32
) -> Result<SvgImage, Error>
[src]
svg_path: &Path,
units: Units,
dpi: f32
) -> Result<SvgImage, Error>
Loads SVG data from a file at the given Path
.
Arguments
svg_path
- Path to the SVG you want to loadunits
- The length unit identifier, you probably just wantnsvg::Units::Pixel
dpi
- Probably just want96.0
.
pub fn parse_str(
svg_str: &str,
units: Units,
dpi: f32
) -> Result<SvgImage, Error>
[src]
svg_str: &str,
units: Units,
dpi: f32
) -> Result<SvgImage, Error>
Loads SVG data from the given SVG text contents.
Arguments
svg_str
- Text contents of the SVG you want to loadunits
- The length unit identifier, you probably just wantnsvg::Units::Pixel
dpi
- Probably just want96.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]
&self,
scale: f32
) -> Result<(u32, u32, Vec<u8>), Error>
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
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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.