Image

Trait Image 

Source
pub trait Image: Sized {
    // Required methods
    fn width(&self) -> u16;
    fn height(&self) -> u16;
    fn color_at(&self, x: u16, y: u16) -> Option<Color>;
    unsafe fn color_at_unchecked(&self, x: u16, y: u16) -> Color;
    fn to_raw_image(&self) -> RawImage;
}

Required Methods§

Source

fn width(&self) -> u16

Get the width of the image, in pixels

Source

fn height(&self) -> u16

Get the height of the image, in pixels

Source

fn color_at(&self, x: u16, y: u16) -> Option<Color>

Get the color at the given coordinates

Source

unsafe fn color_at_unchecked(&self, x: u16, y: u16) -> Color

Get the color at the given coordinates skipping bound checks

§Safety

The caller is responsible to ensure that 0 <= x < width and 0 <= y < height.

Source

fn to_raw_image(&self) -> RawImage

Convert this image trait object to a raw image

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Image for RawImage

Source§

impl<'i, T: Image> Image for ImageView<'i, T>