Skip to content
ConsoleMonster
Class

PixelCanvas

ConsoleMonster.Canvas

Namespace
ConsoleMonster.Canvas
Assembly
ConsoleMonster
Modifiers
abstract

A sub-cell drawing surface: pixels are mapped onto cells using braille (2x4 per cell), half blocks (1x2 per cell) or plain characters (1x1 per cell). PixelCanvas.Create picks the densest canvas the glyph tier can show, so a chart drawn once looks right on every terminal.

Inheritance

  • object
  • PixelCanvas

Derived Types

Usage

Explore 1 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

Methods

public abstract void Clear() #

Clears all pixels.

public static PixelCanvas Create(GlyphTier tier, int columns, int rows) #

Creates the densest canvas a glyph tier can show.

Parameters

tier ConsoleMonster.Capabilities.GlyphTier required
The glyph tier.
columns int required
Width in cells.
rows int required
Height in cells.

Returns

PixelCanvas A braille canvas (Full), half-block canvas (Basic) or character canvas (Ascii).
public void Line(int x0, int y0, int x1, int y1, Color color) #

Draws a line between two pixels (Bresenham).

Parameters

x0 int required
Start column.
y0 int required
Start row.
x1 int required
End column.
y1 int required
End row.
color ConsoleMonster.Styling.Color required
The colour.
public abstract void Render(Region region, int x, int y, RenderContext context) #

Renders the canvas into a region at a local position.

Parameters

region ConsoleMonster.Canvas.Region required
The region.
x int required
Local column.
y int required
Local row.
context ConsoleMonster.Canvas.RenderContext required
The render context.
public abstract void Set(int x, int y, Color color) #

Sets a pixel. Out-of-range pixels are ignored.

Parameters

x int required
Pixel column (0 = left).
y int required
Pixel row (0 = top).
color ConsoleMonster.Styling.Color required
The colour; a cell shows the colour of the last pixel set in it.
public void VerticalSpan(int x, int yTop, int yBottom, Color color) #

Fills a vertical span of pixels in one column (bars, areas).

Parameters

x int required
Pixel column.
yTop int required
Top pixel row.
yBottom int required
Bottom pixel row (inclusive).
color ConsoleMonster.Styling.Color required
The colour.

Properties

public int Columns { get; } #

Width in cells.

public int Rows { get; } #

Height in cells.

public int PixelsPerColumn { get; } #

Horizontal pixels per cell.

public int PixelsPerRow { get; } #

Vertical pixels per cell.

public int PixelWidth { get; } #

Width in pixels.

public int PixelHeight { get; } #

Height in pixels.