Skip to content

Documentation / @ripl/terminal / Rasterizer

Interface: Rasterizer ​

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

Abstract rasterizer interface for converting pixel data to terminal characters.

Properties ​

PropertyModifierTypeDescriptionDefined in
cellHeightreadonlynumberHeight of one character cell, in pixels.terminal/src/rasterizer.ts:42
cellWidthreadonlynumberWidth of one character cell, in pixels.terminal/src/rasterizer.ts:40
pixelHeightreadonlynumberTotal height of the pixel grid the rasterizer renders into.terminal/src/rasterizer.ts:38
pixelWidthreadonlynumberTotal width of the pixel grid the rasterizer renders into.terminal/src/rasterizer.ts:36

Methods ​

clear() ​

clear(): void

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

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

Returns ​

void


resize() ​

resize(cols, rows): void

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

Resizes the grid to the given number of terminal columns and rows, clearing its contents.

Parameters ​

ParameterType
colsnumber
rowsnumber

Returns ​

void


serialize() ​

serialize(options?): string

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

Serializes the grid to a terminal-ready string (ANSI-colored by default).

Parameters ​

ParameterType
options?SerializeOptions

Returns ​

string


setChar() ​

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

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

Places a literal character in the given cell with the given color.

Parameters ​

ParameterType
colnumber
rownumber
charstring
colorTerminalColor

Returns ​

void


setPixel() ​

setPixel(x, y, color): void

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

Composites the given color onto the sub-cell pixel at (x, y).

Parameters ​

ParameterType
xnumber
ynumber
colorTerminalColor

Returns ​

void


toImageData() ​

toImageData(): ImageData

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

Rasterizes the current grid to environment-agnostic RGBA pixel data.

Returns ​

ImageData