Browse Source

Added method to reset the pixels of the PixelAccessor or PixelRow.

af/merge-core
dirk 10 years ago
committed by Dirk Lemstra
parent
commit
17e212e8f0
  1. 8
      src/ImageSharp/Image/PixelAccessor.cs
  2. 9
      src/ImageSharp/Image/PixelRow.cs

8
src/ImageSharp/Image/PixelAccessor.cs

@ -399,5 +399,13 @@ namespace ImageSharp
{ {
return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf<TColor>()); return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf<TColor>());
} }
/// <summary>
/// Resets all the pixels to it's initial value.
/// </summary>
internal void Reset()
{
Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height));
}
} }
} }

9
src/ImageSharp/Image/PixelRow.cs

@ -7,6 +7,7 @@ namespace ImageSharp
{ {
using System; using System;
using System.IO; using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
/// <summary> /// <summary>
@ -201,5 +202,13 @@ namespace ImageSharp
throw new NotSupportedException(); throw new NotSupportedException();
} }
/// <summary>
/// Resets the bytes of the array to it's initial value.
/// </summary>
internal void Reset()
{
Unsafe.InitBlock(this.PixelBase, 0, (uint)this.Bytes.Length);
}
} }
} }

Loading…
Cancel
Save