Skip to content

SixelCellMetrics ​

Namespace: Hex1b.Sixel

Assembly: Hex1b.dll

The protocol cell metrics a Sixel placement is measured against.

csharp
public readonly record struct SixelCellMetrics : IEquatable<SixelCellMetrics>

Implements ​

Constructors ​

SixelCellMetrics(double, double, SixelCellMetricsSource, SixelCellMetricsReliability) ​

The protocol cell metrics a Sixel placement is measured against.

Parameters:

csharp
public SixelCellMetrics(double Width, double Height, SixelCellMetricsSource Source, SixelCellMetricsReliability Reliability)

Properties ​

Height ​

The protocol cell height in pixels. May be fractional.

Returns: Double

csharp
public double Height { get; init; }

IsAuthoritative ​

Gets a value indicating whether the metrics were reported by the upstream presentation for the Sixel protocol grid.

Returns: Boolean

csharp
public bool IsAuthoritative { get; }

Reliability ​

How much the metrics can be trusted.

Returns: SixelCellMetricsReliability

csharp
public SixelCellMetricsReliability Reliability { get; init; }

SafeHeight ​

Gets the sanitized cell height.

Returns: Double

csharp
public double SafeHeight { get; }

SafeWidth ​

Gets the sanitized cell width. Non-positive or non-finite widths fall back to so occupancy math stays deterministic.

Returns: Double

csharp
public double SafeWidth { get; }

Source ​

Where the metrics came from.

Returns: SixelCellMetricsSource

csharp
public SixelCellMetricsSource Source { get; init; }

Unknown ​

The documented fallback used when nothing is known about the presentation.

Returns: SixelCellMetrics

csharp
public static SixelCellMetrics Unknown { get; }

Width ​

The protocol cell width in pixels. May be fractional.

Returns: Double

csharp
public double Width { get; init; }

Methods ​

ColumnsFor(int) ​

Computes the number of columns a rendered pixel width occupies.

Parameters:

  • renderedPixelWidth (Int32): The aspect-scaled horizontal extent.

Returns: Int32

csharp
public int ColumnsFor(int renderedPixelWidth)

FromCapabilities(TerminalCapabilities) ​

Creates metrics derived from .

Parameters:

Returns: SixelCellMetrics

csharp
public static SixelCellMetrics FromCapabilities(TerminalCapabilities capabilities)

RowsFor(int) ​

Computes the number of rows a rendered pixel height occupies.

Parameters:

  • renderedPixelHeight (Int32): The aspect-scaled vertical extent.

Returns: Int32

csharp
public int RowsFor(int renderedPixelHeight)

ToString() ​

Formats the metrics for diagnostics, keeping estimated values visibly distinct from authoritative ones.

Returns: String

csharp
public override string ToString()

Remarks ​

Metrics are captured once, when a completed Sixel sequence creates a placement, so a later metric change cannot retroactively alter an existing placement's recorded occupancy. Discovering real upstream metrics is owned by #455; this type only models the value and lets tests and adapters inject one.

Occupancy always uses ceiling division of the rendered (aspect-scaled) pixel extent, so a graphic one pixel past a cell boundary occupies the whole next cell.

Released under the MIT License.