// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Formats { using System; using System.IO; /// /// Image encoder for writing an image to a stream as a Windows bitmap. /// /// The encoder can currently only write 24-bit rgb images to streams. public class BmpEncoder : IImageEncoder { /// public void Encode(Image image, Stream stream, IEncoderOptions options) where TColor : struct, IPixel { IBmpEncoderOptions bmpOptions = BmpEncoderOptions.Create(options); this.Encode(image, stream, bmpOptions); } /// /// Encodes the image to the specified stream from the . /// /// The pixel format. /// The to encode from. /// The to encode the image data to. /// The options for the encoder. public void Encode(Image image, Stream stream, IBmpEncoderOptions options) where TColor : struct, IPixel { BmpEncoderCore encoder = new BmpEncoderCore(options); encoder.Encode(image, stream); } } }