Trait image::GenericImageView
source · pub trait GenericImageView {
type Pixel: Pixel;
type InnerImageView: GenericImageView<Pixel = Self::Pixel>;
fn dimensions(&self) -> (u32, u32);
fn bounds(&self) -> (u32, u32, u32, u32);
fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel;
fn inner(&self) -> &Self::InnerImageView;
fn width(&self) -> u32 { ... }
fn height(&self) -> u32 { ... }
fn in_bounds(&self, x: u32, y: u32) -> bool { ... }
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel { ... }
fn pixels(&self) -> Pixels<'_, Self> ⓘ { ... }
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView> { ... }
}
Expand description
Trait to inspect an image.
Required Associated Types
sourcetype InnerImageView: GenericImageView<Pixel = Self::Pixel>
type InnerImageView: GenericImageView<Pixel = Self::Pixel>
Underlying image type. This is mainly used by SubImages in order to always have a reference to the original image. This allows for less indirections and it eases the use of nested SubImages.
Required Methods
sourcefn dimensions(&self) -> (u32, u32)
fn dimensions(&self) -> (u32, u32)
The width and height of this image.
sourcefn get_pixel(&self, x: u32, y: u32) -> Self::Pixel
fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel
Returns the pixel located at (x, y)
Panics
Panics if (x, y)
is out of bounds.
TODO: change this signature to &P
sourcefn inner(&self) -> &Self::InnerImageView
fn inner(&self) -> &Self::InnerImageView
Returns a reference to the underlying image.
Provided Methods
sourcefn in_bounds(&self, x: u32, y: u32) -> bool
fn in_bounds(&self, x: u32, y: u32) -> bool
Returns true if this x, y coordinate is contained inside the image.
sourceunsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
Returns the pixel located at (x, y)
This function can be implemented in a way that ignores bounds checking.