Skip to main content

PixelScreen

Struct PixelScreen 

Source
pub struct PixelScreen { /* private fields */ }
Expand description

Renders a pixel surface full-screen through the best strategy the terminal offers.

Implementations§

Source§

impl PixelScreen

Source

pub fn new(caps: &Capabilities, cell: CellPixels, patched: PatchedKitty) -> Self

The screen for caps with cells of cell pixels: patched when the terminal speaks the kitty graphics protocol, sixel tiles when it speaks sixel, quarter blocks otherwise.

Source

pub fn picture(caps: &Capabilities, cell: CellPixels) -> Self

The screen for a terminal without kitty graphics: sixel tiles when it speaks sixel, quarter blocks otherwise.

Source

pub fn rows_shown(&self, rows: u16) -> u16

How many of rows screen rows a frame covers. Sixel leaves the bottom row free, because a sixel touching it scrolls the screen.

Source

pub fn animated( caps: &Capabilities, cell: CellPixels, animated: AnimatedKitty, fallback: PatchedKitty, ) -> Self

The same screen driven by a terminal-side animation when the terminal stores animation frames outside a multiplexer, which swallows frames, and by Self::new with fallback otherwise.

Source

pub fn set_cell(&mut self, cell: CellPixels)

Draw for cells of cell pixels from now on, after a font zoom.

Source

pub fn repaint(&mut self)

Send every graphics pixel again on the next frame, for when the terminal may have lost its images, such as after a window resize.

Source

pub fn free<W: Sink>(&mut self, out: &mut W) -> Result<()>

Free every graphics image this screen sent and repaint on the next frame, for a screen that went out of view or is being replaced.

Source

pub fn render_frame<W: Sink>( &mut self, out: &mut W, surface: &Surface, columns: u16, rows: u16, ) -> Result<usize>

Write surface scaled to the whole columns x rows screen and return the bytes written. Blocks show two by two pixels a cell, so a surface of another size is resized to that first.

Trait Implementations§

Source§

impl Debug for PixelScreen

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PixelScreen

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.