[][src]Struct embedded_graphics::prelude::Image

pub struct Image<'a, C, T> where
    C: PixelColor,
    T: ImageType, 
{ pub offset: Coord, // some fields omitted }

An image constructed from a slice

Fields

offset: Coord

Image offset in pixels from screen origin (0,0)

Methods

impl<'a, C, T> Image<'a, C, T> where
    C: PixelColor,
    T: ImageType, 
[src]

pub fn new(imagedata: &'a [u8], width: u32, height: u32) -> Self[src]

Create a new image with given pixel data, width and height

Trait Implementations

impl<'a, C, T> Drawable for Image<'a, C, T> where
    C: PixelColor,
    T: ImageType, 
[src]

impl<'a, C, T> Dimensions for Image<'a, C, T> where
    C: PixelColor,
    T: ImageType, 
[src]

impl<'a, C, T> Transform for Image<'a, C, T> where
    C: PixelColor,
    T: ImageType, 
[src]

fn translate(&self, by: Coord) -> Self[src]

Translate the image from its current position to a new position by (x, y) pixels, returning a new Image. For a mutating transform, see translate_mut.

// 8px x 1px test image
let image: Image1BPP<PixelColorU8> = Image1BPP::new(&[ 0xff ], 8, 1);
let moved = image.translate(Coord::new(25, 30));

assert_eq!(image.offset, Coord::new(0, 0));
assert_eq!(moved.offset, Coord::new(25, 30));

fn translate_mut(&mut self, by: Coord) -> &mut Self[src]

Translate the image from its current position to a new position by (x, y) pixels.

let mut image: Image1BPP<PixelColorU8> = Image1BPP::new(&[ 0xff ], 8, 1);
image.translate_mut(Coord::new(25, 30));

assert_eq!(image.offset, Coord::new(25, 30));

impl<'a, C: Debug, T: Debug> Debug for Image<'a, C, T> where
    C: PixelColor,
    T: ImageType, 
[src]

Auto Trait Implementations

impl<'a, C, T> Send for Image<'a, C, T> where
    C: Send,
    T: Send

impl<'a, C, T> Sync for Image<'a, C, T> where
    C: Sync,
    T: Sync

Blanket Implementations

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

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T> From for T[src]

impl<T, U> TryInto 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> Borrow for T where
    T: ?Sized
[src]

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

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