// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Diagnostics.CodeAnalysis; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Drawing.Processing.Backends { /// /// Canvas frame backed by a . /// /// The pixel format. public sealed class NativeCanvasFrame : ICanvasFrame where TPixel : unmanaged, IPixel { private readonly NativeSurface surface; /// /// Initializes a new instance of the class. /// /// The frame bounds. /// The native surface backing this frame. public NativeCanvasFrame(Rectangle bounds, NativeSurface surface) { Guard.NotNull(surface, nameof(surface)); Guard.MustBeGreaterThan(bounds.Width, 0, nameof(bounds)); Guard.MustBeGreaterThan(bounds.Height, 0, nameof(bounds)); this.Bounds = bounds; this.surface = surface; } /// public Rectangle Bounds { get; } /// public bool TryGetCpuRegion(out Buffer2DRegion region) { region = default; return false; } /// public bool TryGetNativeSurface([NotNullWhen(true)] out NativeSurface? surface) { surface = this.surface; return true; } } }