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.
41 lines
1.1 KiB
41 lines
1.1 KiB
// <copyright file="BmpFormat.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.Collections.Generic;
|
|
|
|
/// <summary>
|
|
/// Encapsulates the means to encode and decode bitmap images.
|
|
/// </summary>
|
|
public class BmpFormat : IImageFormat
|
|
{
|
|
/// <inheritdoc/>
|
|
public string MimeType => "image/bmp";
|
|
|
|
/// <inheritdoc/>
|
|
public string Extension => "bmp";
|
|
|
|
/// <inheritdoc/>
|
|
public IEnumerable<string> SupportedExtensions => new string[] { "bmp", "dip" };
|
|
|
|
/// <inheritdoc/>
|
|
public IImageDecoder Decoder => new BmpDecoder();
|
|
|
|
/// <inheritdoc/>
|
|
public IImageEncoder Encoder => new BmpEncoder();
|
|
|
|
/// <inheritdoc/>
|
|
public int HeaderSize => 2;
|
|
|
|
/// <inheritdoc/>
|
|
public bool IsSupportedFileFormat(byte[] header)
|
|
{
|
|
return header.Length >= this.HeaderSize &&
|
|
header[0] == 0x42 && // B
|
|
header[1] == 0x4D; // M
|
|
}
|
|
}
|
|
}
|
|
|