From bb88a75d5548942be6e7f4103a3e0ddde5eeb9e8 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Sat, 9 Sep 2017 11:11:39 +0100 Subject: [PATCH] expose span APIs on image --- src/ImageSharp/Advanced/ImageExtensions.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ImageSharp/Advanced/ImageExtensions.cs b/src/ImageSharp/Advanced/ImageExtensions.cs index 243745c9b2..4369cf67a6 100644 --- a/src/ImageSharp/Advanced/ImageExtensions.cs +++ b/src/ImageSharp/Advanced/ImageExtensions.cs @@ -33,6 +33,27 @@ namespace SixLabors.ImageSharp.Advanced where TPixel : struct, IPixel => GetSpan(source, row); + /// + /// Gets the representation of the pixels as an area of contiguous memory in the given pixel format. + /// + /// The type of the pixel. + /// The source. + /// The + public static Span GetPixelSpan(this Image source) + where TPixel : struct, IPixel + => source.Frames.RootFrame.GetPixelSpan(); + + /// + /// Gets the representation of the pixels as an area of contiguous memory at row 'y' beginning from the the first pixel on that row. + /// + /// The type of the pixel. + /// The source. + /// The row. + /// The + public static Span GetPixelRowSpan(this Image source, int row) + where TPixel : struct, IPixel + => source.Frames.RootFrame.GetPixelRowSpan(row); + /// /// Gets the configuration for the image. ///