Skip to content

SurfaceCells

Namespace: Hex1b.Surfaces

Assembly: Hex1b.dll

Provides commonly used values.

csharp
public static class SurfaceCells

Inheritance

ObjectSurfaceCells

Methods

Char(char, Hex1bColor?, Hex1bColor?, CellAttributes)

Creates a cell containing a single character with optional styling.

Parameters:

Returns: SurfaceCell

A new with the specified properties.

csharp
public static SurfaceCell Char(char character, Hex1bColor? foreground = null, Hex1bColor? background = null, CellAttributes attributes = CellAttributes.None)

Grapheme(string, Hex1bColor?, Hex1bColor?, CellAttributes, int)

Creates a cell containing a grapheme cluster with optional styling.

Parameters:

  • grapheme (String): The grapheme cluster (may be multiple code points for emoji, combining chars, etc.).
  • foreground (Nullable<Hex1bColor>): The foreground color, or null for transparent.
  • background (Nullable<Hex1bColor>): The background color, or null for transparent.
  • attributes (CellAttributes): Text styling attributes.
  • displayWidth (Int32): The display width of the grapheme (1 for normal, 2 for wide).

Returns: SurfaceCell

A new with the specified properties.

csharp
public static SurfaceCell Grapheme(string grapheme, Hex1bColor? foreground = null, Hex1bColor? background = null, CellAttributes attributes = CellAttributes.None, int displayWidth = 1)

Space(Hex1bColor?, Hex1bColor?)

Creates a space cell with the specified foreground and background colors.

Parameters:

Returns: SurfaceCell

A space cell with the specified colors.

csharp
public static SurfaceCell Space(Hex1bColor? foreground, Hex1bColor? background)

Space(Hex1bColor?)

Creates a space cell with the specified background color. Useful for clearing regions with a specific background.

Parameters:

Returns: SurfaceCell

A space cell with the specified background.

csharp
public static SurfaceCell Space(Hex1bColor? background)

Fields

Continuation

A continuation cell used for wide character support. When a wide character (like emoji or CJK) spans multiple columns, subsequent columns contain this cell to indicate they are covered by the preceding wide character.

Returns: SurfaceCell

csharp
public static readonly SurfaceCell Continuation

Empty

An empty/unwritten cell with no content and no colors (fully transparent). This is the default cell used to initialize surfaces. During compositing, cells equal to this are skipped to allow lower layers to show through. During output, any remaining unwritten cells are rendered as spaces.

Returns: SurfaceCell

csharp
public static readonly SurfaceCell Empty

Remarks

Using these static instances avoids repeated allocations for common cell types. Since is a value type (record struct), these don't save memory directly, but they provide convenient constants and enable reference equality checks in certain optimization scenarios.

Released under the MIT License.