Creates an instance of a CanvasTexture
The SciChart 2D WebAssembly Context or {@link TSciChart2D | SciChart 2D WebAssembly Context} containing native methods and access to our WebGL2 Engine and WebAssembly numerical methods
The width of the texture
The height of the texture
Clears the texture and the canvas
After you have finished drawing, copy the canvas to the destination {@link TSRTexture}
Deletes native (WebAssembly) memory used by this type, after which it cannot be used.
Get an HTML5 {@link CanvasRenderingContext2D} to draw on.
Get the SciChart WebAssembly / WebGL {@link TSRTexture | Texture}
Generated using TypeDoc
The CanvasTexture is used internally to map an {@link HTMLCanvasElement} to a WebGL Texture. Use this when you want to create a WebGL texture and draw on it.
To use a canvas texture, declare one, draw on the HTML canvas, then call CanvasTexture.copyTexture. Code example below
// Create a canvasTexture const canvasTexture = new CanvasTexture(wasmContext, width, height); canvasTexture.clear(); // do some drawing with html5Context const html5Context = canvasTexture.getContext(); // todo - your drawing here // Copy and get the texture canvasTexture.copyTexture(); const webAssemblyTexture: TSRTexture = canvasTexture.getTexture(); // After use, delete the CanvasTexture canvasTexture.delete();