Skip to content

KgpCellData

Namespace: Hex1b

Assembly: Hex1b.dll

Immutable data for a KGP (Kitty Graphics Protocol) image placement on a surface cell.

csharp
public sealed class KgpCellData

Inheritance

ObjectKgpCellData

Properties

ClipH

Gets the pixel height of the visible source region (0 = full height).

Returns: Int32

csharp
public int ClipH { get; }

ClipW

Gets the pixel width of the visible source region (0 = full width).

Returns: Int32

csharp
public int ClipW { get; }

ClipX

Gets the pixel X offset into the source image for clipping (0 = no clip).

Returns: Int32

csharp
public int ClipX { get; }

ClipY

Gets the pixel Y offset into the source image for clipping (0 = no clip).

Returns: Int32

csharp
public int ClipY { get; }

HeightInCells

Gets the height of the placement in terminal rows.

Returns: Int32

csharp
public int HeightInCells { get; }

ImageId

Gets the KGP image ID for placement commands.

Returns: UInt32

csharp
public uint ImageId { get; }

IsClipped

Gets whether this placement has a source rectangle clip applied.

Returns: Boolean

csharp
public bool IsClipped { get; }

Payload

Gets the complete payload for emission: transmit (if needed) + placement. For legacy/opaque payloads (SourcePixelWidth == 0), returns TransmitPayload as-is.

Returns: String

csharp
public string Payload { get; }

SourcePixelHeight

Gets the source image height in pixels (for computing clip ratios).

Returns: UInt32

csharp
public uint SourcePixelHeight { get; }

SourcePixelWidth

Gets the source image width in pixels (for computing clip ratios).

Returns: UInt32

csharp
public uint SourcePixelWidth { get; }

TransmitPayload

Gets the transmit payload (a=t with image data), or null if the image was already transmitted (cache hit → use a=p only).

Returns: String

csharp
public string? TransmitPayload { get; }

WidthInCells

Gets the width of the placement in terminal columns.

Returns: Int32

csharp
public int WidthInCells { get; }

ZIndex

Gets the z-index for KGP placement stacking order relative to text. Negative values render behind text, positive values render on top of text.

Returns: Int32

csharp
public int ZIndex { get; }

Remarks

Stores structured placement parameters so that clipping can adjust the source rectangle without re-encoding the image data. The transmit payload (a=t) is stored separately from the placement parameters so that the placement command (a=p) can be regenerated with different source rectangles after compositing clips.

Released under the MIT License.