Skip to content

Documentation / @ripl/terminal / Rasterizer

Interface: Rasterizer

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

Abstract rasterizer interface for converting pixel data to terminal characters.

Properties

PropertyModifierTypeDescriptionDefined in
pixelHeightreadonlynumberTotal height of the pixel grid the rasterizer renders into.terminal/src/rasterizer.ts:16
pixelWidthreadonlynumberTotal width of the pixel grid the rasterizer renders into.terminal/src/rasterizer.ts:14

Methods

clear()

clear(): void

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

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

Returns

void


resize()

resize(cols, rows): void

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

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:26

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:22

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

Parameters

ParameterType
colnumber
rownumber
charstring
colorstring

Returns

void


setPixel()

setPixel(x, y, color): void

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

Sets the sub-cell pixel at (x, y) to the given color.

Parameters

ParameterType
xnumber
ynumber
colorstring

Returns

void


toImageData()

toImageData(): ImageData

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

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

Returns

ImageData