Trait BackendImage

Source
pub trait BackendImage<'a, P: 'a> {
    type Iterator: Iterator<Item = &'a P>;

    // Required methods
    unsafe fn pixel_unsafe(&self, x: u32, y: u32) -> &P;
    fn width(&self) -> u32;
    fn height(&self) -> u32;
    fn pixels(&'a self) -> Self::Iterator;
}
Expand description

Trait to generalize images to be displayed on the backend.

Currently implemented for Canvas and Sprite.

Required Associated Types§

Source

type Iterator: Iterator<Item = &'a P>

Iterator to produce pixel values of the image, row-by-row.

Required Methods§

Source

unsafe fn pixel_unsafe(&self, x: u32, y: u32) -> &P

Get reference to specific pixel.

§Safety
  • x must be in bounds [0; width);
  • y must be in bounds [0; height).
Source

fn width(&self) -> u32

Get image width in pixels.

Source

fn height(&self) -> u32

Get image height in pixels.

Source

fn pixels(&'a self) -> Self::Iterator

Get iterator over pixels.

The iterator is considered to provide pixels row-by-row.

Implementors§