@mcut/compositor
Classes
Classes exported by @mcut/compositor.
Classes
Canvas2DBackend
class Canvas2DBackend implements RenderBackend {
readonly kind = 'canvas2d'
constructor(
private readonly ctx: Canvas2D,
readonly width: number,
readonly height: number,
)
pixelGrid(): PixelGrid
beginFrame(backgroundColor: string): void
endFrame(): void
acquireRaster(): Canvas2D
drawImageQuad(quad: ImageQuad, chrome: LayerChrome): void
pushRasterScope(): void
popRasterScope(): void
}The reference RenderBackend that draws directly into a 2D context. Its pixel grid is the context's current transform over its canvas.
ScratchContextError
class ScratchContextError extends Error {
constructor(width: number, height: number)
}Error thrown by a render when an element needs a scratch 2D context and none is available. A multicam needs one to compose its layout. The message names the size and says to pass createScratchContext in the render options, with a node-canvas factory as the example.
WebGPUBackend
class WebGPUBackend implements RenderBackend {
readonly kind = 'webgpu'
readonly width: number
readonly height: number
static async create(options: WebGPUBackendOptions): Promise<WebGPUBackend>
pixelGrid(): PixelGrid
registerLut3D(lutId: string, size: number, data: Float32Array): void
beginFrame(backgroundColor: string): void
endFrame(): void
acquireRaster(): Canvas2D
pushRasterScope(): void
popRasterScope(): void
drawImageQuad(quad: ImageQuad, chrome: LayerChrome): void
dispose(): void
}A RenderBackend that composites image quads as textured GPU passes with WGSL effects and uploads Canvas 2D raster content as texture layers. Its pixel grid is its raster, width by height pixels under the raster's current transform, because layers composite at that size before the frame presents to the canvas.