Trait exr::image::crop::Crop

source ·
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§

source

type Cropped

The type of this image after cropping (probably the same as before)

Required Methods§

source

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§

source

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.

Implementors§

source§

impl<Channels> Crop for Layer<Channels>

§

type Cropped = Layer<CroppedChannels<Channels>>