Class GPUCanvasContext
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The GPUCanvasContext interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} represents the WebGPU rendering context of a {{htmlelement("canvas")}} element, returned via an GetContext(string, dynamic) call with a contextType of "webgpu".
[Value("GPUCanvasContext")]
public class GPUCanvasContext
- Inheritance
-
GPUCanvasContext
- Inherited Members
Remarks
Constructors
GPUCanvasContext()
public GPUCanvasContext()
Properties
Canvas
The canvas read-only property of the
GPUCanvasContext interface returns a reference to the canvas that the context was created from.
[Value("canvas")]
public Union218 Canvas { get; }
Property Value
- Union218
An HTMLCanvasElement or OffscreenCanvas object instance.
Remarks
Methods
Configure(GPUCanvasConfiguration)
The configure() method of the
GPUCanvasContext interface configures the context to use for rendering with a given GPUDevice. When called the canvas will initially be cleared to transparent black.
[Value("configure")]
public GlobalObject.Undefined Configure(GPUCanvasConfiguration configuration)
Parameters
configurationGPUCanvasConfiguration
Returns
- GlobalObject.Undefined
None (
undefined).
Remarks
GetConfiguration()
The getConfiguration() method of the
GPUCanvasContext interface returns the current configuration set for the context.
[Value("getConfiguration")]
public GPUCanvasConfiguration? GetConfiguration()
Returns
- GPUCanvasConfiguration
An object containing the configuration options set on the context (i.e., via the Configure(GPUCanvasConfiguration) method), or
nullif no configuration is set (either no configuration was previously set, or a configuration was set and then Unconfigure() was called on the context).
Remarks
GetCurrentTexture()
The getCurrentTexture() method of the
GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.
[Value("getCurrentTexture")]
public GPUTexture GetCurrentTexture()
Returns
- GPUTexture
A GPUTexture object instance.
Remarks
Unconfigure()
The unconfigure() method of the
GPUCanvasContext interface removes any previously-set context configuration, and destroys any textures returned via GetCurrentTexture() while the canvas context was configured.
[Value("unconfigure")]
public GlobalObject.Undefined Unconfigure()
Returns
- GlobalObject.Undefined
None (
undefined).