Skip to main content

Joinery class

Namespace: Arlecchino.Rendering.Text · Assembly: Arlecchino.Core

Lines that know about one another. Boxes and rules are recorded first and painted at the end, so a cell two of them share becomes the glyph that joins them rather than one line drawn over the other.

var joinery = new Joinery();

var files = joinery.Box(left, Theme.Info, "files");
var log = joinery.Box(right, Theme.Active, "log");

joinery.Draw(surface.Content, Theme.Info);

public sealed class Joinery

Constructors

MemberSummary
Joinery()

Properties

MemberSummary
CountHow many cells carry a line so far. Nothing has reached the surface yet.

Methods

MemberSummary
Across(SurfaceRegion, int, IArlecchinoColor)Records a rule across a region, for a divider that should join the surrounding box.
Box(SurfaceRegion, IArlecchinoColor, string)Records the four edges of a region and hands back the room inside them, the way SurfaceRegion.Border does.
Down(SurfaceRegion, int, IArlecchinoColor)Records a rule down a region.
Draw(SurfaceRegion, IArlecchinoColor)Paints everything recorded, resolving each cell into the glyph its neighbors ask for, and then writes the titles over the top edges they belong to. Anything falling outside the region is left undrawn rather than clamped into it.

Constructors in detail

Joinery()

public Joinery();

Properties in detail

Count

public int Count { get; }

How many cells carry a line so far. Nothing has reached the surface yet.

Type int

Methods in detail

Across(SurfaceRegion, int, IArlecchinoColor)

public void Across(SurfaceRegion region, int row, IArlecchinoColor? style = null);

Records a rule across a region, for a divider that should join the surrounding box.

Parameters

NameTypeDescription
regionSurfaceRegionThe region to cross.
rowintWhich of its rows, counted from its top.
styleIArlecchinoColorHow it is drawn; the style given to Joinery.Draw when omitted.

Box(SurfaceRegion, IArlecchinoColor, string)

public SurfaceRegion Box(SurfaceRegion region, IArlecchinoColor? style = null, string title = "");

Records the four edges of a region and hands back the room inside them, the way SurfaceRegion.Border does.

Parameters

NameTypeDescription
regionSurfaceRegionWhat to draw a box around.
styleIArlecchinoColorHow its lines are drawn; the style given to Joinery.Draw when omitted.
titlestringWhat to write into the top edge, or nothing.

Returns SurfaceRegion — The region inside the box.

Down(SurfaceRegion, int, IArlecchinoColor)

public void Down(SurfaceRegion region, int column, IArlecchinoColor? style = null);

Records a rule down a region.

Parameters

NameTypeDescription
regionSurfaceRegionThe region to cross.
columnintWhich of its columns, counted from its left.
styleIArlecchinoColorHow it is drawn; the style given to Joinery.Draw when omitted.

Draw(SurfaceRegion, IArlecchinoColor)

public void Draw(SurfaceRegion region, IArlecchinoColor style);

Paints everything recorded, resolving each cell into the glyph its neighbors ask for, and then writes the titles over the top edges they belong to. Anything falling outside the region is left undrawn rather than clamped into it.

Parameters

NameTypeDescription
regionSurfaceRegionWhere to paint; coordinates recorded are the surface's own.
styleIArlecchinoColorHow lines recorded without a style of their own are drawn.