Interface ICanvasFrame<TPixel>
- Namespace
- SixLabors.ImageSharp.Drawing.Processing.Backends
- Assembly
- SixLabors.ImageSharp.Drawing.dll
A render destination for DrawingCanvas<TPixel>. Implementations back the canvas with either a CPU-accessible pixel region or an opaque native surface; a usable frame must expose at least one of the two.
public interface ICanvasFrame<TPixel> where TPixel : unmanaged, IPixel<TPixel>
Type Parameters
TPixelThe pixel format.
Remarks
A backend inspects the frame through TryGetCpuRegion(out Buffer2DRegion<TPixel>) and TryGetNativeSurface(out NativeSurface?) to choose its render path. Exactly one of the two succeeds for a given frame: a CPU frame yields a Buffer2DRegion<T>, a native frame yields a NativeSurface.
Properties
Bounds
Gets the frame bounds in root target coordinates.
Rectangle Bounds { get; }
Property Value
Methods
TryGetCpuRegion(out Buffer2DRegion<TPixel>)
Attempts to get a CPU-accessible destination region.
bool TryGetCpuRegion(out Buffer2DRegion<TPixel> region)
Parameters
regionBuffer2DRegion<TPixel>The CPU region when available.
Returns
TryGetNativeSurface(out NativeSurface?)
Attempts to get an opaque native destination surface.
bool TryGetNativeSurface(out NativeSurface? surface)
Parameters
surfaceNativeSurfaceThe native surface when available.