Struct ratatu_image::ImageSource
source · pub struct ImageSource {
pub image: DynamicImage,
pub font_size: FontSize,
pub desired: Rect,
pub hash: u64,
}
Expand description
Image source for crate::backend::ResizeBackends
A [ResizeBackend]
needs to resize the ImageSource to its state when the available area
changes. A [FixedBackend]
only needs it once.
Examples
use image::{DynamicImage, ImageBuffer, Rgb};
use ratatu_image::ImageSource;
let image: ImageBuffer::from_pixel(300, 200, Rgb::<u8>([255, 0, 0])).into();
let source = ImageSource::new(image, "filename.png", (7, 14));
assert_eq!((43, 14), (source.rect.width, source.rect.height));
Fields§
§image: DynamicImage
The original image without resizing
font_size: FontSize
The font size of the terminal
desired: Rect
The area that the ImageSource::image
covers, but not necessarily fills
hash: u64
Implementations§
source§impl ImageSource
impl ImageSource
sourcepub fn new(image: DynamicImage, font_size: FontSize) -> ImageSource
pub fn new(image: DynamicImage, font_size: FontSize) -> ImageSource
Create a new image source
Trait Implementations§
source§impl Clone for ImageSource
impl Clone for ImageSource
source§fn clone(&self) -> ImageSource
fn clone(&self) -> ImageSource
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for ImageSource
impl Send for ImageSource
impl Sync for ImageSource
impl Unpin for ImageSource
impl UnwindSafe for ImageSource
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