Class WebGPUDrawingBackend
- Namespace
- SixLabors.ImageSharp.Drawing.Processing.Backends
- Assembly
- SixLabors.ImageSharp.Drawing.WebGPU.dll
Pixel-format registration for composite session I/O.
public sealed class WebGPUDrawingBackend : IDrawingBackend, IDisposable
- Inheritance
-
WebGPUDrawingBackend
- Implements
- Inherited Members
Remarks
SixLabors.ImageSharp.Drawing.Processing.Backends.WebGPUDrawingBackend.CompositePixelRegistrations is intentionally explicit and only includes one-to-one format mappings
where the GPU texture format can round-trip the pixel payload without channel swizzle or custom conversion logic.
Only formats that support storage texture binding (required by the compute compositor) are included.
Formats that lack storage support are omitted and fall back to the CPU backend.
Constructors
WebGPUDrawingBackend()
Initializes a new instance of the WebGPUDrawingBackend class.
public WebGPUDrawingBackend()
Methods
CopyPixels<TPixel>(Configuration, ICanvasFrame<TPixel>, ICanvasFrame<TPixel>, Rectangle, Point)
Copies pixels from a source frame into a target frame.
public void CopyPixels<TPixel>(Configuration configuration, ICanvasFrame<TPixel> source, ICanvasFrame<TPixel> target, Rectangle sourceRectangle, Point targetPoint) where TPixel : unmanaged, IPixel<TPixel>
Parameters
configurationConfigurationThe active processing configuration.
sourceICanvasFrame<TPixel>The source frame.
targetICanvasFrame<TPixel>The target frame.
sourceRectangleRectangleThe source rectangle in source-local coordinates.
targetPointPointThe target point in target-local coordinates.
Type Parameters
TPixelThe pixel format.
CreateScene(Configuration, Rectangle, DrawingCommandBatch, IReadOnlyList<IDisposable>?)
Creates a backend scene from a prepared command batch.
public DrawingBackendScene CreateScene(Configuration configuration, Rectangle targetBounds, DrawingCommandBatch commandBatch, IReadOnlyList<IDisposable>? ownedResources = null)
Parameters
configurationConfigurationThe active processing configuration.
targetBoundsRectangleThe target bounds used for target-dependent scene data.
commandBatchDrawingCommandBatchThe scene commands in submission order.
ownedResourcesIReadOnlyList<IDisposable>The resources that must stay alive for the returned scene.
Returns
- DrawingBackendScene
The created backend scene.
Dispose()
Releases all cached shared WebGPU resources.
public void Dispose()
ReadRegion<TPixel>(Configuration, ICanvasFrame<TPixel>, Rectangle, Buffer2DRegion<TPixel>)
Reads source pixels from the target into the destination region.
public void ReadRegion<TPixel>(Configuration configuration, ICanvasFrame<TPixel> target, Rectangle sourceRectangle, Buffer2DRegion<TPixel> destination) where TPixel : unmanaged, IPixel<TPixel>
Parameters
configurationConfigurationThe active processing configuration.
targetICanvasFrame<TPixel>The target frame.
sourceRectangleRectangleThe source rectangle in target-local coordinates.
destinationBuffer2DRegion<TPixel>The destination region that receives the copied pixels.
Type Parameters
TPixelThe pixel format.
RenderScene<TPixel>(Configuration, ICanvasFrame<TPixel>, DrawingBackendScene)
Renders a backend scene into the target.
public void RenderScene<TPixel>(Configuration configuration, ICanvasFrame<TPixel> target, DrawingBackendScene scene) where TPixel : unmanaged, IPixel<TPixel>
Parameters
configurationConfigurationThe active processing configuration.
targetICanvasFrame<TPixel>The target frame.
sceneDrawingBackendSceneThe backend scene to render.
Type Parameters
TPixelThe pixel format.