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
| Parameter | Type | Description |
|---|---|---|
params | { width: number; height: number; context_constructor: (canvas: OffscreenCanvas | HTMLCanvasElement, context_type: ContextType, options?: ContextOptions) => ContextProvider; context_type: ContextType; context_attributes?: ContextOptions; } | |
params.width | number | The width of the offscreen canvas. |
params.height | number | The height of the offscreen canvas. |
params.context_constructor | (canvas: OffscreenCanvas | HTMLCanvasElement, context_type: ContextType, options?: ContextOptions) => ContextProvider | The constructor of the context. |
params.context_type | ContextType | The type of context to create. |
params.context_attributes? | ContextOptions | The 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
height
Get Signature
get height(): number;
Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:34
Height of the surface.
Returns
number
Overrides
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
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
Overrides
RenderingSurfaceBase.getBoundingRect
resize()
resize(width: number, height: number): void;
Defined in: livelink.js/sources/rendering/surfaces/OffscreenSurface.ts:109
Resizes the surface.
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
void