[][src]Trait embedded_graphics::image::ImageFile

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

Image file trait.

Required methods

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, ()>.

fn width(&self) -> u32

Get the width in pixels of an image

fn height(&self) -> u32

Get the height in pixels of an image

Loading content...

Implementors

impl<'a, C> ImageFile<'a> for ImageBmp<'a, C> where
    C: PixelColor + From<<C as PixelColor>::Raw>, 
[src]

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

Create a new BMP from a byte slice

impl<'a, C> ImageFile<'a> for ImageTga<'a, C> where
    C: PixelColor + From<<C as PixelColor>::Raw>, 
[src]

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

Create a new TGA from a byte slice

Loading content...