pub enum ContentScale {
Fit,
Crop,
FillBounds,
FillWidth,
FillHeight,
Inside,
None,
}Expand description
How an image is scaled to fit the bounds it is drawn into. Compose’s ContentScale.
Variants§
Fit
Scales both axes by one factor so the whole image fits inside the bounds, leaving space on one axis.
Crop
Scales both axes by one factor so the image covers the bounds, cropping what overflows.
FillBounds
Scales each axis separately so the image fills the bounds, which distorts its aspect ratio.
FillWidth
Scales both axes by one factor so the image width matches the bounds width.
FillHeight
Scales both axes by one factor so the image height matches the bounds height.
Inside
Like Fit, but never enlarges an image that already fits inside the bounds.
None
Draws the image at its own size without scaling.
Implementations§
Source§impl ContentScale
impl ContentScale
Sourcepub fn scaled_size(self, src_size: Size, dst_size: Size) -> Size
pub fn scaled_size(self, src_size: Size, dst_size: Size) -> Size
Returns the size of an image of src_size after this scale fits it to dst_size. For
Crop the result can exceed dst_size. Returns zero size if a side of either size is zero
or negative.
Trait Implementations§
Source§impl Clone for ContentScale
impl Clone for ContentScale
impl Copy for ContentScale
Source§impl Debug for ContentScale
impl Debug for ContentScale
Source§impl PartialEq for ContentScale
impl PartialEq for ContentScale
impl StructuralPartialEq for ContentScale
Auto Trait Implementations§
impl Freeze for ContentScale
impl RefUnwindSafe for ContentScale
impl Send for ContentScale
impl Sync for ContentScale
impl Unpin for ContentScale
impl UnsafeUnpin for ContentScale
impl UnwindSafe for ContentScale
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more