#[non_exhaustive]pub enum Fit {
Fill,
Inside,
Outside,
Cover,
Contain,
}Expand description
How a resize reconciles the requested box with the source aspect ratio, with sharp’s meanings.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Fill
Stretch to exactly the box, ignoring aspect ratio.
Inside
Preserve aspect, scaled so the image fits inside the box; the output is the scaled image, at most the box.
Outside
Preserve aspect, scaled so the image covers the box; the output is the scaled image, at least the box.
Cover
Preserve aspect and fill the box exactly: scale to cover it, then crop the overflow, centred.
Contain
Preserve aspect and fill the box exactly: scale to fit inside it,
then pad the rest with ResizeOptions::background, centred.
Trait Implementations§
impl Copy for Fit
impl Eq for Fit
impl StructuralPartialEq for Fit
Auto Trait Implementations§
impl Freeze for Fit
impl RefUnwindSafe for Fit
impl Send for Fit
impl Sync for Fit
impl Unpin for Fit
impl UnsafeUnpin for Fit
impl UnwindSafe for Fit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more