pub trait CropWhere<Sample>: Sized {
type Cropped;
// Required methods
fn crop_where(
self,
discard_if: impl Fn(Sample) -> bool,
) -> CropResult<Self::Cropped, Self>;
fn crop_where_eq(
self,
discard_color: impl Into<Sample>,
) -> CropResult<Self::Cropped, Self>
where Sample: PartialEq;
fn crop_nowhere(self) -> Self::Cropped;
}
Expand description
Crop away unwanted pixels from the border if they match the specified rule.
Required Associated Types§
Required Methods§
Sourcefn crop_where(
self,
discard_if: impl Fn(Sample) -> bool,
) -> CropResult<Self::Cropped, Self>
fn crop_where( self, discard_if: impl Fn(Sample) -> bool, ) -> CropResult<Self::Cropped, Self>
Crop away unwanted pixels from the border if they match the specified rule.
Does not reduce allocation size of the current image, but instead only adjust a few boundary numbers.
Use reallocate_cropped()
on the return value to actually reduce the memory footprint.
Sourcefn crop_where_eq(
self,
discard_color: impl Into<Sample>,
) -> CropResult<Self::Cropped, Self>where
Sample: PartialEq,
fn crop_where_eq(
self,
discard_color: impl Into<Sample>,
) -> CropResult<Self::Cropped, Self>where
Sample: PartialEq,
Crop away unwanted pixels from the border if they match the specified color.
If you want discard based on a rule, use crop_where
with a closure instead.
Does not reduce allocation size of the current image, but instead only adjust a few boundary numbers.
Use reallocate_cropped()
on the return value to actually reduce the memory footprint.
Sourcefn crop_nowhere(self) -> Self::Cropped
fn crop_nowhere(self) -> Self::Cropped
Convert this data to cropped data without discarding any pixels.
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.