[][src]Struct ytesrev::image::PngImage

pub struct PngImage {
    pub width: usize,
    pub height: usize,
    pub data: Vec<u8>,
}

A PNG image. Currently only supports RGB and RGBA color types

Fields

width: usize

The width of the image

height: usize

The height of the image

data: Vec<u8>

The data in the image, stored in chunks of 4 per pixel, containing the image in RGBA order

Methods

impl PngImage[src]

pub fn load_from_path<R: Read>(r: R) -> Result<Self, DecodingError>[src]

Load an image from a specified source.

pub fn load_from_path_transform<R: Read, F: Fn(Color) -> Color>(
    r: R,
    transform: F
) -> Result<Self, DecodingError>
[src]

Load an image and apply a function to each pixel. Mostly used by LatexObj to fix alpha

Trait Implementations

impl Drawable for PngImage[src]

fn register(&mut self)[src]

Register all content. This is mostly just used by [LatexObj]s, that need to be registered before loaded. Read more

fn load(&mut self)[src]

Load all content

fn event(&mut self, e: Event)[src]

When any event occurs

fn update(&mut self, dt: f64)[src]

Tick the object

impl KnownSize for PngImage[src]

impl ImageContainer for PngImage[src]

fn as_knownsize(&self) -> &dyn KnownSize[src]

Convert the object to a dynamic KnownSize object, as rust doesn't support calling KnownSize -methods directly on this object Read more

impl Clone for PngImage[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Layerable for T where
    T: Drawable
[src]

impl<T> Stackable for T where
    T: Drawable + KnownSize
[src]

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

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

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.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,