pub trait Image {
type Pixel;
// Required methods
fn data(&self) -> &[Self::Pixel];
fn shape(&self) -> Shape;
// Provided methods
fn size(&self) -> Size { ... }
fn width(&self) -> usize { ... }
fn height(&self) -> usize { ... }
fn get(&self, row: usize, col: usize) -> Option<&Self::Pixel> { ... }
fn view(
&self,
row_min: usize,
row_max: usize,
col_min: usize,
col_max: usize
) -> ImageRef<'_, Self::Pixel> { ... }
fn as_ref(&self) -> ImageRef<'_, Self::Pixel> { ... }
fn iter(&self) -> ImageIter<'_, Self::Pixel> ⓘ { ... }
fn write_rgba<W>(&self, out: W) -> Result<(), Error>
where W: Write,
Self::Pixel: Color,
Self: Sized { ... }
fn write_ppm<W>(&self, out: W) -> Result<(), Error>
where W: Write,
Self::Pixel: Color,
Self: Sized { ... }
fn write_bmp<W>(&self, out: W) -> Result<(), Error>
where W: Write,
Self::Pixel: Color,
Self: Sized { ... }
}
Expand description
Trait common to all image types
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn get(&self, row: usize, col: usize) -> Option<&Self::Pixel>
fn get(&self, row: usize, col: usize) -> Option<&Self::Pixel>
Get pixel at the specified row and column
sourcefn view(
&self,
row_min: usize,
row_max: usize,
col_min: usize,
col_max: usize
) -> ImageRef<'_, Self::Pixel>
fn view( &self, row_min: usize, row_max: usize, col_min: usize, col_max: usize ) -> ImageRef<'_, Self::Pixel>
Create sub-image bounded by constraints, _max
values are not inclusive.
sourcefn as_ref(&self) -> ImageRef<'_, Self::Pixel>
fn as_ref(&self) -> ImageRef<'_, Self::Pixel>
Create immutable view to the image of the concrete type of ImageRef
sourcefn write_rgba<W>(&self, out: W) -> Result<(), Error>
fn write_rgba<W>(&self, out: W) -> Result<(), Error>
Write raw RGBA data