Skip to content

KgpImageData

Namespace: Hex1b

Assembly: Hex1b.dll

Stores transmitted image data for the Kitty Graphics Protocol. Images are identified by ID and may be displayed via multiple placements.

csharp
public sealed class KgpImageData

Inheritance

ObjectKgpImageData

Constructors

KgpImageData(uint, uint, byte[], uint, uint, KgpFormat)

Creates a new KGP image data entry from raw pixel data.

Parameters:

  • imageId (UInt32): The image ID assigned by the client or allocated by the terminal.
  • imageNumber (UInt32): The image number (I key), or 0 if unspecified.
  • data (Byte[]): The raw decoded pixel data.
  • width (UInt32): Image width in pixels.
  • height (UInt32): Image height in pixels.
  • format (KgpFormat): The pixel format of the stored data.
csharp
public KgpImageData(uint imageId, uint imageNumber, byte[] data, uint width, uint height, KgpFormat format)

Properties

ContentHash

SHA256 hash of the data for content-addressable deduplication.

Returns: Byte[]

csharp
public byte[] ContentHash { get; }

Data

The raw decoded pixel data (after base64 decoding, before decompression).

Returns: Byte[]

csharp
public byte[] Data { get; }

Format

The pixel format of the stored data.

Returns: KgpFormat

csharp
public KgpFormat Format { get; }

Height

Image height in pixels.

Returns: UInt32

csharp
public uint Height { get; }

ImageId

The image ID assigned by the client or allocated by the terminal.

Returns: UInt32

csharp
public uint ImageId { get; }

ImageNumber

The image number (I key), if specified. 0 means unspecified.

Returns: UInt32

csharp
public uint ImageNumber { get; }

Is4ByteAligned

Whether pixels are 4-byte aligned (RGBA or PNG).

Returns: Boolean

csharp
public bool Is4ByteAligned { get; }

Width

Image width in pixels.

Returns: UInt32

csharp
public uint Width { get; }

Methods

IsDataSizeValid()

Validates that the data size matches the expected size for the given format and dimensions.

Returns: Boolean

csharp
public bool IsDataSizeValid()

Released under the MIT License.