Skip to content
ConsoleMonster

API Reference

Class

Region

Namespace ConsoleMonster.Canvas
Assembly ConsoleMonster
Modifiers sealed

The rectangle a widget renders into: a clipped view onto a CellBuffer with local coordinates. Writes outside the region are discarded, so a widget can never draw over its neighbours.

Inheritance

  • Object
  • Region

Usage

Explore 58 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Accepted by parameters 57

Constructors

Region 2 overloads
public Region(CellBuffer buffer, Rect bounds) #

Creates a region covering part of a buffer.

Parameters

buffer ConsoleMonster.Canvas.CellBuffer requiredposition: 0
The buffer.
bounds ConsoleMonster.Canvas.Rect requiredposition: 1
The absolute rectangle (clipped to the buffer).
public Region(CellBuffer buffer) #

Creates a region covering a whole buffer.

Parameters

buffer ConsoleMonster.Canvas.CellBuffer requiredposition: 0
The buffer.

Methods

Fill 2 overloads
public Void Fill(Int32 x, Int32 y, Int32 width, Int32 height, String glyph, Style style) #
Returns: Void

Fills a local rectangle with a glyph.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
width System.Int32 requiredposition: 2
Width.
height System.Int32 requiredposition: 3
Height.
glyph System.String requiredposition: 4
The glyph.
style ConsoleMonster.Styling.Style requiredposition: 5
The style.
public Void Fill(Style style) #
Returns: Void

Fills the whole region with blanks in a style (for example a header bar background).

Parameters

style ConsoleMonster.Styling.Style requiredposition: 0
The style.
public Cell Get(Int32 x, Int32 y) #
Returns: Cell

Reads a cell at a local position.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.

Returns

The cell (blank when outside).

public Void HorizontalLine(Int32 x, Int32 y, Int32 count, String glyph, Style style) #
Returns: Void

Repeats a glyph horizontally.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
count System.Int32 requiredposition: 2
Number of cells.
glyph System.String requiredposition: 3
The glyph.
style ConsoleMonster.Styling.Style requiredposition: 4
The style.
public Void Put(Int32 x, Int32 y, String glyph, Style style, Int32 width = 1) #
Returns: Void

Places one grapheme at a local position.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
glyph System.String requiredposition: 2
The grapheme.
style ConsoleMonster.Styling.Style requiredposition: 3
The style.
width System.Int32 = 1 optionalposition: 4
Grapheme width (1 or 2), or 0 to measure.
public Void SetStyle(Int32 x, Int32 y, Style style) #
Returns: Void

Changes the style of a cell, keeping its glyph.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
style ConsoleMonster.Styling.Style requiredposition: 2
The style.
public Region Sub(Int32 x, Int32 y, Int32 width, Int32 height) #
Returns: Region

Returns a child region in local coordinates, clipped to this region.

Parameters

x System.Int32 requiredposition: 0
Local left column.
y System.Int32 requiredposition: 1
Local top row.
width System.Int32 requiredposition: 2
Width.
height System.Int32 requiredposition: 3
Height.

Returns

The child region.

public Void VerticalLine(Int32 x, Int32 y, Int32 count, String glyph, Style style) #
Returns: Void

Repeats a glyph vertically.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
count System.Int32 requiredposition: 2
Number of cells.
glyph System.String requiredposition: 3
The glyph.
style ConsoleMonster.Styling.Style requiredposition: 4
The style.
Write 2 overloads
public Int32 Write(Int32 x, Int32 y, String text, Style style, Int32 maxWidth = -1) #
Returns: Int32

Writes single-line text at a local position, clipped to the region (and to maxWidth).

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
text System.String requiredposition: 2
The text.
style ConsoleMonster.Styling.Style requiredposition: 3
The style.
maxWidth System.Int32 = -1 optionalposition: 4
Maximum cells to use, or -1 for the rest of the row.

Returns

The local column after the text.

public Int32 Write(Int32 x, Int32 y, StyledLine line, Int32 maxWidth = -1, Style baseStyle = default) #
Returns: Int32

Writes a styled line at a local position, clipped to the region.

Parameters

x System.Int32 requiredposition: 0
Local column.
y System.Int32 requiredposition: 1
Local row.
line ConsoleMonster.Text.StyledLine requiredposition: 2
The line.
maxWidth System.Int32 = -1 optionalposition: 3
Maximum cells to use, or -1 for the rest of the row.
baseStyle ConsoleMonster.Styling.Style = default optionalposition: 4
A style layered underneath every span.

Returns

The local column after the text.

Properties

public CellBuffer Buffer { get; } #

The underlying buffer.

public Rect Bounds { get; } #

The absolute rectangle within the buffer.

public Int32 Width { get; } #

Width in cells.

public Int32 Height { get; } #

Height in cells.