[−][src]Trait image::GenericImageView
Trait to inspect an image.
Associated Types
type Pixel: Pixel
The type of 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
fn dimensions(&self) -> (u32, u32)
The width and height of this image.
fn bounds(&self) -> (u32, u32, u32, u32)
The bounding rectangle of this image.
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
fn inner(&self) -> &Self::InnerImageView
Returns a reference to the underlying image.
Provided Methods
fn width(&self) -> u32
The width of this image.
fn height(&self) -> u32
The height of this image.
fn in_bounds(&self, x: u32, y: u32) -> bool
Returns true if this x, y coordinate is contained inside the image.
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.
fn pixels(&self) -> Pixels<Self>
Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
Returns an subimage that is an immutable view into this image.
Implementors
impl GenericImageView for DynamicImage
[src]
impl GenericImageView for DynamicImage
type Pixel = Rgba<u8>
type InnerImageView = Self
fn dimensions(&self) -> (u32, u32)
[src]
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
[src]
fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
fn inner(&self) -> &Self::InnerImageView
[src]
fn inner(&self) -> &Self::InnerImageView
fn width(&self) -> u32
[src]
fn width(&self) -> u32
fn height(&self) -> u32
[src]
fn height(&self) -> u32
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
fn in_bounds(&self, x: u32, y: u32) -> bool
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
fn pixels(&self) -> Pixels<Self>
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
[src]
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
impl<I> GenericImageView for SubImage<I> where
I: Deref,
I::Target: GenericImageView + Sized,
[src]
impl<I> GenericImageView for SubImage<I> where
I: Deref,
I::Target: GenericImageView + Sized,
type Pixel = <<I as Deref>::Target as GenericImageView>::Pixel
type InnerImageView = I::Target
fn dimensions(&self) -> (u32, u32)
[src]
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
[src]
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
fn inner(&self) -> &Self::InnerImageView
[src]
fn inner(&self) -> &Self::InnerImageView
fn width(&self) -> u32
[src]
fn width(&self) -> u32
fn height(&self) -> u32
[src]
fn height(&self) -> u32
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
fn in_bounds(&self, x: u32, y: u32) -> bool
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
fn pixels(&self) -> Pixels<Self>
impl<P, Container> GenericImageView for ImageBuffer<P, Container> where
P: Pixel + 'static,
Container: Deref<Target = [P::Subpixel]> + Deref,
P::Subpixel: 'static,
[src]
impl<P, Container> GenericImageView for ImageBuffer<P, Container> where
P: Pixel + 'static,
Container: Deref<Target = [P::Subpixel]> + Deref,
P::Subpixel: 'static,
type Pixel = P
type InnerImageView = Self
fn dimensions(&self) -> (u32, u32)
[src]
fn dimensions(&self) -> (u32, u32)
fn bounds(&self) -> (u32, u32, u32, u32)
[src]
fn bounds(&self) -> (u32, u32, u32, u32)
fn get_pixel(&self, x: u32, y: u32) -> P
[src]
fn get_pixel(&self, x: u32, y: u32) -> P
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> P
[src]
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> P
Returns the pixel located at (x, y), ignoring bounds checking.
fn inner(&self) -> &Self::InnerImageView
[src]
fn inner(&self) -> &Self::InnerImageView
fn width(&self) -> u32
[src]
fn width(&self) -> u32
fn height(&self) -> u32
[src]
fn height(&self) -> u32
fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
fn in_bounds(&self, x: u32, y: u32) -> bool
ⓘImportant traits for Pixels<'a, I>fn pixels(&self) -> Pixels<Self>
[src]
fn pixels(&self) -> Pixels<Self>
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
[src]
fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>