|
|
|
@ -349,9 +349,7 @@ namespace ImageSharp |
|
|
|
/// <returns>The <see cref="Image{TColor}"/></returns>
|
|
|
|
public Image<TColor> Save(Stream stream, IEncoderOptions options) |
|
|
|
{ |
|
|
|
Guard.NotNull(stream, nameof(stream)); |
|
|
|
this.SaveInternal(stream, this.CurrentImageFormat?.Encoder, options); |
|
|
|
return this; |
|
|
|
return this.Save(stream, this.CurrentImageFormat?.Encoder, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -376,9 +374,7 @@ namespace ImageSharp |
|
|
|
{ |
|
|
|
Guard.NotNull(format, nameof(format)); |
|
|
|
|
|
|
|
this.SaveInternal(stream, format.Encoder, options); |
|
|
|
|
|
|
|
return this; |
|
|
|
return this.Save(stream, format.Encoder, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -407,7 +403,10 @@ namespace ImageSharp |
|
|
|
/// </returns>
|
|
|
|
public Image<TColor> Save(Stream stream, IImageEncoder encoder, IEncoderOptions options) |
|
|
|
{ |
|
|
|
this.SaveInternal(stream, encoder, options); |
|
|
|
Guard.NotNull(stream, nameof(stream)); |
|
|
|
Guard.NotNull(encoder, nameof(encoder)); |
|
|
|
|
|
|
|
encoder.Encode(this, stream, options); |
|
|
|
|
|
|
|
return this; |
|
|
|
} |
|
|
|
@ -581,22 +580,6 @@ namespace ImageSharp |
|
|
|
base.Dispose(disposing); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Internally saves the image to the given stream using the given image encoder and options.
|
|
|
|
/// Can be used by overridden by tests to verify save opperations.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="stream">The stream to save the image to.</param>
|
|
|
|
/// <param name="encoder">The encoder to save the image with.</param>
|
|
|
|
/// <param name="options">The options for the encoder.</param>
|
|
|
|
/// <exception cref="System.ArgumentNullException">Thrown if the stream or encoder is null.</exception>
|
|
|
|
private void SaveInternal(Stream stream, IImageEncoder encoder, IEncoderOptions options) |
|
|
|
{ |
|
|
|
Guard.NotNull(stream, nameof(stream)); |
|
|
|
Guard.NotNull(encoder, nameof(encoder)); |
|
|
|
|
|
|
|
encoder.Encode(this, stream, options); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Copies the properties from the other <see cref="IImage"/>.
|
|
|
|
/// </summary>
|
|
|
|
|