diff --git a/src/ImageSharp/Image/PixelAccessor.cs b/src/ImageSharp/Image/PixelAccessor.cs index 0cd634126..0f8390677 100644 --- a/src/ImageSharp/Image/PixelAccessor.cs +++ b/src/ImageSharp/Image/PixelAccessor.cs @@ -399,5 +399,13 @@ namespace ImageSharp { return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf()); } + + /// + /// Resets all the pixels to it's initial value. + /// + internal void Reset() + { + Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); + } } } \ No newline at end of file diff --git a/src/ImageSharp/Image/PixelRow.cs b/src/ImageSharp/Image/PixelRow.cs index d19e9ccfe..e13b62005 100644 --- a/src/ImageSharp/Image/PixelRow.cs +++ b/src/ImageSharp/Image/PixelRow.cs @@ -7,6 +7,7 @@ namespace ImageSharp { using System; using System.IO; + using System.Runtime.CompilerServices; using System.Runtime.InteropServices; /// @@ -201,5 +202,13 @@ namespace ImageSharp throw new NotSupportedException(); } + + /// + /// Resets the bytes of the array to it's initial value. + /// + internal void Reset() + { + Unsafe.InitBlock(this.PixelBase, 0, (uint)this.Bytes.Length); + } } }