Skip to content

Class CellSurface

A grid of cells a program draws into directly, with no escape parsing: what a session shows in place of the emulator’s screen while a DarkEffekt.Terminal.ISurfaceProgram runs. It carries no cursor, scrollback, or modes. Call DarkEffekt.Terminal.CellSurface.Invalidate() after drawing so the renderer picks the change up.

Declaration
public sealed class CellSurface
Declaration
public int Cols { get; }
Declaration
public int Rows { get; }

Bumped by Invalidate, Clear, and Resize; renderers compare and redraw.

Declaration
public int Version { get; }
Declaration
public ref Cell this[int x, int y] { get; }

One row of cells, writable in place.

Declaration
public Span<Cell> Row(int y)

System.Span<DarkEffekt.Terminal.Cell>

Type Name
System.Int32 y

Marks the surface changed.

Declaration
public void Invalidate()

Resizes the grid and blanks it. The contents are the program’s to redraw.

Declaration
public void Resize(int cols, int rows)
Type Name
System.Int32 cols
System.Int32 rows
Declaration
public void Clear(in Cell fill)
Type Name
DarkEffekt.Terminal.Cell fill

Put(int, int, int, TermColor, TermColor, CellAttrs)

Section titled “Put(int, int, int, TermColor, TermColor, CellAttrs)”

Writes one code point at a cell, as one cell or as the head and tail of a wide character. Out of bounds writes are dropped. Returns the cells it took, 0 for a combining mark. A control character is dropped, and half of a surrogate pair becomes U+FFFD, so a cell never holds a rune that an ANSI presenter or a font cannot take.

Declaration
public int Put(int x, int y, int rune, TermColor fg, TermColor bg, CellAttrs attrs = CellAttrs.None)

System.Int32

Type Name
System.Int32 x
System.Int32 y
System.Int32 rune
DarkEffekt.Terminal.TermColor fg
DarkEffekt.Terminal.TermColor bg
DarkEffekt.Terminal.CellAttrs attrs

Copies every cell from another surface of the same size.

Declaration
public void CopyFrom(CellSurface other)
Type Name
DarkEffekt.Terminal.CellSurface other