mirror of https://github.com/SixLabors/ImageSharp
9 changed files with 915 additions and 505 deletions
@ -1,100 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Formats.Bmp; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, string path) => SaveAsBmp(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, string path) => SaveAsBmpAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, string path, BmpEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, string path, BmpEncoder encoder) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, Stream stream) => SaveAsBmp(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, Stream stream) => SaveAsBmpAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, Stream stream, BmpEncoder encoder) => |
|||
source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, Stream stream, BmpEncoder encoder) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance)); |
|||
} |
|||
} |
|||
@ -1,100 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Formats.Gif; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsGif(this Image source, string path) => SaveAsGif(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, string path) => SaveAsGifAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsGif(this Image source, string path, GifEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, string path, GifEncoder encoder) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsGif(this Image source, Stream stream) => SaveAsGif(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, Stream stream) => SaveAsGifAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsGif(this Image source, Stream stream, GifEncoder encoder) => |
|||
source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, Stream stream, GifEncoder encoder) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance)); |
|||
} |
|||
} |
|||
@ -0,0 +1,694 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
// <auto-generated />
|
|||
using System.IO; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
|
|||
using SixLabors.ImageSharp.Formats.Bmp; |
|||
using SixLabors.ImageSharp.Formats.Gif; |
|||
using SixLabors.ImageSharp.Formats.Jpeg; |
|||
using SixLabors.ImageSharp.Formats.Png; |
|||
using SixLabors.ImageSharp.Formats.Tga; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, string path) => SaveAsBmp(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, string path) => SaveAsBmpAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, string path, CancellationToken cancellationToken) |
|||
=> SaveAsBmpAsync(source, path, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, string path, BmpEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, string path, BmpEncoder encoder) |
|||
=> SaveAsBmpAsync(source, path, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, string path, BmpEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsBmp(this Image source, Stream stream) |
|||
=> SaveAsBmp(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, Stream stream) => SaveAsBmpAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, Stream stream, CancellationToken cancellationToken) |
|||
=> SaveAsBmpAsync(source, stream, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static void SaveAsBmp(this Image source, Stream stream, BmpEncoder encoder) |
|||
=> source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, Stream stream, BmpEncoder encoder) |
|||
=> SaveAsBmpAsync(source, stream, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Bmp format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsBmpAsync(this Image source, Stream stream, BmpEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsGif(this Image source, string path) => SaveAsGif(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, string path) => SaveAsGifAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, string path, CancellationToken cancellationToken) |
|||
=> SaveAsGifAsync(source, path, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsGif(this Image source, string path, GifEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, string path, GifEncoder encoder) |
|||
=> SaveAsGifAsync(source, path, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, string path, GifEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsGif(this Image source, Stream stream) |
|||
=> SaveAsGif(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, Stream stream) => SaveAsGifAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, Stream stream, CancellationToken cancellationToken) |
|||
=> SaveAsGifAsync(source, stream, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static void SaveAsGif(this Image source, Stream stream, GifEncoder encoder) |
|||
=> source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, Stream stream, GifEncoder encoder) |
|||
=> SaveAsGifAsync(source, stream, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Gif format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsGifAsync(this Image source, Stream stream, GifEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(GifFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, string path) => SaveAsJpeg(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, string path) => SaveAsJpegAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, string path, CancellationToken cancellationToken) |
|||
=> SaveAsJpegAsync(source, path, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, string path, JpegEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, string path, JpegEncoder encoder) |
|||
=> SaveAsJpegAsync(source, path, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, string path, JpegEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, Stream stream) |
|||
=> SaveAsJpeg(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, Stream stream) => SaveAsJpegAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, Stream stream, CancellationToken cancellationToken) |
|||
=> SaveAsJpegAsync(source, stream, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static void SaveAsJpeg(this Image source, Stream stream, JpegEncoder encoder) |
|||
=> source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, Stream stream, JpegEncoder encoder) |
|||
=> SaveAsJpegAsync(source, stream, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, Stream stream, JpegEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsPng(this Image source, string path) => SaveAsPng(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, string path) => SaveAsPngAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, string path, CancellationToken cancellationToken) |
|||
=> SaveAsPngAsync(source, path, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsPng(this Image source, string path, PngEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, string path, PngEncoder encoder) |
|||
=> SaveAsPngAsync(source, path, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, string path, PngEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsPng(this Image source, Stream stream) |
|||
=> SaveAsPng(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, Stream stream) => SaveAsPngAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, Stream stream, CancellationToken cancellationToken) |
|||
=> SaveAsPngAsync(source, stream, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static void SaveAsPng(this Image source, Stream stream, PngEncoder encoder) |
|||
=> source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, Stream stream, PngEncoder encoder) |
|||
=> SaveAsPngAsync(source, stream, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, Stream stream, PngEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsTga(this Image source, string path) => SaveAsTga(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, string path) => SaveAsTgaAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, string path, CancellationToken cancellationToken) |
|||
=> SaveAsTgaAsync(source, path, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsTga(this Image source, string path, TgaEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, string path, TgaEncoder encoder) |
|||
=> SaveAsTgaAsync(source, path, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, string path, TgaEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsTga(this Image source, Stream stream) |
|||
=> SaveAsTga(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, Stream stream) => SaveAsTgaAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, Stream stream, CancellationToken cancellationToken) |
|||
=> SaveAsTgaAsync(source, stream, null, cancellationToken); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static void SaveAsTga(this Image source, Stream stream, TgaEncoder encoder) |
|||
=> source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, Stream stream, TgaEncoder encoder) |
|||
=> SaveAsTgaAsync(source, stream, encoder, default); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the Tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, Stream stream, TgaEncoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,180 @@ |
|||
<#@ template language="C#" #> |
|||
<#@ import namespace="System.Text" #> |
|||
<#@ import namespace="System.Collections.Generic" #> |
|||
// Copyright (c) Six Labors. |
|||
// Licensed under the Apache License, Version 2.0. |
|||
|
|||
// <auto-generated /> |
|||
using System.IO; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
|
|||
<# |
|||
var formats = new []{ |
|||
"Bmp", |
|||
"Gif", |
|||
"Jpeg", |
|||
"Png", |
|||
"Tga", |
|||
}; |
|||
|
|||
foreach (string fmt in formats) |
|||
{ |
|||
#> |
|||
using SixLabors.ImageSharp.Formats.<#= fmt #>; |
|||
<# |
|||
|
|||
} |
|||
#> |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary> |
|||
/// Extension methods for the <see cref="Image"/> type. |
|||
/// </summary> |
|||
public static partial class ImageExtensions |
|||
{ |
|||
<# |
|||
foreach (string fmt in formats) |
|||
{ |
|||
#> |
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="path">The file path to save the image to.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception> |
|||
public static void SaveAs<#= fmt #>(this Image source, string path) => SaveAs<#= fmt #>(source, path, null); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="path">The file path to save the image to.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, string path) => SaveAs<#= fmt #>Async(source, path, null); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="path">The file path to save the image to.</param> |
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, string path, CancellationToken cancellationToken) |
|||
=> SaveAs<#= fmt #>Async(source, path, null, cancellationToken); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="path">The file path to save the image to.</param> |
|||
/// <param name="encoder">The encoder to save the image with.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception> |
|||
public static void SaveAs<#= fmt #>(this Image source, string path, <#= fmt #>Encoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance)); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="path">The file path to save the image to.</param> |
|||
/// <param name="encoder">The encoder to save the image with.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, string path, <#= fmt #>Encoder encoder) |
|||
=> SaveAs<#= fmt #>Async(source, path, encoder, default); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="path">The file path to save the image to.</param> |
|||
/// <param name="encoder">The encoder to save the image with.</param> |
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, string path, <#= fmt #>Encoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(BmpFormat.Instance), |
|||
cancellationToken); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="stream">The stream to save the image to.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> |
|||
public static void SaveAs<#= fmt #>(this Image source, Stream stream) |
|||
=> SaveAs<#= fmt #>(source, stream, null); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="stream">The stream to save the image to.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, Stream stream) => SaveAs<#= fmt #>Async(source, stream, null); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="stream">The stream to save the image to.</param> |
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, Stream stream, CancellationToken cancellationToken) |
|||
=> SaveAs<#= fmt #>Async(source, stream, null, cancellationToken); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="stream">The stream to save the image to.</param> |
|||
/// <param name="encoder">The encoder to save the image with.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static void SaveAs<#= fmt #>(this Image source, Stream stream, <#= fmt #>Encoder encoder) |
|||
=> source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance)); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="stream">The stream to save the image to.</param> |
|||
/// <param name="encoder">The encoder to save the image with.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, Stream stream, <#= fmt #>Encoder encoder) |
|||
=> SaveAs<#= fmt #>Async(source, stream, encoder, default); |
|||
|
|||
/// <summary> |
|||
/// Saves the image to the given stream with the <#= fmt #> format. |
|||
/// </summary> |
|||
/// <param name="source">The image this method extends.</param> |
|||
/// <param name="stream">The stream to save the image to.</param> |
|||
/// <param name="encoder">The encoder to save the image with.</param> |
|||
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param> |
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception> |
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> |
|||
public static Task SaveAs<#= fmt #>Async(this Image source, Stream stream, <#= fmt #>Encoder encoder, CancellationToken cancellationToken) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance), |
|||
cancellationToken); |
|||
|
|||
<# |
|||
} |
|||
#> |
|||
} |
|||
} |
|||
@ -1,100 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Formats.Jpeg; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, string path) => SaveAsJpeg(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, string path) => SaveAsJpegAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, string path, JpegEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, string path, JpegEncoder encoder) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, Stream stream) => SaveAsJpeg(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, Stream stream) => SaveAsJpegAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsJpeg(this Image source, Stream stream, JpegEncoder encoder) => |
|||
source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the jpeg format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsJpegAsync(this Image source, Stream stream, JpegEncoder encoder) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(JpegFormat.Instance)); |
|||
} |
|||
} |
|||
@ -1,100 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Formats.Png; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsPng(this Image source, string path) => SaveAsPng(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, string path) => SaveAsPngAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsPng(this Image source, string path, PngEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, string path, PngEncoder encoder) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsPng(this Image source, Stream stream) => SaveAsPng(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, Stream stream) => SaveAsPngAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsPng(this Image source, Stream stream, PngEncoder encoder) => |
|||
source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the png format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsPngAsync(this Image source, Stream stream, PngEncoder encoder) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(PngFormat.Instance)); |
|||
} |
|||
} |
|||
@ -1,100 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using SixLabors.ImageSharp.Advanced; |
|||
using SixLabors.ImageSharp.Formats.Tga; |
|||
|
|||
namespace SixLabors.ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsTga(this Image source, string path) => SaveAsTga(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, string path) => SaveAsTgaAsync(source, path, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
public static void SaveAsTga(this Image source, string path, TgaEncoder encoder) => |
|||
source.Save( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="path">The file path to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, string path, TgaEncoder encoder) => |
|||
source.SaveAsync( |
|||
path, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsTga(this Image source, Stream stream) => SaveAsTga(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, Stream stream) => SaveAsTgaAsync(source, stream, null); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
public static void SaveAsTga(this Image source, Stream stream, TgaEncoder encoder) => |
|||
source.Save( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance)); |
|||
|
|||
/// <summary>
|
|||
/// Saves the image to the given stream with the tga format.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="stream">The stream to save the image to.</param>
|
|||
/// <param name="encoder">The encoder to save the image with.</param>
|
|||
/// <exception cref="System.ArgumentNullException">Thrown if the stream is null.</exception>
|
|||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
|||
public static Task SaveAsTgaAsync(this Image source, Stream stream, TgaEncoder encoder) => |
|||
source.SaveAsync( |
|||
stream, |
|||
encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(TgaFormat.Instance)); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue