pub struct HalfBlockImage {
pub width: u32,
pub height: u32,
pub pixels: Vec<(Color, Color)>,
}Expand description
A terminal-renderable image stored as a grid of Color values.
Each cell contains a foreground color (upper pixel) and background color
(lower pixel), rendered using the ▀ half-block character.
Create from an image::DynamicImage with HalfBlockImage::from_dynamic
(requires image feature), or construct manually from raw RGB data with
HalfBlockImage::from_rgb.
Fields§
§width: u32Width in terminal columns.
height: u32Height in terminal rows (each row = 2 image pixels).
pixels: Vec<(Color, Color)>Row-major pairs of (upper_color, lower_color) for each cell.
Implementations§
Source§impl HalfBlockImage
impl HalfBlockImage
Sourcepub fn from_dynamic(img: &DynamicImage, width: u32, height: u32) -> Self
pub fn from_dynamic(img: &DynamicImage, width: u32, height: u32) -> Self
Create a half-block image from a DynamicImage, resized to fit
the given terminal cell dimensions.
The image is resized to width x (height * 2) pixels using Lanczos3
filtering, then each pair of vertically adjacent pixels is packed
into one terminal cell.
Auto Trait Implementations§
impl Freeze for HalfBlockImage
impl RefUnwindSafe for HalfBlockImage
impl Send for HalfBlockImage
impl Sync for HalfBlockImage
impl Unpin for HalfBlockImage
impl UnsafeUnpin for HalfBlockImage
impl UnwindSafe for HalfBlockImage
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