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§
Sourcefn within_bounds<C>(&self, coords: C) -> boolwhere
C: ImageCoordinate,
fn within_bounds<C>(&self, coords: C) -> boolwhere
C: ImageCoordinate,
Returns true if the given coordinates are within the bounds of the image.
Sourcefn get_pixel_at<C>(&self, coords: C) -> Option<Self::Pixel>where
C: ImageCoordinate,
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.
Sourcefn get_pixel_clamped<C>(&self, coords: C) -> Self::Pixelwhere
C: ImageCoordinate,
fn get_pixel_clamped<C>(&self, coords: C) -> Self::Pixelwhere
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.