Table of Contents

Interface IDrawingBackend

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

Defines the contract a drawing backend implements to turn recorded canvas commands into pixels: creating retained scenes from command batches, rendering those scenes into a canvas frame, and transferring pixels between frames (copy and readback).

public interface IDrawingBackend

Methods

CopyPixels<TPixel>(Configuration, ICanvasFrame<TPixel>, ICanvasFrame<TPixel>, Rectangle, Point)

Copies pixels from a source frame into a target frame.

void CopyPixels<TPixel>(Configuration configuration, ICanvasFrame<TPixel> source, ICanvasFrame<TPixel> target, Rectangle sourceRectangle, Point targetPoint) where TPixel : unmanaged, IPixel<TPixel>

Parameters

configuration Configuration

The active processing configuration.

source ICanvasFrame<TPixel>

The source frame.

target ICanvasFrame<TPixel>

The target frame.

sourceRectangle Rectangle

The source rectangle in source-local coordinates.

targetPoint Point

The target point in target-local coordinates.

Type Parameters

TPixel

The pixel format.

CreateScene(Configuration, Rectangle, DrawingCommandBatch, IReadOnlyList<IDisposable>?)

Creates a backend scene from a prepared command batch.

DrawingBackendScene CreateScene(Configuration configuration, Rectangle targetBounds, DrawingCommandBatch commandBatch, IReadOnlyList<IDisposable>? ownedResources = null)

Parameters

configuration Configuration

The active processing configuration.

targetBounds Rectangle

The target bounds used for target-dependent scene data.

commandBatch DrawingCommandBatch

The scene commands in submission order.

ownedResources IReadOnlyList<IDisposable>

The resources that must stay alive for the returned scene.

Returns

DrawingBackendScene

The created backend scene.

ReadRegion<TPixel>(Configuration, ICanvasFrame<TPixel>, Rectangle, Buffer2DRegion<TPixel>)

Reads source pixels from the target into the destination region.

void ReadRegion<TPixel>(Configuration configuration, ICanvasFrame<TPixel> target, Rectangle sourceRectangle, Buffer2DRegion<TPixel> destination) where TPixel : unmanaged, IPixel<TPixel>

Parameters

configuration Configuration

The active processing configuration.

target ICanvasFrame<TPixel>

The target frame.

sourceRectangle Rectangle

The source rectangle in target-local coordinates.

destination Buffer2DRegion<TPixel>

The destination region that receives the copied pixels.

Type Parameters

TPixel

The pixel format.

RenderScene<TPixel>(Configuration, ICanvasFrame<TPixel>, DrawingBackendScene)

Renders a backend scene into the target.

void RenderScene<TPixel>(Configuration configuration, ICanvasFrame<TPixel> target, DrawingBackendScene scene) where TPixel : unmanaged, IPixel<TPixel>

Parameters

configuration Configuration

The active processing configuration.

target ICanvasFrame<TPixel>

The target frame.

scene DrawingBackendScene

The backend scene to render.

Type Parameters

TPixel

The pixel format.