// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; using System; using System.Collections.Generic; namespace SixLabors.ImageSharp.Drawing.Processing.Backends { /// /// Defines the contract for creating and rendering retained drawing scenes for canvas targets. /// public interface IDrawingBackend { /// /// Creates a retained backend scene from a prepared command batch. /// /// The active processing configuration. /// The target bounds used for target-dependent scene data. /// The scene commands in submission order. /// The resources that must stay alive for the returned scene. /// A retained backend scene. public DrawingBackendScene CreateScene( Configuration configuration, Rectangle targetBounds, DrawingCommandBatch commandBatch, IReadOnlyList? ownedResources = null); /// /// Renders a retained backend scene into the target. /// /// The pixel format. /// The active processing configuration. /// The target frame. /// The retained backend scene to render. public void RenderScene( Configuration configuration, ICanvasFrame target, DrawingBackendScene scene) where TPixel : unmanaged, IPixel; /// /// Reads source pixels from the target into the destination region. /// /// The pixel format. /// The active processing configuration. /// The target frame. /// The source rectangle in target-local coordinates. /// The destination region that receives the copied pixels. public void ReadRegion( Configuration configuration, ICanvasFrame target, Rectangle sourceRectangle, Buffer2DRegion destination) where TPixel : unmanaged, IPixel; } }