pub trait Crop: Sized {
type Cropped;
// Required method
fn crop(self, bounds: IntegerBounds) -> Self::Cropped;
// Provided method
fn try_crop(
self,
bounds: Option<IntegerBounds>,
) -> CropResult<Self::Cropped, Self> { ... }
}
Expand description
Crop some pixels ways when specifying a smaller rectangle
Required Associated Types§
Required Methods§
sourcefn crop(self, bounds: IntegerBounds) -> Self::Cropped
fn crop(self, bounds: IntegerBounds) -> Self::Cropped
Crop the image to exclude unwanted pixels.
Panics for invalid (larger than previously) bounds.
The bounds are specified in absolute coordinates.
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.
Provided Methods§
sourcefn try_crop(
self,
bounds: Option<IntegerBounds>,
) -> CropResult<Self::Cropped, Self>
fn try_crop( self, bounds: Option<IntegerBounds>, ) -> CropResult<Self::Cropped, Self>
Reduce your image to a smaller part, usually to save memory.
Crop if bounds are specified, return the original if no bounds are specified.
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.
Object Safety§
This trait is not object safe.