Struct embedded_graphics::image::Image
source · pub struct Image<'a, C, T>where
C: PixelColor,
T: ImageType,{
pub offset: Coord,
/* private fields */
}Expand description
An image constructed from a slice
Fields§
§offset: CoordImage offset in pixels from screen origin (0,0)
Implementations§
Trait Implementations§
source§impl<'a, C, T> Dimensions for Image<'a, C, T>where
C: PixelColor,
T: ImageType,
impl<'a, C, T> Dimensions for Image<'a, C, T>where
C: PixelColor,
T: ImageType,
source§impl<'a, C, T> Transform for Image<'a, C, T>where
C: PixelColor,
T: ImageType,
impl<'a, C, T> Transform for Image<'a, C, T>where
C: PixelColor,
T: ImageType,
source§fn translate(&self, by: Coord) -> Self
fn translate(&self, by: Coord) -> Self
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));source§fn translate_mut(&mut self, by: Coord) -> &mut Self
fn translate_mut(&mut self, by: Coord) -> &mut Self
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));impl<'a, C, T> Drawable for Image<'a, C, T>where
C: PixelColor,
T: ImageType,
Auto Trait Implementations§
impl<'a, C, T> Freeze for Image<'a, C, T>
impl<'a, C, T> RefUnwindSafe for Image<'a, C, T>where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, C, T> Send for Image<'a, C, T>
impl<'a, C, T> Sync for Image<'a, C, T>
impl<'a, C, T> Unpin for Image<'a, C, T>
impl<'a, C, T> UnwindSafe for Image<'a, C, T>where
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.