|
|
@ -19,6 +19,8 @@ namespace SixLabors.ImageSharp |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public abstract partial class Image : IImage, IConfigurationProvider |
|
|
public abstract partial class Image : IImage, IConfigurationProvider |
|
|
{ |
|
|
{ |
|
|
|
|
|
private bool isDisposed; |
|
|
|
|
|
|
|
|
private Size size; |
|
|
private Size size; |
|
|
private readonly Configuration configuration; |
|
|
private readonly Configuration configuration; |
|
|
|
|
|
|
|
|
@ -78,7 +80,17 @@ namespace SixLabors.ImageSharp |
|
|
Configuration IConfigurationProvider.Configuration => this.configuration; |
|
|
Configuration IConfigurationProvider.Configuration => this.configuration; |
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
/// <inheritdoc />
|
|
|
public void Dispose() => this.Dispose(true); |
|
|
public void Dispose() |
|
|
|
|
|
{ |
|
|
|
|
|
if (this.isDisposed) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.Dispose(true); |
|
|
|
|
|
|
|
|
|
|
|
this.isDisposed = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Saves the image to the given stream using the given image encoder.
|
|
|
/// Saves the image to the given stream using the given image encoder.
|
|
|
@ -144,7 +156,13 @@ namespace SixLabors.ImageSharp |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Throws <see cref="ObjectDisposedException"/> if the image is disposed.
|
|
|
/// Throws <see cref="ObjectDisposedException"/> if the image is disposed.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
internal abstract void EnsureNotDisposed(); |
|
|
internal void EnsureNotDisposed() |
|
|
|
|
|
{ |
|
|
|
|
|
if (this.isDisposed) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new ObjectDisposedException("Trying to execute an operation on a disposed image."); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Accepts a <see cref="IImageVisitor"/>.
|
|
|
/// Accepts a <see cref="IImageVisitor"/>.
|
|
|
|