#ifndef GBC_KITTY_H #define GBC_KITTY_H #include "types.h" // ---- kitty graphics protocol output --------------------------------------- // Sixel's poor relations: a 256-color palette per frame, no alpha, no layering, // no image ids. The kitty protocol has none of those limits, so this backend // ships the framebuffer as raw truecolor pixels (no quantization at all) and // can stack a translucent HUD *above* the game with a z-index. // // Two ways to hand the pixels over: // b64 - the bytes ride inline in the escape sequence (works everywhere the // protocol does, incl. over ssh and through tmux passthrough) // shm - the bytes go into a POSIX shared memory object and only its name is // sent; near-zero cost, but the terminal must be on this machine enum { KITTY_XFER_AUTO = 0, KITTY_XFER_B64, KITTY_XFER_SHM }; // scale = integer pixel zoom (1-8). Safe to call repeatedly. void kitty_init(int scale, int transfer); // Drop every image we put on screen (called on exit / when leaving the mode). void kitty_shutdown(void); // Re-read the terminal cell size (call after SIGWINCH). void kitty_refresh_metrics(void); // Which transfer method ended up in use ("shm" / "b64"), for the stats line. const char *kitty_transfer_name(void); // Transmit + place an RGB888 frame (w*h*3) at the top-left cell. Byte-identical // consecutive frames are dropped unless force is set. void kitty_frame_rgb(const u8 *rgb, int w, int h, bool force); // Transmit + place an RGBA8888 overlay (w*h*4) above the frame (z-index 1), // anchored at the top-left cell. Also skipped when unchanged. void kitty_overlay_rgba(const u8 *rgba, int w, int h, bool force); // Remove the overlay image (e.g. when the HUD is toggled off). void kitty_overlay_clear(void); #endif