Skip to main content

Class: OffscreenSurface<ContextType, ContextOptions>

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

Extends

Type Parameters

Type Parameter
ContextType extends CanvasContextType
ContextOptions

Constructors

Constructor

new OffscreenSurface<ContextType, ContextOptions>(params: {
width: number;
height: number;
context_constructor: (canvas: OffscreenCanvas | HTMLCanvasElement, context_type: ContextType, options?: ContextOptions) => ContextProvider;
context_type: ContextType;
context_attributes?: ContextOptions;
}): OffscreenSurface<ContextType, ContextOptions>;

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

Creates a new offscreen surface.

Parameters

ParameterTypeDescription
params{ width: number; height: number; context_constructor: (canvas: OffscreenCanvas | HTMLCanvasElement, context_type: ContextType, options?: ContextOptions) => ContextProvider; context_type: ContextType; context_attributes?: ContextOptions; }
params.widthnumberThe width of the offscreen canvas.
params.heightnumberThe height of the offscreen canvas.
params.context_constructor(canvas: OffscreenCanvas | HTMLCanvasElement, context_type: ContextType, options?: ContextOptions) => ContextProviderThe constructor of the context.
params.context_typeContextTypeThe type of context to create.
params.context_attributes?ContextOptionsThe attributes of the context.

Returns

OffscreenSurface<ContextType, ContextOptions>

Overrides

RenderingSurfaceBase.constructor;

Accessors

width

Get Signature

get width(): number;

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

Width of the surface.

Returns

number

Overrides

RenderingSurfaceBase.width


height

Get Signature

get height(): number;

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

Height of the surface.

Returns

number

Overrides

RenderingSurfaceBase.height


cameras

Get Signature

get cameras(): readonly Entity[];

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

The cameras associated with the surface's viewports.

Returns

readonly Entity[]

Methods

release()

release(): void;

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

Releases the resources associated with the surface.

Returns

void

Overrides

RenderingSurfaceBase.release


getContext()

getContext<ContextType>(): ContextType;

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

Returns the context of the surface.

Type Parameters

Type Parameter
ContextType extends ContextProvider

Returns

ContextType


getBoundingRect()

getBoundingRect(): Rect;

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

Returns

Rect

Overrides

RenderingSurfaceBase.getBoundingRect


resize()

resize(width: number, height: number): void;

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

Resizes the surface.

Parameters

ParameterType
widthnumber
heightnumber

Returns

void