pub struct PatchedKitty { /* private fields */ }Expand description
The patched kitty surface presenter: transmits the whole surface once, then per frame retransmits only the tiles whose pixels changed, each as its own small image under a stable tile id, placed over the base. The kitty protocol has no in-place pixel update (retransmitting an id replaces the image and its placements), so a tile id is simply retransmitted and its placement replaced without flicker. A frame with more damaged tiles than the patch budget, a resize, or anything that loses the base image falls back to one whole retransmit. An unchanged frame writes nothing.
The default tile side is cell.width * cell.height pixels, a
multiple of both cell axes, so every tile maps to whole cells and
patch edges never tear.
Implementations§
Source§impl PatchedKitty
impl PatchedKitty
Sourcepub fn new(base: u32, cell: CellPixels) -> Self
pub fn new(base: u32, cell: CellPixels) -> Self
A presenter for surfaces drawn at cell pixel resolution, handing
out image ids from base upward, tiling at the cell-derived side
with the sprite-friendly budget of 64 tiles.
Sourcepub fn with_tiles(
base: u32,
cell: CellPixels,
tile_side: u32,
budget: usize,
) -> Self
pub fn with_tiles( base: u32, cell: CellPixels, tile_side: u32, budget: usize, ) -> Self
A presenter with an explicit tile_side in surface pixels and
budget, the damaged-tile count past which one whole retransmit
wins. Fine-grained surfaces want small tiles and a high budget;
the tile’s cell span always follows the surface-to-area scale.
Sourcepub fn set_cell(&mut self, cell: CellPixels)
pub fn set_cell(&mut self, cell: CellPixels)
Draw placeholder tiles for cells of cell pixels from now on, after
a font zoom changed them.
Sourcepub fn repaint(&mut self)
pub fn repaint(&mut self)
Send every pixel again on the next frame, for when the terminal may have lost what it was showing.
Sourcepub fn free<W: Sink>(&mut self, out: &mut W) -> Result<()>
pub fn free<W: Sink>(&mut self, out: &mut W) -> Result<()>
Free every image this presenter sent and repaint on the next frame.
Sourcepub fn for_multiplexer(self, space: IdSpace, relative_placements: bool) -> Self
pub fn for_multiplexer(self, space: IdSpace, relative_placements: bool) -> Self
Send every frame as small tiles for a multiplexer, which drops
uploads bigger than it buffers and hides placeholder text with its
pane. With relative_placements every tile sits on one placeholder
anchor and stretches to its cells; without, each tile shows through
placeholder text of its own, which keeps its aspect and so needs
the true cell size.