SixelCellMetrics
Namespace: Hex1b.Sixel
Assembly: Hex1b.dll
The protocol cell metrics a Sixel placement is measured against.
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:
Width(Double): The protocol cell width in pixels. May be fractional.Height(Double): The protocol cell height in pixels. May be fractional.Source(SixelCellMetricsSource): Where the metrics came from.Reliability(SixelCellMetricsReliability): How much the metrics can be trusted.
public SixelCellMetrics(double Width, double Height, SixelCellMetricsSource Source, SixelCellMetricsReliability Reliability)Properties
Height
The protocol cell height in pixels. May be fractional.
Returns: Double
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
public bool IsAuthoritative { get; }Reliability
How much the metrics can be trusted.
Returns: SixelCellMetricsReliability
public SixelCellMetricsReliability Reliability { get; init; }SafeHeight
Gets the sanitized cell height.
Returns: Double
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
public double SafeWidth { get; }Source
Where the metrics came from.
Returns: SixelCellMetricsSource
public SixelCellMetricsSource Source { get; init; }Unknown
The documented fallback used when nothing is known about the presentation.
Returns: SixelCellMetrics
public static SixelCellMetrics Unknown { get; }Width
The protocol cell width in pixels. May be fractional.
Returns: Double
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
public int ColumnsFor(int renderedPixelWidth)FromCapabilities(TerminalCapabilities)
Creates metrics derived from .
Parameters:
capabilities(TerminalCapabilities):
Returns: SixelCellMetrics
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
public int RowsFor(int renderedPixelHeight)ToString()
Formats the metrics for diagnostics, keeping estimated values visibly distinct from authoritative ones.
Returns: String
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.