mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.0 KiB
51 lines
2.0 KiB
// <copyright file="IImageEncoder.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageSharp.Formats
|
|
{
|
|
using System.IO;
|
|
|
|
/// <summary>
|
|
/// Encapsulates properties and methods required for encoding an image to a stream.
|
|
/// </summary>
|
|
public interface IImageEncoder
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the quality of output for images.
|
|
/// </summary>
|
|
int Quality { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets the standard identifier used on the Internet to indicate the type of data that a file contains.
|
|
/// </summary>
|
|
string MimeType { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the default file extension for this encoder.
|
|
/// </summary>
|
|
string Extension { get; }
|
|
|
|
/// <summary>
|
|
/// Returns a value indicating whether the <see cref="IImageEncoder"/> supports the specified
|
|
/// file header.
|
|
/// </summary>
|
|
/// <param name="extension">The <see cref="string"/> containing the file extension.</param>
|
|
/// <returns>
|
|
/// <c>True</c> if the decoder supports the file extension; otherwise, <c>false</c>.
|
|
/// </returns>
|
|
bool IsSupportedFileExtension(string extension);
|
|
|
|
/// <summary>
|
|
/// Encodes the image to the specified stream from the <see cref="Image{TColor, TPacked}"/>.
|
|
/// </summary>
|
|
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
|
|
/// <param name="image">The <see cref="Image{TColor, TPacked}"/> to encode from.</param>
|
|
/// <param name="stream">The <see cref="Stream"/> to encode the image data to.</param>
|
|
void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream)
|
|
where TColor : struct, IPackedPixel<TPacked>
|
|
where TPacked : struct;
|
|
}
|
|
}
|
|
|