|
|
|
@ -148,6 +148,37 @@ namespace ImageSharp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
|
|
|
/// </summary>
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Resets all the pixels to it's initial value.
|
|
|
|
/// </summary>
|
|
|
|
public void Reset() |
|
|
|
{ |
|
|
|
Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Copy an area of pixels to the image.
|
|
|
|
/// </summary>
|
|
|
|
@ -157,7 +188,7 @@ namespace ImageSharp |
|
|
|
/// <exception cref="NotSupportedException">
|
|
|
|
/// Thrown when an unsupported component order value is passed.
|
|
|
|
/// </exception>
|
|
|
|
public void CopyFrom(PixelArea<TColor> area, int targetY, int targetX = 0) |
|
|
|
internal void CopyFrom(PixelArea<TColor> area, int targetY, int targetX = 0) |
|
|
|
{ |
|
|
|
this.CheckCoordinates(area, targetX, targetY); |
|
|
|
|
|
|
|
@ -173,7 +204,7 @@ namespace ImageSharp |
|
|
|
/// <exception cref="NotSupportedException">
|
|
|
|
/// Thrown when an unsupported component order value is passed.
|
|
|
|
/// </exception>
|
|
|
|
public void CopyTo(PixelArea<TColor> area, int sourceY, int sourceX = 0) |
|
|
|
internal void CopyTo(PixelArea<TColor> area, int sourceY, int sourceX = 0) |
|
|
|
{ |
|
|
|
this.CheckCoordinates(area, sourceX, sourceY); |
|
|
|
|
|
|
|
@ -190,7 +221,7 @@ namespace ImageSharp |
|
|
|
/// <exception cref="NotSupportedException">
|
|
|
|
/// Thrown when an unsupported component order value is passed.
|
|
|
|
/// </exception>
|
|
|
|
public void SafeCopyTo(PixelArea<TColor> area, int sourceY, int sourceX = 0) |
|
|
|
internal void SafeCopyTo(PixelArea<TColor> 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); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
|
|
|
/// </summary>
|
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Resets all the pixels to it's initial value.
|
|
|
|
/// </summary>
|
|
|
|
public void Reset() |
|
|
|
{ |
|
|
|
Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a <see cref="BufferPointer{TColor}"/> to the row 'y' beginning from the pixel at 'x'.
|
|
|
|
/// </summary>
|
|
|
|
|