Skip to content

ISurfaceSource

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Common interface for any source that can provide terminal cells.

csharp
public interface ISurfaceSource

Properties

CellMetrics

Gets the cell metrics for this surface.

Returns: CellMetrics

csharp
CellMetrics CellMetrics { get; }

HasKgp

Gets whether this surface contains any KGP (Kitty Graphics Protocol) images.

Returns: Boolean

csharp
bool HasKgp { get; }

HasSixels

Gets whether this surface contains any sixel graphics.

Returns: Boolean

csharp
bool HasSixels { get; }

Height

Gets the height of the surface in rows.

Returns: Int32

csharp
int Height { get; }

Width

Gets the width of the surface in columns.

Returns: Int32

csharp
int Width { get; }

Methods

GetCell(int, int)

Gets the cell at the specified position.

Parameters:

  • x (Int32): The column (0-based).
  • y (Int32): The row (0-based).

Returns: SurfaceCell

The cell at the specified position.

csharp
SurfaceCell GetCell(int x, int y)

IsInBounds(int, int)

Checks if the specified position is within bounds.

Parameters:

  • x (Int32): The column (0-based).
  • y (Int32): The row (0-based).

Returns: Boolean

True if the position is within bounds, false otherwise.

csharp
bool IsInBounds(int x, int y)

TryGetCell(int, int, out SurfaceCell)

Tries to get the cell at the specified position.

Parameters:

  • x (Int32): The column (0-based).
  • y (Int32): The row (0-based).
  • cell (SurfaceCell): The cell at the position, or default if out of bounds.

Returns: Boolean

True if the position is valid, false otherwise.

csharp
bool TryGetCell(int x, int y, out SurfaceCell cell)

Remarks

This interface enables both (immediate, mutable grid) and (deferred, layered composition) to be used interchangeably in compositing operations.

Implementations may compute cells lazily (as in ) or return pre-stored values (as in ).

Released under the MIT License.