Table of Contents

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

bool

Methods

DeleteImage(uint)

Delete a previously transmitted image from the terminal.

void DeleteImage(uint imageId)

Parameters

imageId uint

The 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

imageId uint

Unique image identifier.

pngData byte[]

PNG-encoded image data.

columns int

Number of terminal columns the image spans.

rows int

Number 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

imageId uint

Unique image identifier. Reuse across frames for in-place updates.

rgbData byte[]

Raw RGB24 pixel data, pixelWidth * pixelHeight * 3 bytes, row-major.

pixelWidth int

Pixel width of the frame.

pixelHeight int

Pixel height of the frame.

columns int

Number of terminal columns the image spans.

rows int

Number 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)

Parameters

imageId uint
rgbData byte[]
pixelWidth int
pixelHeight int