Documentation / @ripl/terminal / BrailleRasterizer
Class: BrailleRasterizer ​
Defined in: terminal/src/rasterizer.ts:100
Braille-dot rasterizer. Each terminal cell encodes a 2×4 grid of sub-pixel dots via Unicode braille patterns (U+2800–U+28FF).
Pixels are held as an RGBA framebuffer at dot resolution and composited source-over, so two shapes overlapping inside one cell blend rather than the later one taking the whole cell. A cell emits a single color — that is what a character can express — resolved as the alpha-weighted mean of its lit dots.
Implements ​
Constructors ​
Constructor ​
new BrailleRasterizer(
cols,rows,options?):BrailleRasterizer
Defined in: terminal/src/rasterizer.ts:135
Parameters ​
| Parameter | Type |
|---|---|
cols | number |
rows | number |
options? | BrailleRasterizerOptions |
Returns ​
BrailleRasterizer
Accessors ​
cellHeight ​
Get Signature ​
get cellHeight():
number
Defined in: terminal/src/rasterizer.ts:131
Height of one braille cell, in pixels.
Returns ​
number
Height of one character cell, in pixels.
Implementation of ​
cellWidth ​
Get Signature ​
get cellWidth():
number
Defined in: terminal/src/rasterizer.ts:126
Width of one braille cell, in pixels.
Returns ​
number
Width of one character cell, in pixels.
Implementation of ​
pixelHeight ​
Get Signature ​
get pixelHeight():
number
Defined in: terminal/src/rasterizer.ts:121
Total pixel height of the grid (rows times cell height).
Returns ​
number
Total height of the pixel grid the rasterizer renders into.
Implementation of ​
pixelWidth ​
Get Signature ​
get pixelWidth():
number
Defined in: terminal/src/rasterizer.ts:116
Total pixel width of the grid (columns times cell width).
Returns ​
number
Total width of the pixel grid the rasterizer renders into.
Implementation of ​
Methods ​
clear() ​
clear():
void
Defined in: terminal/src/rasterizer.ts:288
Clears all pixels, characters, and colors from the grid.
Returns ​
void
Implementation of ​
resize() ​
resize(
cols,rows):void
Defined in: terminal/src/rasterizer.ts:250
Resizes the grid to the given columns and rows, discarding all existing contents.
Parameters ​
| Parameter | Type |
|---|---|
cols | number |
rows | number |
Returns ​
void
Implementation of ​
serialize() ​
serialize(
options?):string
Defined in: terminal/src/rasterizer.ts:367
Serializes the grid to a string, including ANSI color and cursor codes unless ansi is disabled. The ANSI form erases past the end of every row and past the last row, so a grid that has shrunk since the previous frame does not leave the old output stranded on screen.
Parameters ​
| Parameter | Type |
|---|---|
options? | SerializeOptions |
Returns ​
string
Implementation of ​
setChar() ​
setChar(
col,row,char,color):void
Defined in: terminal/src/rasterizer.ts:276
Places a literal character in the given cell, overriding its braille dots; out-of-bounds cells are ignored.
Parameters ​
| Parameter | Type |
|---|---|
col | number |
row | number |
char | string |
color | TerminalColor |
Returns ​
void
Implementation of ​
setPixel() ​
setPixel(
x,y,color):void
Defined in: terminal/src/rasterizer.ts:259
Composites color onto the braille dot covering pixel (x, y); out-of-bounds and non-finite pixels are ignored.
Parameters ​
| Parameter | Type |
|---|---|
x | number |
y | number |
color | TerminalColor |
Returns ​
void
Implementation of ​
toImageData() ​
toImageData():
ImageData
Defined in: terminal/src/rasterizer.ts:396
Rasterizes the grid to environment-agnostic RGBA pixel data. A glyph occupies a whole cell, which is 2×4 pixels here — far too small for a legible letterform — so each one rasterizes as a filled block. Text reads as a solid bar rather than disappearing from the image entirely.
Returns ​
ImageData