ExtendedImageView

Trait ExtendedImageView 

Source
pub trait ExtendedImageView: GenericImageView {
    // Provided methods
    fn edges(&self) -> (u32, u32) { ... }
    fn within_bounds<C>(&self, coords: C) -> bool
       where C: ImageCoordinate { ... }
    fn get_pixel_at<C>(&self, coords: C) -> Option<Self::Pixel>
       where C: ImageCoordinate { ... }
    fn get_pixel_clamped<C>(&self, coords: C) -> Self::Pixel
       where C: ImageCoordinate { ... }
}
Expand description

A trait that extends the standard GenericImageView with additional convenience methods for coordinate-based image operations like getting pixel optionally at specific coordinates or clamped to image bounds, allowing to use negative values as coordinates.

Provided Methods§

Source

fn edges(&self) -> (u32, u32)

Right and bottom index edges of the image.

Source

fn within_bounds<C>(&self, coords: C) -> bool
where C: ImageCoordinate,

Returns true if the given coordinates are within the bounds of the image.

Source

fn get_pixel_at<C>(&self, coords: C) -> Option<Self::Pixel>
where C: ImageCoordinate,

Returns the pixel at the given coordinates if it is within the bounds of the image.

Source

fn get_pixel_clamped<C>(&self, coords: C) -> Self::Pixel
where C: ImageCoordinate,

Returns the pixel at the given coordinates, clamping the coordinates to the image bounds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ExtendedImageView for DynamicImage

Source§

impl<P: Pixel, Buffer> ExtendedImageView for View<Buffer, P>
where Buffer: AsRef<[P::Subpixel]>,

Source§

impl<P: Pixel, Buffer> ExtendedImageView for ViewMut<Buffer, P>
where Buffer: AsRef<[P::Subpixel]> + AsMut<[P::Subpixel]>,

Source§

impl<P: Pixel, Container> ExtendedImageView for ImageBuffer<P, Container>
where Container: Deref<Target = [P::Subpixel]>,

Implementors§