Prismalpha.8
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.

Registering the same element with the same runtime more than once returns the existing CanvasSurface. New options are not reapplied; use surface.setBounds() to move or resize an existing surface.

A surface from one runtime cannot be used by another active runtime. Wrong-runtime operations throw.