Skip to content

Documentation / @ripl/terminal / BrailleRasterizer

Class: BrailleRasterizer

Defined in: terminal/src/rasterizer.ts:107

Braille-dot rasterizer. Each terminal cell encodes a 2×4 grid of sub-pixel dots via Unicode braille patterns (U+2800–U+28FF).

Implements

Constructors

Constructor

new BrailleRasterizer(cols, rows): BrailleRasterizer

Defined in: terminal/src/rasterizer.ts:129

Parameters

ParameterType
colsnumber
rowsnumber

Returns

BrailleRasterizer

Accessors

pixelHeight

Get Signature

get pixelHeight(): number

Defined in: terminal/src/rasterizer.ts:125

Total pixel height of the grid (rows times cell height).

Returns

number

Total height of the pixel grid the rasterizer renders into.

Implementation of

Rasterizer.pixelHeight


pixelWidth

Get Signature

get pixelWidth(): number

Defined in: terminal/src/rasterizer.ts:120

Total pixel width of the grid (columns times cell width).

Returns

number

Total width of the pixel grid the rasterizer renders into.

Implementation of

Rasterizer.pixelWidth

Methods

clear()

clear(): void

Defined in: terminal/src/rasterizer.ts:187

Clears all dots, characters, and colors from the grid.

Returns

void

Implementation of

Rasterizer.clear


resize()

resize(cols, rows): void

Defined in: terminal/src/rasterizer.ts:141

Resizes the grid to the given columns and rows, discarding all existing contents.

Parameters

ParameterType
colsnumber
rowsnumber

Returns

void

Implementation of

Rasterizer.resize


serialize()

serialize(options?): string

Defined in: terminal/src/rasterizer.ts:257

Serializes the grid to a string, including ANSI color and cursor codes unless ansi is disabled.

Parameters

ParameterType
options?SerializeOptions

Returns

string

Implementation of

Rasterizer.serialize


setChar()

setChar(col, row, char, color): void

Defined in: terminal/src/rasterizer.ts:175

Places a literal character in the given cell, overriding its braille dots; out-of-bounds cells are ignored.

Parameters

ParameterType
colnumber
rownumber
charstring
colorstring

Returns

void

Implementation of

Rasterizer.setChar


setPixel()

setPixel(x, y, color): void

Defined in: terminal/src/rasterizer.ts:153

Sets the braille dot covering pixel (x, y) and stores its color; out-of-bounds pixels are ignored.

Parameters

ParameterType
xnumber
ynumber
colorstring

Returns

void

Implementation of

Rasterizer.setPixel


toImageData()

toImageData(): ImageData

Defined in: terminal/src/rasterizer.ts:281

Rasterizes the grid to environment-agnostic RGBA pixel data.

Returns

ImageData

Implementation of

Rasterizer.toImageData