Interface IGraphicsProtocol
- Namespace
- SharpConsoleUI.Drivers
- Assembly
- SharpConsoleUI.dll
Interface for terminal graphics protocol support (e.g. Kitty graphics protocol). Implemented by console drivers that can transmit and display pixel-based images directly in the terminal, bypassing character-cell rendering.
public interface IGraphicsProtocol
- Extension Methods
Properties
SupportsKittyGraphics
Whether the terminal supports Kitty graphics protocol.
bool SupportsKittyGraphics { get; }
Property Value
Methods
DeleteImage(uint)
Delete a previously transmitted image from the terminal.
void DeleteImage(uint imageId)
Parameters
imageIduintThe image identifier to delete.
TransmitImage(uint, byte[], int, int)
Transmit an image to the terminal for virtual placement. The image is assigned the given ID and sized to span the specified number of terminal columns and rows.
void TransmitImage(uint imageId, byte[] pngData, int columns, int rows)
Parameters
imageIduintUnique image identifier.
pngDatabyte[]PNG-encoded image data.
columnsintNumber of terminal columns the image spans.
rowsintNumber of terminal rows the image spans.
TransmitRawRgb(uint, byte[], int, int, int, int)
Transmit a raw RGB24 frame to the terminal, sized to span the given cell area.
Retransmitting with the same imageId updates the image in place,
which is how high-frame-rate video playback works without per-frame delete churn.
The default implementation throws NotSupportedException; drivers that
support streaming raw frames (such as NetConsoleDriver for Kitty graphics)
override it.
void TransmitRawRgb(uint imageId, byte[] rgbData, int pixelWidth, int pixelHeight, int columns, int rows)
Parameters
imageIduintUnique image identifier. Reuse across frames for in-place updates.
rgbDatabyte[]Raw RGB24 pixel data,
pixelWidth*pixelHeight* 3 bytes, row-major.pixelWidthintPixel width of the frame.
pixelHeightintPixel height of the frame.
columnsintNumber of terminal columns the image spans.
rowsintNumber of terminal rows the image spans.
UpdateRawRgbFrame(uint, byte[], int, int)
Update the root-frame pixel data of a previously transmitted image with fresh raw RGB24 bytes, without affecting any active placements. This is the correct primitive for streaming video: the existing virtual placements keep referencing the image and the terminal redraws them against the new pixels. Issuing TransmitRawRgb(uint, byte[], int, int, int, int) with the same id would instead delete all existing placements per the Kitty protocol spec, which would cause the image to disappear until placeholder cells are re-emitted.
void UpdateRawRgbFrame(uint imageId, byte[] rgbData, int pixelWidth, int pixelHeight)