pub struct Kitty { /* private fields */ }Expand description
The kitty presenter. Holds wire state only: which images were sent and which placement pairs are live. Scene ids throughout; the wrap into protocol ids happens once, at each encode.
Implementations§
Source§impl Kitty
impl Kitty
Sourcepub fn for_multiplexer(self, space: IdSpace) -> Self
pub fn for_multiplexer(self, space: IdSpace) -> Self
Place every image relative to a placeholder anchor under a
multiplexer, which then hides them with their pane. We also leave
out the synchronized-output wrapper there, because we send terminal
queries between batches and a terminal holds its answers until a
synchronized update ends.
Every image id goes into space, so programs sharing the terminal
keep their images apart.
Sourcepub fn banded(self, banded: bool) -> Self
pub fn banded(self, banded: bool) -> Self
Send big images as a blank image plus bands of rows, so a multiplexer can pace between them. The bands are frame edits, so only a terminal that stores animation frames takes them.
Sourcepub fn reset<W: Sink>(&mut self, out: &mut W) -> Result<()>
pub fn reset<W: Sink>(&mut self, out: &mut W) -> Result<()>
Free every image this presenter sent and forget them all, as for a new window. Other programs on the terminal keep theirs.
Sourcepub fn render<W: Sink>(
&mut self,
out: &mut W,
delta: &PlacementDelta,
images: &Images<'_>,
) -> Result<usize>
pub fn render<W: Sink>( &mut self, out: &mut W, delta: &PlacementDelta, images: &Images<'_>, ) -> Result<usize>
Write delta as kitty graphics frames and return the byte count,
the input of the frame budget pacing. The whole exchange sits in
DEC 2026 synchronized output and leaves in one write, so a
terminal never shows half of it. An empty diff writes nothing.
Added placements place their image, transmitting it once if this
presenter has not sent it yet; an added placement whose image is
missing from images is skipped, because its pixels are not on
the wire. Moves re-place their pair at the new origin. Removed
pairs delete themselves, and an image whose last placement left is
deleted whole.