Skip to content

SixelData

Namespace: Hex1b

Assembly: Hex1b.dll

Immutable data containing Sixel graphics information.

csharp
public sealed class SixelData

Inheritance

ObjectSixelData

Properties

HeightInCells

Gets the height of the Sixel image in cells.

Returns: Int32

csharp
public int HeightInCells { get; }

Payload

Gets the raw Sixel DCS sequence (ESC P ... ESC ).

Returns: String

csharp
public string Payload { get; }

PixelHeight

Gets the height of the Sixel image in pixels.

Returns: Int32

csharp
public int PixelHeight { get; }

PixelWidth

Gets the width of the Sixel image in pixels.

Returns: Int32

csharp
public int PixelWidth { get; }

WidthInCells

Gets the width of the Sixel image in cells.

Returns: Int32

csharp
public int WidthInCells { get; }

Methods

GetCellSpan(CellMetrics)

Gets the cell span for this sixel using the specified cell metrics.

Parameters:

  • metrics (CellMetrics): The cell metrics to use for conversion.

Returns: ValueTuple<Int32, Int32>

The width and height in cells.

csharp
public (int Width, int Height) GetCellSpan(CellMetrics metrics)

GetPixels()

Decodes the sixel payload to a pixel buffer. The result is cached for subsequent calls.

Returns: SixelPixelBuffer

The decoded pixel buffer, or null if decoding fails.

csharp
public SixelPixelBuffer? GetPixels()

Remarks

Sixel data is content-addressable: identical payloads share the same instance. This deduplicates memory when the same image appears in multiple cells or is re-rendered.

The raw DCS sequence is stored so it can be re-emitted during rendering. Pixel dimensions are parsed from the raster attributes in the payload.

Released under the MIT License.