Skip to main content

Abstract Class: RenderingSurfaceBase

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:25

Abstract class for rendering surfaces.

A rendering surface represents the final destination of the rendered frame.

It is usually backed by an HTML Canvas or an OffscreenCanvas.

It can be split into multiple viewports, each with its own camera and render target. The rendering surface if responsible for holding the viewports and their configurations.

It is finally responsible for drawing the portions of the final frame to its backing element.

Extends​

Extended by​

Constructors​

Constructor​

new RenderingSurfaceBase(): RenderingSurfaceBase;

Returns​

RenderingSurfaceBase

Inherited from​

TypedEventTarget<RenderingSurfaceEvents>.constructor

Properties​

PropertyModifierTypeDefault valueDescription
viewportsreadonlyViewport[][]List of viewports bound to the current surface.
relative_rectpublicRelativeRectundefinedNormalized dimensions and offset of the surface relative to the remote rendering surface.
_scaleprotectednumber1.0Scale of the surface.

Accessors​

scale​

Get Signature​

get scale(): number;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:49

Scale of the surface.

Returns​

number

Set Signature​

set scale(scale: number): void;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:56

Set scale of the surface.

Parameters​
ParameterType
scalenumber
Returns​

void


dimensions​

Get Signature​

get dimensions(): Vec2;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:71

Dimensions of the surface.

Returns​

Vec2


width​

Get Signature​

get abstract width(): number;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:78

Width of the surface.

Returns​

number


height​

Get Signature​

get abstract height(): number;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:83

Height of the surface.

Returns​

number

Methods​

getBoundingRect()​

abstract getBoundingRect(): Rect;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:88

Returns the bounding rectangle of the surface.

Returns​

Rect


release()​

release(): void;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:93

Releases the resources associated with the current surface.

Returns​

void


isValid()​

isValid(): boolean;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:104

Returns whether the current surface is valid.

Returns​

boolean


drawFrame()​

drawFrame(params: {
decoded_frame: DecodedFrame;
}): void;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:115

Draws the portions of the frame associated with the viewports to the backing element. Keeps a reference to the last frame drawn.

Parameters​

ParameterTypeDescription
params{ decoded_frame: DecodedFrame; }-
params.decoded_frameDecodedFrameThe frame to draw.

Returns​

void


redrawLastFrame()​

redrawLastFrame(): void;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:123

Redraws the last frame. No-op if its VideoFrame was since closed by the decoder.

Returns​

void


reset()​

reset(): void;

Defined in: livelink.clients/livelink.js/sources/rendering/surfaces/RenderingSurfaceBase.ts:133

Resets the surface states.

Returns​

void


addEventListener()​

addEventListener<_EventName>(
event_name: _EventName,
listener: (event: RenderingSurfaceEvents[_EventName]) => void,
options?: boolean | AddEventListenerOptions): void;

Defined in: livelink.clients/livelink.base/sources/TypedEventTarget.ts:10

Type Parameters​

Type Parameter
_EventName extends "on-rendering-surface-resized"

Parameters​

ParameterType
event_name_EventName
listener(event: RenderingSurfaceEvents[_EventName]) => void
options?boolean | AddEventListenerOptions

Returns​

void

Inherited from​

TypedEventTarget.addEventListener;

removeEventListener()​

removeEventListener<_EventName>(
event_name: _EventName,
listener: (event: RenderingSurfaceEvents[_EventName]) => void,
options?: boolean | EventListenerOptions): void;

Defined in: livelink.clients/livelink.base/sources/TypedEventTarget.ts:21

Type Parameters​

Type Parameter
_EventName extends "on-rendering-surface-resized"

Parameters​

ParameterType
event_name_EventName
listener(event: RenderingSurfaceEvents[_EventName]) => void
options?boolean | EventListenerOptions

Returns​

void

Inherited from​

TypedEventTarget.removeEventListener;