diff --git a/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs b/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs index dcd031f6e2..f5c7871409 100644 --- a/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs +++ b/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs @@ -12,7 +12,7 @@ namespace ImageSharp /// Provides a resource pool that enables reusing instances of value type arrays for image data . /// /// The value type. - public class PixelDataPool + internal class PixelDataPool where T : struct { /// diff --git a/src/ImageSharp/Image/PixelAccessor{TColor}.cs b/src/ImageSharp/Image/PixelAccessor{TColor}.cs index 926e9f0558..25e232cf86 100644 --- a/src/ImageSharp/Image/PixelAccessor{TColor}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TColor}.cs @@ -148,6 +148,37 @@ namespace ImageSharp } } + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + if (this.isDisposed) + { + return; + } + + // Note disposing is done. + this.isDisposed = true; + + this.pixelBuffer.Dispose(); + + // This object will be cleaned up by the Dispose method. + // Therefore, you should call GC.SuppressFinalize to + // take this object off the finalization queue + // and prevent finalization code for this object + // from executing a second time. + GC.SuppressFinalize(this); + } + + /// + /// Resets all the pixels to it's initial value. + /// + public void Reset() + { + Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); + } + /// /// Copy an area of pixels to the image. /// @@ -157,7 +188,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - public void CopyFrom(PixelArea area, int targetY, int targetX = 0) + internal void CopyFrom(PixelArea area, int targetY, int targetX = 0) { this.CheckCoordinates(area, targetX, targetY); @@ -173,7 +204,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - public void CopyTo(PixelArea area, int sourceY, int sourceX = 0) + internal void CopyTo(PixelArea area, int sourceY, int sourceX = 0) { this.CheckCoordinates(area, sourceX, sourceY); @@ -190,7 +221,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - public void SafeCopyTo(PixelArea area, int sourceY, int sourceX = 0) + internal void SafeCopyTo(PixelArea area, int sourceY, int sourceX = 0) { int width = Math.Min(area.Width, this.Width - sourceX); if (width < 1) @@ -207,37 +238,6 @@ namespace ImageSharp this.CopyTo(area, sourceX, sourceY, width, height); } - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - if (this.isDisposed) - { - return; - } - - // Note disposing is done. - this.isDisposed = true; - - this.pixelBuffer.Dispose(); - - // This object will be cleaned up by the Dispose method. - // Therefore, you should call GC.SuppressFinalize to - // take this object off the finalization queue - // and prevent finalization code for this object - // from executing a second time. - GC.SuppressFinalize(this); - } - - /// - /// Resets all the pixels to it's initial value. - /// - public void Reset() - { - Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); - } - /// /// Gets a to the row 'y' beginning from the pixel at 'x'. /// diff --git a/src/ImageSharp/Image/PixelArea{TColor}.cs b/src/ImageSharp/Image/PixelArea{TColor}.cs index be6debba2f..8f2fa5b7a1 100644 --- a/src/ImageSharp/Image/PixelArea{TColor}.cs +++ b/src/ImageSharp/Image/PixelArea{TColor}.cs @@ -5,17 +5,15 @@ namespace ImageSharp { using System; - using System.Buffers; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; - using System.Runtime.InteropServices; /// /// Represents an area of generic pixels. /// /// The pixel format. - public sealed unsafe class PixelArea : IDisposable + internal sealed unsafe class PixelArea : IDisposable where TColor : struct, IPixel { ///