pub struct Image16BPP<'a, C: PixelColor> {
    pub offset: Coord,
    /* private fields */
}
Expand description

8 bit per pixel image

Fields

offset: Coord

Top left corner offset from display origin (0,0)

Trait Implementations

Formats the value using the given formatter. Read more

Create a new 16BPP image with given data, width and height. Data length must equal width * height * 2

The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

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


// 1px x 1px test image
let image: Image16BPP<PixelColorU8> = Image16BPP::new(&[ 0xff ], 1, 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));

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


// 1px x 1px test image
let mut image: Image16BPP<PixelColorU8> = Image16BPP::new(&[ 0xff ], 1, 1);
image.translate_mut(Coord::new(25, 30));

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.