Skip to main content

cursive_image/
sizing.rs

1//
2// Sizing
3//
4
5/// Image sizing.
6///
7/// The default is [Fit](Self::Fit).
8#[derive(Clone, Copy, Debug, Default, PartialEq)]
9pub enum Sizing {
10    /// Shrinks the image if it's too big.
11    #[default]
12    Shrink,
13
14    /// Shrinks the image if it's too big or expands it if it's too small.
15    Fit,
16
17    /// Scale.
18    Scale(f64),
19}
20
21impl Sizing {
22    /// Keep the original size: [Scale](Self::Scale)(1.).
23    pub fn original() -> Self {
24        Self::Scale(1.)
25    }
26}