Search Docs
Loading...
Skip to content

Class: TerminalCanvas

A live-view host. Attach one with engine.attachCanvas().

Implements#

Accessors#

background#


The terminal’s background colour, once it has answered OSC 11.

Returns#

object

Name Type
r number
g number
b number

size#


Surface size in pixels, as last measured.

Returns#

object

Name Type
width number
height number

Constructors#

Constructor#


| Parameter | Type | | —— | —— | | options? | TerminalCanvasOptions |

Returns#

TerminalCanvas

Methods#

attach()#


Called once when the canvas is attached.

Returns#

void

Implementation of#

EngineCanvas.attach

Signature#

attach(): void

detach()#


Called once when the canvas is detached or the engine is disposed.

Returns#

void

Implementation of#

EngineCanvas.detach

Signature#

detach(): void

beforeUpdate()#


Before update(): size the surface and request a frame.

Parameters#

Parameter Type
surface FrameSurface

Returns#

void

Implementation of#

EngineCanvas.beforeUpdate

Signature#

beforeUpdate(surface: FrameSurface): void

afterUpdate()#


After update(): present the frame, if one was produced.

Parameters#

Parameter Type
info FrameInfo
surface FrameSurface

Returns#

void

Implementation of#

EngineCanvas.afterUpdate

Signature#

afterUpdate(info: FrameInfo, surface: FrameSurface): void

requestFrame()#


Schedule the next tick. Engine time advances only inside update(), so waiting on input alone freezes playback.

Parameters#

Parameter Type
tick () => void
busy boolean

Returns#

object

Implementation of#

EngineCanvas.requestFrame

Signature#

requestFrame(tick: () => void, busy: boolean): object

setViewport()#


Move the image to another cell rect. The next measure picks up the new grid with it.

Parameters#

Parameter Type
rect CellRect

Returns#

void

Signature#

setViewport(rect: CellRect | () => CellRect): void

redraw()#


Clear and retransmit. The engine writes to stderr from C++, and nothing here can intercept fd 2.

Returns#

void

Signature#

redraw(): void