Function createHtmlTexture
-
createHtmlTexture(
engine: EngineContext,
element: HTMLElement,
options?: HtmlTexture2DOptions,
): HtmlTexture2DParameters
- 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
- engine: EngineContext
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 — apaintlistener 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 marksdrawable: 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.