Class WebGPUExternalSurface
- Namespace
- SixLabors.ImageSharp.Drawing.Processing.Backends
- Assembly
- SixLabors.ImageSharp.Drawing.WebGPU.dll
A WebGPU rendering surface bound to an externally-owned native host. Unlike WebGPUWindow, this type does not own a platform window; the host application owns the UI object, its lifecycle, and the drawable size notifications forwarded through Resize(Size).
public sealed class WebGPUExternalSurface : IDisposable
- Inheritance
-
WebGPUExternalSurface
- Implements
- Inherited Members
Constructors
WebGPUExternalSurface(Configuration, WebGPUSurfaceHost, Size, WebGPUExternalSurfaceOptions)
Initializes a new instance of the WebGPUExternalSurface class.
public WebGPUExternalSurface(Configuration configuration, WebGPUSurfaceHost host, Size framebufferSize, WebGPUExternalSurfaceOptions options)
Parameters
configurationConfigurationThe configuration instance to bind to the created backend.
hostWebGPUSurfaceHostThe native surface host that the WebGPU surface will attach to.
framebufferSizeSizeThe initial framebuffer size in pixels.
optionsWebGPUExternalSurfaceOptionsThe external surface options.
WebGPUExternalSurface(WebGPUSurfaceHost, Size)
Initializes a new instance of the WebGPUExternalSurface class.
public WebGPUExternalSurface(WebGPUSurfaceHost host, Size framebufferSize)
Parameters
hostWebGPUSurfaceHostThe native surface host that the WebGPU surface will attach to.
framebufferSizeSizeThe initial framebuffer size in pixels.
WebGPUExternalSurface(WebGPUSurfaceHost, Size, WebGPUExternalSurfaceOptions)
Initializes a new instance of the WebGPUExternalSurface class.
public WebGPUExternalSurface(WebGPUSurfaceHost host, Size framebufferSize, WebGPUExternalSurfaceOptions options)
Parameters
hostWebGPUSurfaceHostThe native surface host that the WebGPU surface will attach to.
framebufferSizeSizeThe initial framebuffer size in pixels.
optionsWebGPUExternalSurfaceOptionsThe external surface options.
Properties
DeviceContext
Gets the WebGPU device context used to render this surface.
public WebGPUDeviceContext DeviceContext { get; }
Property Value
Remarks
The owning surface session controls the returned context's lifetime.
Methods
Dispose()
Releases the WebGPU surface stack. The native host handles supplied through WebGPUSurfaceHost remain owned by the caller and are not released.
public void Dispose()
Resize(Size)
Notifies the external surface that the drawable framebuffer has resized and reconfigures the swapchain when the size changes. Zero-area sizes (minimize, mid-layout) pause frame acquisition while the last valid native configuration is retained.
public void Resize(Size framebufferSize)
Parameters
framebufferSizeSizeThe new framebuffer size in pixels.
TryAcquireFrame(out WebGPUSurfaceFrame?)
Tries to acquire the next drawable frame using default drawing options.
public bool TryAcquireFrame(out WebGPUSurfaceFrame? frame)
Parameters
frameWebGPUSurfaceFrameReceives the acquired frame on success.
Returns
Remarks
A false result means no drawable frame is available right now, for example because the surface was lost, outdated, timed out, or has a zero-sized framebuffer. Dispose the returned frame when you are done with it to present it and release its per-frame resources.
TryAcquireFrame(DrawingOptions, out WebGPUSurfaceFrame?)
Tries to acquire the next drawable frame.
public bool TryAcquireFrame(DrawingOptions options, out WebGPUSurfaceFrame? frame)
Parameters
optionsDrawingOptionsThe drawing options for the acquired frame.
frameWebGPUSurfaceFrameReceives the acquired frame on success.
Returns
Remarks
A false result means no drawable frame is available right now, for example because the surface was lost, outdated, timed out, or has a zero-sized framebuffer. Dispose the returned frame when you are done with it to present it and release its per-frame resources.