Trait nannou::image::GenericImageView [−][src]
pub trait GenericImageView { type Pixel: Pixel; type InnerImageView: GenericImageView; pub fn dimensions(&self) -> (u32, u32); pub fn bounds(&self) -> (u32, u32, u32, u32); pub fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel; pub fn inner(&self) -> &Self::InnerImageView; pub fn width(&self) -> u32 { ... } pub fn height(&self) -> u32 { ... } pub fn in_bounds(&self, x: u32, y: u32) -> bool { ... } pub unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel { ... } pub fn pixels(&self) -> Pixels<'_, Self>ⓘ { ... } pub fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView> { ... } }
Trait to inspect an image.
Associated Types
type Pixel: Pixel
[src]
The type of pixel.
type InnerImageView: GenericImageView
[src]
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
pub fn dimensions(&self) -> (u32, u32)
[src]
The width and height of this image.
pub fn bounds(&self) -> (u32, u32, u32, u32)
[src]
The bounding rectangle of this image.
pub fn get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
Returns the pixel located at (x, y). Indexed from top left.
Panics
Panics if (x, y)
is out of bounds.
TODO: change this signature to &P
pub fn inner(&self) -> &Self::InnerImageView
[src]
Returns a reference to the underlying image.
Provided methods
pub fn width(&self) -> u32
[src]
The width of this image.
pub fn height(&self) -> u32
[src]
The height of this image.
pub fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
Returns true if this x, y coordinate is contained inside the image.
pub unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel
[src]
Returns the pixel located at (x, y). Indexed from top left.
This function can be implemented in a way that ignores bounds checking.
Safety
The coordinates must be in_bounds
of the image.
pub fn pixels(&self) -> Pixels<'_, Self>ⓘ
[src]
Returns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value
pub fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
[src]
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&Self::InnerImageView>
Returns an subimage that is an immutable view into this image.
You can use GenericImage::sub_image
if you need a mutable view instead.
The coordinates set the position of the top left corner of the view.
Implementors
impl GenericImageView for DynamicImage
[src]
type Pixel = Rgba<u8>
type InnerImageView = DynamicImage
pub fn dimensions(&self) -> (u32, u32)
[src]
pub fn bounds(&self) -> (u32, u32, u32, u32)
[src]
pub fn get_pixel(&self, x: u32, y: u32) -> Rgba<u8>
[src]
pub fn inner(&self) -> &<DynamicImage as GenericImageView>::InnerImageView
[src]
impl<Buffer, P> GenericImageView for View<Buffer, P> where
P: Pixel,
Buffer: AsRef<[<P as Pixel>::Subpixel]>,
[src]
P: Pixel,
Buffer: AsRef<[<P as Pixel>::Subpixel]>,
type Pixel = P
type InnerImageView = View<Buffer, P>
pub fn dimensions(&self) -> (u32, u32)
[src]
pub fn bounds(&self) -> (u32, u32, u32, u32)
[src]
pub fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
pub fn get_pixel(
&self,
x: u32,
y: u32
) -> <View<Buffer, P> as GenericImageView>::Pixel
[src]
&self,
x: u32,
y: u32
) -> <View<Buffer, P> as GenericImageView>::Pixel
pub fn inner(&self) -> &View<Buffer, P>
[src]
impl<Buffer, P> GenericImageView for ViewMut<Buffer, P> where
P: Pixel,
Buffer: AsMut<[<P as Pixel>::Subpixel]> + AsRef<[<P as Pixel>::Subpixel]>,
[src]
P: Pixel,
Buffer: AsMut<[<P as Pixel>::Subpixel]> + AsRef<[<P as Pixel>::Subpixel]>,
type Pixel = P
type InnerImageView = ViewMut<Buffer, P>
pub fn dimensions(&self) -> (u32, u32)
[src]
pub fn bounds(&self) -> (u32, u32, u32, u32)
[src]
pub fn in_bounds(&self, x: u32, y: u32) -> bool
[src]
pub fn get_pixel(
&self,
x: u32,
y: u32
) -> <ViewMut<Buffer, P> as GenericImageView>::Pixel
[src]
&self,
x: u32,
y: u32
) -> <ViewMut<Buffer, P> as GenericImageView>::Pixel
pub fn inner(&self) -> &ViewMut<Buffer, P>
[src]
impl<I> GenericImageView for SubImage<I> where
I: Deref,
<I as Deref>::Target: GenericImageView,
<I as Deref>::Target: Sized,
[src]
I: Deref,
<I as Deref>::Target: GenericImageView,
<I as Deref>::Target: Sized,
type Pixel = <<I as Deref>::Target as GenericImageView>::Pixel
type InnerImageView = <I as Deref>::Target
pub fn dimensions(&self) -> (u32, u32)
[src]
pub fn bounds(&self) -> (u32, u32, u32, u32)
[src]
pub fn get_pixel(
&self,
x: u32,
y: u32
) -> <SubImage<I> as GenericImageView>::Pixel
[src]
&self,
x: u32,
y: u32
) -> <SubImage<I> as GenericImageView>::Pixel
pub fn view(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&<SubImage<I> as GenericImageView>::InnerImageView>
[src]
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<&<SubImage<I> as GenericImageView>::InnerImageView>
pub fn inner(&self) -> &<SubImage<I> as GenericImageView>::InnerImageView
[src]
impl<P, Container> GenericImageView for ImageBuffer<P, Container> where
P: Pixel + 'static,
Container: Deref<Target = [<P as Pixel>::Subpixel]> + Deref,
<P as Pixel>::Subpixel: 'static,
[src]
P: Pixel + 'static,
Container: Deref<Target = [<P as Pixel>::Subpixel]> + Deref,
<P as Pixel>::Subpixel: 'static,
type Pixel = P
type InnerImageView = ImageBuffer<P, Container>
pub fn dimensions(&self) -> (u32, u32)
[src]
pub fn bounds(&self) -> (u32, u32, u32, u32)
[src]
pub fn get_pixel(&self, x: u32, y: u32) -> P
[src]
pub unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> P
[src]
Returns the pixel located at (x, y), ignoring bounds checking.
pub fn inner(
&self
) -> &<ImageBuffer<P, Container> as GenericImageView>::InnerImageView
[src]
&self
) -> &<ImageBuffer<P, Container> as GenericImageView>::InnerImageView