pub enum Resize {
Fit(Option<FilterType>),
Crop(Option<CropOptions>),
Scale(Option<FilterType>),
}Expand description
Resize method
Variants§
Fit(Option<FilterType>)
Fit to area.
If the width or height is smaller than the area, the image will be resized maintaining proportions.
The FilterType (re-exported from the image crate) defaults to FilterType::Nearest.
Crop(Option<CropOptions>)
Crop to area.
If the width or height is smaller than the area, the image will be cropped.
The behaviour is the same as using Image widget with the overhead of resizing,
but some terminals might misbehave when overdrawing characters over graphics.
For example, the sixel branch of Alacritty never draws text over a cell that is currently
being rendered by some sixel sequence, not necessarily originating from the same cell.
The CropOptions defaults to clipping the bottom and the right sides.
Scale(Option<FilterType>)
Scale the image
Same as Resize::Fit except it resizes the image even if the image is smaller than the render area
Implementations§
Source§impl Resize
impl Resize
Sourcepub fn needs_resize(
&self,
image: &ImageSource,
font_size: FontSize,
current: Rect,
area: Rect,
force: bool,
) -> Option<Rect>
pub fn needs_resize( &self, image: &ImageSource, font_size: FontSize, current: Rect, area: Rect, force: bool, ) -> Option<Rect>
Check if ImageSource’s “desired” fits into area and is different than current.
The returned Rect is the area the image needs to be resized to, depending on the resize
type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Resize
impl RefUnwindSafe for Resize
impl Send for Resize
impl Sync for Resize
impl Unpin for Resize
impl UnwindSafe for Resize
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> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().