diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs index 11b5c60d15..5105e57abb 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs @@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters /// /// The 1-4 sized list of component buffers. /// The row to convert - public ComponentValues(IReadOnlyList> componentBuffers, int row) + public ComponentValues(IReadOnlyList> componentBuffers, int row) { this.ComponentCount = componentBuffers.Count; diff --git a/src/ImageSharp/Memory/Buffer2DExtensions.cs b/src/ImageSharp/Memory/Buffer2DExtensions.cs index 58e273123b..c277525703 100644 --- a/src/ImageSharp/Memory/Buffer2DExtensions.cs +++ b/src/ImageSharp/Memory/Buffer2DExtensions.cs @@ -8,14 +8,14 @@ using SixLabors.Primitives; namespace SixLabors.Memory { /// - /// Defines extension methods for . + /// Defines extension methods for . /// internal static class Buffer2DExtensions { /// /// Gets a to the backing buffer of . /// - internal static Span GetSpan(this IBuffer2D buffer) + internal static Span GetSpan(this Buffer2D buffer) where T : struct { return buffer.Buffer.GetSpan(); @@ -30,7 +30,7 @@ namespace SixLabors.Memory /// The element type /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span GetRowSpan(this IBuffer2D buffer, int x, int y) + public static Span GetRowSpan(this Buffer2D buffer, int x, int y) where T : struct { return buffer.GetSpan().Slice((y * buffer.Width) + x, buffer.Width - x); @@ -44,7 +44,7 @@ namespace SixLabors.Memory /// The element type /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span GetRowSpan(this IBuffer2D buffer, int y) + public static Span GetRowSpan(this Buffer2D buffer, int y) where T : struct { return buffer.GetSpan().Slice(y * buffer.Width, buffer.Width); @@ -58,7 +58,7 @@ namespace SixLabors.Memory /// The element type /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Memory GetRowMemory(this IBuffer2D buffer, int y) + public static Memory GetRowMemory(this Buffer2D buffer, int y) where T : struct { return buffer.Buffer.Memory.Slice(y * buffer.Width, buffer.Width); @@ -68,9 +68,9 @@ namespace SixLabors.Memory /// Returns the size of the buffer. /// /// The element type - /// The + /// The /// The of the buffer - public static Size Size(this IBuffer2D buffer) + public static Size Size(this Buffer2D buffer) where T : struct { return new Size(buffer.Width, buffer.Height); @@ -80,9 +80,9 @@ namespace SixLabors.Memory /// Returns a representing the full area of the buffer. /// /// The element type - /// The + /// The /// The - public static Rectangle FullRectangle(this IBuffer2D buffer) + public static Rectangle FullRectangle(this Buffer2D buffer) where T : struct { return new Rectangle(0, 0, buffer.Width, buffer.Height); @@ -92,13 +92,13 @@ namespace SixLabors.Memory /// Return a to the subarea represented by 'rectangle' /// /// The element type - /// The + /// The /// The rectangle subarea /// The - public static BufferArea GetArea(this IBuffer2D buffer, Rectangle rectangle) + public static BufferArea GetArea(this Buffer2D buffer, Rectangle rectangle) where T : struct => new BufferArea(buffer, rectangle); - public static BufferArea GetArea(this IBuffer2D buffer, int x, int y, int width, int height) + public static BufferArea GetArea(this Buffer2D buffer, int x, int y, int width, int height) where T : struct { var rectangle = new Rectangle(x, y, width, height); @@ -109,9 +109,9 @@ namespace SixLabors.Memory /// Return a to the whole area of 'buffer' /// /// The element type - /// The + /// The /// The - public static BufferArea GetArea(this IBuffer2D buffer) + public static BufferArea GetArea(this Buffer2D buffer) where T : struct => new BufferArea(buffer); } } \ No newline at end of file diff --git a/src/ImageSharp/Memory/Buffer2D{T}.cs b/src/ImageSharp/Memory/Buffer2D{T}.cs index b62156ffb8..f8d75b54c0 100644 --- a/src/ImageSharp/Memory/Buffer2D{T}.cs +++ b/src/ImageSharp/Memory/Buffer2D{T}.cs @@ -12,7 +12,7 @@ namespace SixLabors.Memory /// interpreted as a 2D region of x elements. /// /// The value type. - internal class Buffer2D : IBuffer2D, IDisposable + internal class Buffer2D : IDisposable where T : struct { /// @@ -28,10 +28,14 @@ namespace SixLabors.Memory this.Height = height; } - /// + /// + /// Gets the width. + /// public int Width { get; private set; } - /// + /// + /// Gets the height. + /// public int Height { get; private set; } /// diff --git a/src/ImageSharp/Memory/BufferArea{T}.cs b/src/ImageSharp/Memory/BufferArea{T}.cs index 96036f6eec..6a2146fd20 100644 --- a/src/ImageSharp/Memory/BufferArea{T}.cs +++ b/src/ImageSharp/Memory/BufferArea{T}.cs @@ -18,7 +18,7 @@ namespace SixLabors.Memory public readonly Rectangle Rectangle; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public BufferArea(IBuffer2D destinationBuffer, Rectangle rectangle) + public BufferArea(Buffer2D destinationBuffer, Rectangle rectangle) { ImageSharp.DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.X, 0, nameof(rectangle)); ImageSharp.DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.Y, 0, nameof(rectangle)); @@ -30,15 +30,15 @@ namespace SixLabors.Memory } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public BufferArea(IBuffer2D destinationBuffer) + public BufferArea(Buffer2D destinationBuffer) : this(destinationBuffer, destinationBuffer.FullRectangle()) { } /// - /// Gets the being pointed by this instance. + /// Gets the being pointed by this instance. /// - public IBuffer2D DestinationBuffer { get; } + public Buffer2D DestinationBuffer { get; } /// /// Gets the size of the area. diff --git a/src/ImageSharp/Memory/IBuffer2D{T}.cs b/src/ImageSharp/Memory/IBuffer2D{T}.cs deleted file mode 100644 index a92f30dd57..0000000000 --- a/src/ImageSharp/Memory/IBuffer2D{T}.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System; - -namespace SixLabors.Memory -{ - /// - /// An interface that represents a contigous buffer of value type objects - /// interpreted as a 2D region of x elements. - /// - /// The value type. - internal interface IBuffer2D - where T : struct - { - /// - /// Gets the width. - /// - int Width { get; } - - /// - /// Gets the height. - /// - int Height { get; } - - /// - /// Gets the contigous buffer being wrapped. - /// - IBuffer Buffer { get; } - } -} \ No newline at end of file