Trait embedded_graphics::image::ImageFile

source ·
pub trait ImageFile<'a>: Dimensions + Sized {
    // Required methods
    fn new(filedata: &'a [u8]) -> Result<Self, ()>;
    fn width(&self) -> u32;
    fn height(&self) -> u32;
}
Expand description

Image trait

Required Methods§

source

fn new(filedata: &'a [u8]) -> Result<Self, ()>

Create a new image with given input file

The input file is expected to be of a particular format (BMP, TGA, etc) and contain file metadata like width/height and pixel data. Because parsing may fail, this returns a Result<Self, ()>.

source

fn width(&self) -> u32

Get the width in pixels of an image

source

fn height(&self) -> u32

Get the height in pixels of an image

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, C> ImageFile<'a> for ImageBmp<'a, C>
where C: PixelColor,

source§

impl<'a, C> ImageFile<'a> for ImageTga<'a, C>
where C: PixelColor,