mirror of https://github.com/SixLabors/ImageSharp
committed by
Dirk Lemstra
5 changed files with 103 additions and 20 deletions
@ -0,0 +1,51 @@ |
|||
// <copyright file="BmpEncoderOptions.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Formats |
|||
{ |
|||
/// <summary>
|
|||
/// Encapsulates the options for the <see cref="BmpEncoder"/>.
|
|||
/// </summary>
|
|||
public sealed class BmpEncoderOptions : EncoderOptions, IBmpEncoderOptions |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BmpEncoderOptions"/> class.
|
|||
/// </summary>
|
|||
public BmpEncoderOptions() |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BmpEncoderOptions"/> class.
|
|||
/// </summary>
|
|||
/// <param name="options">The options for the encoder.</param>
|
|||
private BmpEncoderOptions(IEncoderOptions options) |
|||
: base(options) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets or sets the number of bits per pixel.
|
|||
/// </summary>
|
|||
public BmpBitsPerPixel BitsPerPixel { get; set; } = BmpBitsPerPixel.Pixel24; |
|||
|
|||
/// <summary>
|
|||
/// Converts the options to a <see cref="BmpEncoderOptions"/> instance with a cast
|
|||
/// or by creating a new instance with the specfied options.
|
|||
/// </summary>
|
|||
/// <param name="options">The options for the encoder.</param>
|
|||
/// <returns>The options for the <see cref="BmpEncoder"/>.</returns>
|
|||
internal static IBmpEncoderOptions Create(IEncoderOptions options) |
|||
{ |
|||
IBmpEncoderOptions bmpOptions = options as IBmpEncoderOptions; |
|||
if (bmpOptions != null) |
|||
{ |
|||
return bmpOptions; |
|||
} |
|||
|
|||
return new BmpEncoderOptions(options); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
// <copyright file="IBmpEncoderOptions.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Formats |
|||
{ |
|||
/// <summary>
|
|||
/// Encapsulates the options for the <see cref="BmpEncoder"/>.
|
|||
/// </summary>
|
|||
public interface IBmpEncoderOptions : IEncoderOptions |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the number of bits per pixel.
|
|||
/// </summary>
|
|||
BmpBitsPerPixel BitsPerPixel { get; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue