[−][src]Struct embedded_graphics::image::ImageTga
TGA format image
ImageTga
is available with the tga
feature turned on
Examples
Load a 16 bit per pixel image from a raw byte slice and draw it to a display
Note that images must be passed to Display#draw
by reference, or by explicitly calling
.into_iter()
on them, unlike other embedded_graphics objects.
use embedded_graphics::prelude::*; use embedded_graphics::image::ImageTga; // Load `patch.tga`, a 32BPP 4x4px image let image = ImageTga::new(include_bytes!("../../../assets/patch.tga")).unwrap(); // Equivalent behaviour display.draw(&image); display.draw(image.into_iter());
Fields
offset: Coord
Top left corner offset from display origin (0,0)
Trait Implementations
impl<'a, C> Drawable for ImageTga<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
impl<'a, C> Dimensions for ImageTga<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
fn top_left(&self) -> Coord
[src]
fn bottom_right(&self) -> Coord
[src]
fn size(&self) -> UnsignedCoord
[src]
impl<'a, C> ImageFile<'a> for ImageTga<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
fn new(image_data: &'a [u8]) -> Result<Self, ()>
[src]
Create a new TGA from a byte slice
fn width(&self) -> u32
[src]
fn height(&self) -> u32
[src]
impl<'a, C> Transform for ImageTga<'a, C> where
C: PixelColor,
[src]
C: PixelColor,
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 ImageTga
. For a mutating transform, see translate_mut
.
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.
impl<'a, C: Debug + PixelColor> Debug for ImageTga<'a, C>
[src]
impl<'a, C> IntoIterator for &'a ImageTga<'a, C> where
C: PixelColor + From<u8> + From<u16> + From<u32>,
[src]
C: PixelColor + From<u8> + From<u16> + From<u32>,
type Item = Pixel<C>
The type of the elements being iterated over.
type IntoIter = ImageTgaIterator<'a, C>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, C: Clone + PixelColor> Clone for ImageTga<'a, C>
[src]
Auto Trait Implementations
impl<'a, C> Send for ImageTga<'a, C> where
C: Send,
C: Send,
impl<'a, C> Sync for ImageTga<'a, C> where
C: Sync,
C: Sync,
Blanket Implementations
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,