Enum CropResult
#[must_use]
pub enum CropResult<Cropped, Old>
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 { original: Old } All pixels in the image would be discarded, removing the whole image
Implementations
impl<Cropped, Original> CropResult<Cropped, Original>
fn or_none_if_empty(self) -> Option<Cropped>If the image was fully empty, return
None, otherwise returnSome(cropped_image).fn or_crop_to_1x1_if_empty(self) -> Cropped where 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.
Panics
Panics if the layer has zero width and height (which indicates an invalid layer state). This should never happen with properly constructed images.
Trait Implementations
impl<Cropped: Clone, Old: Clone> Clone for CropResult<Cropped, Old>
fn clone(&self) -> Self
impl<Cropped: Copy, Old: Copy> Copy for CropResult<Cropped, Old>
impl<Cropped: Debug, Old: Debug> Debug for CropResult<Cropped, Old>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<Cropped: Eq, Old: Eq> Eq for CropResult<Cropped, Old>
impl<Cropped: PartialEq, Old: PartialEq> PartialEq for CropResult<Cropped, Old>
fn eq(&self, other: &Self) -> bool