pub trait Image {
type Pixel;
Show 13 methods
// 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(self, fmt: ImageWriteFormat, out: impl Write) -> Result<(), Error>
where Self::Pixel: Color,
Self: Sized { ... }
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
fn write(self, fmt: ImageWriteFormat, out: impl Write) -> Result<(), Error>
Sourcefn write_rgba<W>(&self, out: W) -> Result<(), Error>
fn write_rgba<W>(&self, out: W) -> Result<(), Error>
Write raw (height, width, RGBA…) data