[][src]Enum iconwriter::SourceImage

pub enum SourceImage {
    Raster(DynamicImage),
    Svg(Tree),
}

A representation of a source image.

Variants

Raster(DynamicImage)

A generic raster image.

Svg(Tree)

A svg-encoded vector image.

Implementations

impl SourceImage[src]

pub fn open<P: AsRef<Path>>(path: P) -> Option<Self>[src]

Attempts to create a SourceImage from a given path.

The SourceImage::from::<image::DynamicImage> and SourceImage::from::<usvg::Tree> methods should always be preferred.

Return Value

  • Returns Some(src) if the file indicated by the path argument could be successfully parsed into an image.
  • Returns None otherwise.

Example

This example is not tested
let img = SourceImage::open("source.png")?;

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

Returns the width of the original image in pixels.

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

Returns the height of the original image in pixels.

pub fn dimensions(&self) -> (f64, f64)[src]

Returns the dimensions of the original image in pixels.

Trait Implementations

impl Clone for SourceImage[src]

impl From<DynamicImage> for SourceImage[src]

impl From<Tree> for SourceImage[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.