GlyphRenderer class
Renders characters to a CanvasTerminal using bitmap glyphs. The renderer must be supplied with a mapping between supported characters and the glyphs. This renderer works best when supplied with an appropriate pixel density scale.
- Inheritance
-
- Object
- Renderer
- CanvasRenderer
- GlyphRenderer
Constructors
-
GlyphRenderer(String glyphSrc, Map<
int, int> _charToGlyphIndex, Vec2 _charSize, CanvasRenderingContext2D context, int scale) -
Create a new GlyphRenderer using the given
glyphSrc
path or URL to the glyph sheet, a Map of character codes to glyph indices in the glyph sheet, and the size of a single glyph in pixels. Also provide a canvas 2D renderingcontext
and ascale
value for better rendering on high-density displays (e.g., Apple Retina screens). - GlyphRenderer.dosVga437(CanvasRenderingContext2D context, [int? scale])
-
Create a GlyphRenderer using the default built-in Code Page 437 glyph
set
factory
Properties
- charHeight → int
-
The height in pixels of a single rendered character (before scaling)
no setteroverride
- charWidth → int
-
The width in pixels of a single rendered character (before scaling)
no setteroverride
- ctx → CanvasRenderingContext2D
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
loaded
→ Future<
void> -
Returns a Future that resolves whenever the underlying assets used by
the renderer are fully loaded and the renderer is actually ready to
render. Calling renderChar before waiting for this future to resolve may
result in undefined behavior.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → int
-
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
renderChar(
int x, int y, Char char) → void -
Render the given Char at column
x
, rowy
in a Terminaloverride -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- dosVga437CharHeight → const int
- dosVga437CharWidth → const int
- dosVga437GlyphsSrc → const String
- Default set of glyphs covering the code page 437 content.