CanvasTerminal class
A RenderableTerminal that uses an HTML5 html.CanvasElement to render the underlying Terminal using an implementation of CanvasRenderer.
- Inheritance
-
- Object
- Terminal
- RenderableTerminal<
CanvasRenderer> - CanvasTerminal
Constructors
- CanvasTerminal.withCanvas(CanvasElement canvas, CanvasRenderer renderer, int pixelWidth, int pixelHeight, [int? scale, Vec2? minSize])
-
Builds a CanvasTerminal using the given html.CanvasElement and a
pre-configured CanvasRenderer. Will update the canvas to fit into the
supplied pixel dimensions (or the given
minSize
columns and rows) using the given or currentscale
.factory - CanvasTerminal.withParent(Element parent, CanvasRendererType rendererType, {int? scale, String? font, Vec2? minSize})
-
Builds a CanvasTerminal by creating a new html.CanvasElement so that
it fills the dimensions of the given html.Element (or is at least the
given
minSize
in columns and rows). Creates a default CanvasRenderer of the requested type for the CanvasTerminal.factory
Properties
- background ↔ Color
-
The default background color when none is specified
getter/setter pairinherited
- bounds → Rect
-
The bounds of this terminal as a Rect
no setterinherited
- canvas → CanvasElement
-
The html.CanvasElement being used by this CanvasTerminal
no setter
- foreground ↔ Color
-
The default foreground color when none is specified
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
The height of the terminal screen in rows of characters
no setterinherited
-
loaded
→ Future<
void> -
Returns a Future that resolves whenever the underlying CanvasRenderer
is fully loaded and the terminal is actually ready to render. Calling
render on this terminal before waiting for this future to resolve may
result in undefined behavior.
no setter
- renderer → CanvasRenderer
-
The renderer used by this RenderableTerminal
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → Vec2
-
The size of the terminal as a vector
no setterinherited
- width → int
-
The width of the terminal screen in columns of characters
no setterinherited
Methods
-
boundsCheck(
int x, int y) → void -
Ensures that the given position
x
,y
is within the bounds of this Terminalinherited -
child(
int x, int y, int width, int height) → Terminal -
Get a child Terminal within this one
inherited
-
childRect(
Rect rect) → Terminal -
Get a child Terminal within this one, defined by the given
rect
.inherited -
clear(
) → void -
Clears the entire terminal with empty characters using the current
background Color.
inherited
-
drawChar(
int x, int y, Char char) → void -
Most basic draw method for the terminal; draws the given Char at column
x
, rowy
of this Terminal.inherited -
drawCharCode(
int x, int y, int charCode, [Color? foreground, Color? background]) → void -
Draws a character at column
x
, rowy
of this Terminal using its integercharCode
using the givenforeground
andbackground
Colors (or default colors).inherited -
drawText(
int x, int y, String text, [Color? foreground, Color? background]) → void -
Draws the string of characters in
text
starting at columnx
, rowy
of this Terminal using the givenforeground
andbackground
Colors (or default colors). The text will be truncated if it runs beyond the bounds of the terminal.inherited -
drawTextCenter(
int y, String text, [Color? foreground, Color? background]) → void -
Draws the string of characters in
text
on rowy
such that the text is centered horizontally in this Terminal. If the length oftext
is longer than this terminal's width, the text will be positioned at column 0.inherited -
fill(
int x, int y, int width, int height, [Color? color]) → void -
Clears and fills the given rectangle with the given (or default)
background Color.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pixelsToPosition(
Vec2 pixels) → Vec2 -
Converts the given position on the rendered display in pixels to a
column/row position on this RenderableTerminal.
override
-
render(
) → void -
Renders the RenderableTerminal
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited