[−][src]Struct embedded_graphics::prelude::Image
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]
C: PixelColor,
T: ImageType,
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: Debug, T: Debug> Debug for Image<'a, C, T> where
C: PixelColor,
T: ImageType,
[src]
C: PixelColor,
T: ImageType,
impl<'a, C, T> Dimensions for Image<'a, C, T> where
C: PixelColor,
T: ImageType,
[src]
C: PixelColor,
T: ImageType,
fn top_left(&self) -> Coord
[src]
fn bottom_right(&self) -> Coord
[src]
fn size(&self) -> UnsignedCoord
[src]
impl<'a, C, T> Drawable for Image<'a, C, T> where
C: PixelColor,
T: ImageType,
[src]
C: PixelColor,
T: ImageType,
impl<'a, C, T> Transform for Image<'a, C, T> where
C: PixelColor,
T: ImageType,
[src]
C: PixelColor,
T: ImageType,
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<u8> = 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<u8> = Image1BPP::new(&[ 0xff ], 8, 1); image.translate_mut(Coord::new(25, 30)); assert_eq!(image.offset, Coord::new(25, 30));
Auto Trait Implementations
impl<'a, C, T> Send for Image<'a, C, T> where
C: Send,
T: Send,
C: Send,
T: Send,
impl<'a, C, T> Sync for Image<'a, C, T> where
C: Sync,
T: Sync,
C: Sync,
T: Sync,
impl<'a, C, T> Unpin for Image<'a, C, T> where
C: Unpin,
T: Unpin,
C: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,