Canvas class final

Canvas is a cell-buffer that can be used to compose and draw Drawables.

Implemented types

Constructors

Canvas(int width, int height)
Creates a canvas with width and height in cells.

Properties

buffer → Buffer
The mutable backing buffer.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

bounds() → Rectangle
Returns the drawable bounds of the canvas.
override
cellAt(int x, int y) → Cell?
Returns the cell at (x, y) or null if out of bounds.
override
clear() → void
Clears the entire canvas to empty cells.
override
clearArea(Rectangle area) → void
Clears area of the screen to empty cells.
override
compose(Drawable drawer) → Canvas
Composes a Drawable onto this canvas.
dispose() → void
Releases the canvas-owned backing screen buffer.
draw(Screen screen, Rectangle area) → void
Draws this canvas onto another Screen within area.
override
fill(Cell? cell) → void
Fills the entire screen with cell.
override
fillArea(Cell? cell, Rectangle area) → void
Fills area of the screen with cell.
override
height() → int
The current canvas height in cells.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render() → String
Renders the canvas into a string (trimming trailing spaces per line).
resize(int width, int height) → void
Resizes the canvas backing buffer to the given dimensions.
setCell(int x, int y, Cell? cell) → void
Sets the cell at (x, y) in the backing buffer.
override
setCellOwned(int x, int y, Cell? cell) → void
Sets the cell at (x, y) and may take ownership of cell.
override
toString() → String
A string representation of this object.
inherited
width() → int
The current canvas width in cells.
widthMethod() → WidthMethod
Returns the active grapheme width measurement method.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited