Prismv0.4
Runtime

registerSurface()

Register an app-owned HTML element as a Prism-managed canvas surface.

registerSurface() creates a CanvasSurface facade for an app-owned DOM element.

const surface = runtime.registerSurface(element, {
  bounds: { x: 0, y: 0, width: 320, height: 180 }
});

The app still owns the element's content, component tree, and styles. Prism owns the runtime registration and paint integration for that element.

Surface bounds are CSS pixels. Direct canvas drawing inside paint handlers uses backing-store pixels.

runtime.onPaint(({ drawSurface }) => {
  drawSurface(surface);
});

CanvasSurface instances belong to the runtime that created them.