Files

llimphi-term-graphics

Agnostic decoder of terminal graphics protocols.

Two protocols covered:

  • kitty graphics protocol — APC sequences \e_G<control>;<base64>\e\\. It supports chunked transmission (m=1), the f=100 (PNG/JPEG/… through the image crate), f=24 (raw RGB) and f=32 (raw RGBA) formats, and o=z (zlib) compression. Actions t/T (transmit [and display]), q (query), d (delete).
  • sixel — DCS sequences \eP<params>q<data>\e\\. A hand-written decoder (palette, # colour selection, ! RLE, $ CR, - LF, " raster attributes).

Its heart is GraphicsScanner: a streaming automaton fed the PTY's byte chunks. It lets all ordinary text and ANSI escapes through untouched (so the vt100 emulator can process them) and only hijacks complete graphics sequences, returning them decoded as a GraphicsCommand. It has no UI state and no render dependencies: it produces RGBA8 pixels and the caller uploads them to a texture or a peniko::Image.

It is robust to chunk boundaries: a sequence split across two feed() calls is buffered and completed on the next one.


Part of llimphi — see llimphi.