|
|
@ -14,34 +14,11 @@ namespace ImageSharp.Formats |
|
|
/// <remarks>The encoder can currently only write 24-bit rgb images to streams.</remarks>
|
|
|
/// <remarks>The encoder can currently only write 24-bit rgb images to streams.</remarks>
|
|
|
public class BmpEncoder : IImageEncoder |
|
|
public class BmpEncoder : IImageEncoder |
|
|
{ |
|
|
{ |
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets the quality of output for images.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>Bitmap is a lossless format so this is not used in this encoder.</remarks>
|
|
|
|
|
|
public int Quality { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string MimeType => "image/bmp"; |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public string Extension => "bmp"; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Gets or sets the number of bits per pixel.
|
|
|
/// Gets or sets the number of bits per pixel.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public BmpBitsPerPixel BitsPerPixel { get; set; } = BmpBitsPerPixel.Pixel24; |
|
|
public BmpBitsPerPixel BitsPerPixel { get; set; } = BmpBitsPerPixel.Pixel24; |
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public bool IsSupportedFileExtension(string extension) |
|
|
|
|
|
{ |
|
|
|
|
|
Guard.NotNullOrEmpty(extension, nameof(extension)); |
|
|
|
|
|
|
|
|
|
|
|
extension = extension.StartsWith(".") ? extension.Substring(1) : extension; |
|
|
|
|
|
|
|
|
|
|
|
return extension.Equals(this.Extension, StringComparison.OrdinalIgnoreCase) |
|
|
|
|
|
|| extension.Equals("dip", StringComparison.OrdinalIgnoreCase); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
/// <inheritdoc/>
|
|
|
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream) |
|
|
public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream) |
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
where TColor : struct, IPackedPixel<TPacked> |
|
|
|