/// <summary> /// Gets the <see cref="IImageEncoder" /> for the specified format. /// </summary> /// <param name="format">The image format.</param> /// <param name="encoderOptions">The image encoder options.</param> /// <returns>The <see cref="IImageEncoder" />.</returns> private static IImageEncoder GetEncoder(ImageFormat format, ImageEncoderOptions encoderOptions) { switch (format) { case ImageFormat.Bmp: if (encoderOptions == null) { encoderOptions = new BmpEncoderOptions(); } if (!(encoderOptions is BmpEncoderOptions)) { throw new ArgumentException("encoderOptions"); } return(new BmpEncoder((BmpEncoderOptions)encoderOptions)); case ImageFormat.Png: if (encoderOptions == null) { encoderOptions = new PngEncoderOptions(); } if (!(encoderOptions is PngEncoderOptions)) { throw new ArgumentException("encoderOptions"); } return(new PngEncoder((PngEncoderOptions)encoderOptions)); case ImageFormat.Jpeg: throw new NotImplementedException(); default: throw new InvalidOperationException("Image format not supported"); } }
/// <summary> /// Gets the <see cref="IImageEncoder" /> for the specified format. /// </summary> /// <param name="format">The image format.</param> /// <param name="encoderOptions">The image encoder options.</param> /// <returns>The <see cref="IImageEncoder" />.</returns> private static IImageEncoder GetEncoder(ImageFormat format, ImageEncoderOptions encoderOptions) { switch (format) { case ImageFormat.Bmp: if (encoderOptions == null) { encoderOptions = new BmpEncoderOptions(); } if (!(encoderOptions is BmpEncoderOptions)) { throw new ArgumentException("encoderOptions"); } return new BmpEncoder((BmpEncoderOptions)encoderOptions); case ImageFormat.Png: if (encoderOptions == null) { encoderOptions = new PngEncoderOptions(); } if (!(encoderOptions is PngEncoderOptions)) { throw new ArgumentException("encoderOptions"); } return new PngEncoder((PngEncoderOptions)encoderOptions); case ImageFormat.Jpeg: throw new NotImplementedException(); default: throw new InvalidOperationException("Image format not supported"); } }
/// <summary> /// Initializes a new instance of the <see cref="BmpEncoder" /> class. /// </summary> /// <param name="options">The options.</param> public BmpEncoder(BmpEncoderOptions options) { this.options = options; }
/// <summary> /// Initializes a new instance of the <see cref="BmpEncoder" /> class. /// </summary> /// <param name="options">The options.</param> public BmpEncoder(BmpEncoderOptions options) { this.options = options; }