Skip to main content

OffscreenSurface

@3dverse/livelink v0.8.10


@3dverse/livelink / OffscreenSurface

Class: OffscreenSurface<ContextType, ContextOptions>

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:12

Extends

Type Parameters

ContextType extends CanvasContextType

ContextOptions

Constructors

new OffscreenSurface()

new OffscreenSurface<ContextType, ContextOptions>(__namedParameters): OffscreenSurface<ContextType, ContextOptions>

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:31

Parameters

__namedParameters
width

number

height

number

context_constructor

(canvas, context_type, options?) => ContextProvider

context_type

ContextType

context_options

ContextOptions

resolution_scale

number = 1.0

Returns

OffscreenSurface<ContextType, ContextOptions>

Overrides

RenderingSurfaceBase.constructor

Properties

viewports

readonly viewports: Viewport[] = []

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

List of viewports bound to the current surface.

Inherited from

RenderingSurfaceBase.viewports


offset

offset: Vec2

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

Offset of the surface relative to the remote rendering surface.

Inherited from

RenderingSurfaceBase.offset

Accessors

width

Get Signature

get width(): number

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:62

Returns

number

Overrides

RenderingSurfaceBase.width


height

Get Signature

get height(): number

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:68

Returns

number

Overrides

RenderingSurfaceBase.height


context

Get Signature

get context(): ContextProvider

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:75

Returns

ContextProvider


cameras

Get Signature

get cameras(): readonly Entity[]

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:82

Returns

readonly Entity[]


resolution_scale

Get Signature

get resolution_scale(): number

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:127

Returns

number

Set Signature

set resolution_scale(scale): void

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:134

Parameters
scale

number

Returns

void

Methods

release()

release(): void

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:91

Returns

void

Overrides

RenderingSurfaceBase.release


drawFrame()

drawFrame(frame): void

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:99

Parameters

frame
frame

OffscreenCanvas | VideoFrame

left

number

top

number

meta_data

FrameMetaData

Returns

void

Overrides

RenderingSurfaceBase.drawFrame


getBoundingRect()

getBoundingRect(): Rect

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:111

Returns

Rect

Overrides

RenderingSurfaceBase.getBoundingRect


resize()

resize(width, height): void

Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:118

Parameters

width

number

height

number

Returns

void


addViewport()

addViewport(params): void

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

Adds a viewport to the current surface.

Note that the viewport knows which section of the surface it should draw to using its Viewport.relative_rect property.

Parameters

params
viewport

Viewport

The viewport to add.

Returns

void

Inherited from

RenderingSurfaceBase.addViewport


removeViewport()

removeViewport(params): void

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

Removes a viewport from the current surface.

Parameters

params
viewport

Viewport

The viewport to remove.

Returns

void

Inherited from

RenderingSurfaceBase.removeViewport


isValid()

isValid(): boolean

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

Returns whether the current surface is valid.

Returns

boolean

Inherited from

RenderingSurfaceBase.isValid


addEventListener()

addEventListener(type, callback, options?): void

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8303

Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

Parameters

type

string

callback

null | EventListenerOrEventListenerObject

options?

boolean | AddEventListenerOptions

Returns

void

Inherited from

RenderingSurfaceBase.addEventListener


dispatchEvent()

dispatchEvent(event): boolean

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8309

Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

MDN Reference

Parameters

event

Event

Returns

boolean

Inherited from

RenderingSurfaceBase.dispatchEvent


removeEventListener()

removeEventListener(type, callback, options?): void

Defined in: node_modules/typescript/lib/lib.dom.d.ts:8315

Removes the event listener in target's event listener list with the same type, callback, and options.

MDN Reference

Parameters

type

string

callback

null | EventListenerOrEventListenerObject

options?

boolean | EventListenerOptions

Returns

void

Inherited from

RenderingSurfaceBase.removeEventListener