Enum exr::image::crop::CropResult
source · pub enum CropResult<Cropped, Old> {
Cropped(Cropped),
Empty {
original: Old,
},
}
Expand description
Cropping an image fails if the image is fully transparent.
Use [or_crop_to_1x1_if_empty
] or [or_none_if_empty
] to obtain a normal image again.
Variants§
Cropped(Cropped)
The image contained some pixels and has been cropped or left untouched
Empty
Fields
§
original: Old
The fully discarded image which caused the cropping to fail
All pixels in the image would be discarded, removing the whole image
Implementations§
source§impl<Cropped, Original> CropResult<Cropped, Original>
impl<Cropped, Original> CropResult<Cropped, Original>
sourcepub fn or_none_if_empty(self) -> Option<Cropped>
pub fn or_none_if_empty(self) -> Option<Cropped>
If the image was fully empty, return None
, otherwise return Some(cropped_image)
.
sourcepub fn or_crop_to_1x1_if_empty(self) -> Croppedwhere
Original: Crop<Cropped = Cropped> + GetBounds,
pub fn or_crop_to_1x1_if_empty(self) -> Croppedwhere Original: Crop<Cropped = Cropped> + GetBounds,
If the image was fully empty, crop to one single pixel of all the transparent pixels instead, leaving the layer intact while reducing memory usage.
Trait Implementations§
source§impl<Cropped: Clone, Old: Clone> Clone for CropResult<Cropped, Old>
impl<Cropped: Clone, Old: Clone> Clone for CropResult<Cropped, Old>
source§fn clone(&self) -> CropResult<Cropped, Old>
fn clone(&self) -> CropResult<Cropped, Old>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Cropped: PartialEq, Old: PartialEq> PartialEq<CropResult<Cropped, Old>> for CropResult<Cropped, Old>
impl<Cropped: PartialEq, Old: PartialEq> PartialEq<CropResult<Cropped, Old>> for CropResult<Cropped, Old>
source§fn eq(&self, other: &CropResult<Cropped, Old>) -> bool
fn eq(&self, other: &CropResult<Cropped, Old>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.