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
configurationConfigurationThe configuration instance to bind to the created backend.
formatWebGPUTextureFormatThe target texture format.
widthintThe target width in pixels.
heightintThe 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
configurationConfigurationThe configuration instance to bind to the created backend.
widthintThe target width in pixels.
heightintThe 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
formatWebGPUTextureFormatThe target texture format.
widthintThe target width in pixels.
heightintThe 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
Properties
Bounds
Gets the target bounds in pixels.
public Rectangle Bounds { get; }
Property Value
Format
Gets the allocated texture format.
public WebGPUTextureFormat Format { get; }
Property Value
Height
Gets the target height in pixels.
public int Height { get; }
Property Value
Width
Gets the target width in pixels.
public int Width { get; }
Property Value
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
optionsDrawingOptionsThe 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
TPixelThe 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
destinationBuffer2DRegion<TPixel>The destination buffer region that receives the readback pixels.
Type Parameters
TPixelThe destination image pixel format.