API

Function createHtmlTexture

  • Create an HTML texture from a live element. When an update path exists, the element is re-parented under the rendering canvas (restored on dispose), the texture is allocated blank, and — on the native path — a paint listener is attached so the texture tracks the element. Reads as transparent black until the first paint uploads.

    The element is marked drawable, so on the native path its whole subtree is captured except descendants that the application itself marks drawable: per the HTML-in-Canvas spec those are separate drawable subtrees and are left out of this texture.

    Several textures may share one element only when they render into the same canvas; creating a texture from an element hosted by another canvas throws.

    Parameters

    • engine: EngineContext

      Engine context (must render into a DOM canvas, not an OffscreenCanvas).

    • element: HTMLElement

      The DOM element to rasterise.

    • options: HtmlTexture2DOptions = {}

      Size / sampler / update overrides.

    Returns HtmlTexture2D