Table of Contents

Class WebGPURenderTarget

Namespace
SixLabors.ImageSharp.Drawing.Processing.Backends
Assembly
SixLabors.ImageSharp.Drawing.WebGPU.dll

An offscreen WebGPU render target.

public sealed class WebGPURenderTarget : IDisposable
Inheritance
WebGPURenderTarget
Implements
Inherited Members

Remarks

The constructors on this type allocate a target on the shared process WebGPU device.

Constructors

WebGPURenderTarget(Configuration, WebGPUTextureFormat, int, int)

Initializes a new instance of the WebGPURenderTarget class using the shared process-level device.

public WebGPURenderTarget(Configuration configuration, WebGPUTextureFormat format, int width, int height)

Parameters

configuration Configuration

The configuration instance to bind to the created backend.

format WebGPUTextureFormat

The target texture format.

width int

The target width in pixels.

height int

The target height in pixels.

WebGPURenderTarget(Configuration, int, int)

Initializes a new instance of the WebGPURenderTarget class using the shared process-level device and default RGBA8 format.

public WebGPURenderTarget(Configuration configuration, int width, int height)

Parameters

configuration Configuration

The configuration instance to bind to the created backend.

width int

The target width in pixels.

height int

The target height in pixels.

WebGPURenderTarget(WebGPUTextureFormat, int, int)

Initializes a new instance of the WebGPURenderTarget class using the shared process-level device.

public WebGPURenderTarget(WebGPUTextureFormat format, int width, int height)

Parameters

format WebGPUTextureFormat

The target texture format.

width int

The target width in pixels.

height int

The target height in pixels.

WebGPURenderTarget(int, int)

Initializes a new instance of the WebGPURenderTarget class using the shared process-level device and default RGBA8 format.

public WebGPURenderTarget(int width, int height)

Parameters

width int

The target width in pixels.

height int

The target height in pixels.

Properties

Bounds

Gets the target bounds in pixels.

public Rectangle Bounds { get; }

Property Value

Rectangle

Format

Gets the allocated texture format.

public WebGPUTextureFormat Format { get; }

Property Value

WebGPUTextureFormat

Height

Gets the target height in pixels.

public int Height { get; }

Property Value

int

Width

Gets the target width in pixels.

public int Width { get; }

Property Value

int

Methods

CreateCanvas()

Creates a drawing canvas over this render target.

public DrawingCanvas CreateCanvas()

Returns

DrawingCanvas

A drawing canvas targeting this render target.

CreateCanvas(DrawingOptions)

Creates a drawing canvas over this render target.

public DrawingCanvas CreateCanvas(DrawingOptions options)

Parameters

options DrawingOptions

The initial drawing options.

Returns

DrawingCanvas

A drawing canvas targeting this render target.

Dispose()

Releases the owned texture view and texture.

public void Dispose()

ReadbackImage()

Reads the current GPU texture contents back into a new CPU image.

public Image ReadbackImage()

Returns

Image

The readback image.

ReadbackImage<TPixel>()

Reads the current GPU texture contents back into a new CPU image.

public Image<TPixel> ReadbackImage<TPixel>() where TPixel : unmanaged, IPixel<TPixel>

Returns

Image<TPixel>

The readback image.

Type Parameters

TPixel

The destination image pixel format.

ReadbackInto<TPixel>(Buffer2DRegion<TPixel>)

Reads the current GPU texture contents back into an existing CPU buffer region.

public void ReadbackInto<TPixel>(Buffer2DRegion<TPixel> destination) where TPixel : unmanaged, IPixel<TPixel>

Parameters

destination Buffer2DRegion<TPixel>

The destination buffer region that receives the readback pixels.

Type Parameters

TPixel

The destination image pixel format.