Table of Contents

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

configuration Configuration

The configuration instance to bind to the created backend.

host WebGPUSurfaceHost

The native surface host that the WebGPU surface will attach to.

framebufferSize Size

The initial framebuffer size in pixels.

options WebGPUExternalSurfaceOptions

The external surface options.

WebGPUExternalSurface(WebGPUSurfaceHost, Size)

Initializes a new instance of the WebGPUExternalSurface class.

public WebGPUExternalSurface(WebGPUSurfaceHost host, Size framebufferSize)

Parameters

host WebGPUSurfaceHost

The native surface host that the WebGPU surface will attach to.

framebufferSize Size

The 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

host WebGPUSurfaceHost

The native surface host that the WebGPU surface will attach to.

framebufferSize Size

The initial framebuffer size in pixels.

options WebGPUExternalSurfaceOptions

The external surface options.

Properties

DeviceContext

Gets the WebGPU device context used to render this surface.

public WebGPUDeviceContext DeviceContext { get; }

Property Value

WebGPUDeviceContext

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

framebufferSize Size

The 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

frame WebGPUSurfaceFrame

Receives the acquired frame on success.

Returns

bool

true when a frame is available; otherwise false.

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

options DrawingOptions

The drawing options for the acquired frame.

frame WebGPUSurfaceFrame

Receives the acquired frame on success.

Returns

bool

true when a frame is available; otherwise false.

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.