Trait GenericImageView
trait GenericImageView
Trait to inspect an image.
use ;
let buffer = new;
let image: &dyn = &buffer;
Associated Types
type Pixel: TraitBound { trait_: Path { path: "Pixel", id: Id(450), args: None }, generic_params: [], modifier: None }The type of pixel.
Required Methods
fn dimensions(self: &Self) -> (u32, u32)The width and height of this image.
fn get_pixel(self: &Self, x: u32, y: u32) -> <Self as >::PixelReturns the pixel located at (x, y). Indexed from top left.
Panics
Panics if
(x, y)is out of bounds.
Provided Methods
fn width(self: &Self) -> u32The width of this image.
fn height(self: &Self) -> u32The height of this image.
fn in_bounds(self: &Self, x: u32, y: u32) -> boolReturns true if this x, y coordinate is contained inside the image.
unsafe fn unsafe_get_pixel(self: &Self, x: u32, y: u32) -> <Self as >::PixelReturns 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_boundsof the image.fn pixels(self: &Self) -> Pixels<'_, Self> where Self: SizedReturns an Iterator over the pixels of this image. The iterator yields the coordinates of each pixel along with their value
fn view(self: &Self, x: u32, y: u32, width: u32, height: u32) -> SubImage<&Self> where Self: SizedReturns a subimage that is an immutable view into this image. You can use
GenericImage::sub_imageif you need a mutable view instead. The coordinates set the position of the top left corner of the view.
Implementors
impl<Buffer, P: Pixel> GenericImageView for ViewMut<Buffer, P>impl<P, Container> GenericImageView for ImageBuffer<P, Container>impl<Buffer, P: Pixel> GenericImageView for View<Buffer, P>impl GenericImageView for DynamicImage