Skip to content
ConsoleMonster

API Reference

Class

PixelCanvas

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

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() #
Returns: Void

Clears all pixels.

public static PixelCanvas Create(GlyphTier tier, Int32 columns, Int32 rows) #
Returns: PixelCanvas

Creates the densest canvas a glyph tier can show.

Parameters

tier ConsoleMonster.Capabilities.GlyphTier requiredposition: 0
The glyph tier.
columns System.Int32 requiredposition: 1
Width in cells.
rows System.Int32 requiredposition: 2
Height in cells.

Returns

A braille canvas (Full), half-block canvas (Basic) or character canvas (Ascii).

public Void Line(Int32 x0, Int32 y0, Int32 x1, Int32 y1, Color color) #
Returns: Void

Draws a line between two pixels (Bresenham).

Parameters

x0 System.Int32 requiredposition: 0
Start column.
y0 System.Int32 requiredposition: 1
Start row.
x1 System.Int32 requiredposition: 2
End column.
y1 System.Int32 requiredposition: 3
End row.
color ConsoleMonster.Styling.Color requiredposition: 4
The colour.
public abstract Void Render(Region region, Int32 x, Int32 y, RenderContext context) #
Returns: Void

Renders the canvas into a region at a local position.

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The region.
x System.Int32 requiredposition: 1
Local column.
y System.Int32 requiredposition: 2
Local row.
context ConsoleMonster.Canvas.RenderContext requiredposition: 3
The render context.
public abstract Void Set(Int32 x, Int32 y, Color color) #
Returns: Void

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

Parameters

x System.Int32 requiredposition: 0
Pixel column (0 = left).
y System.Int32 requiredposition: 1
Pixel row (0 = top).
color ConsoleMonster.Styling.Color requiredposition: 2
The colour; a cell shows the colour of the last pixel set in it.
public Void VerticalSpan(Int32 x, Int32 yTop, Int32 yBottom, Color color) #
Returns: Void

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

Parameters

x System.Int32 requiredposition: 0
Pixel column.
yTop System.Int32 requiredposition: 1
Top pixel row.
yBottom System.Int32 requiredposition: 2
Bottom pixel row (inclusive).
color ConsoleMonster.Styling.Color requiredposition: 3
The colour.

Properties

public Int32 Columns { get; } #

Width in cells.

public Int32 Rows { get; } #

Height in cells.

public Int32 PixelsPerColumn { get; } #

Horizontal pixels per cell.

public Int32 PixelsPerRow { get; } #

Vertical pixels per cell.

public Int32 PixelWidth { get; } #

Width in pixels.

public Int32 PixelHeight { get; } #

Height in pixels.