Browse Source

Added overloads to the decoder that use the coder specific options.

af/merge-core
Dirk Lemstra 9 years ago
committed by Dirk Lemstra
parent
commit
9ac270c6d6
  1. 15
      src/ImageSharp.Formats.Gif/GifDecoder.cs
  2. 15
      src/ImageSharp.Formats.Png/PngDecoder.cs

15
src/ImageSharp.Formats.Gif/GifDecoder.cs

@ -19,7 +19,20 @@ namespace ImageSharp.Formats
{
IGifDecoderOptions gifOptions = GifDecoderOptions.Create(options);
new GifDecoderCore<TColor>(gifOptions).Decode(image, stream);
this.Decode(image, stream, gifOptions);
}
/// <summary>
/// Decodes the image from the specified stream to the <see cref="ImageBase{TColor}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="image">The <see cref="ImageBase{TColor}"/> to decode to.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <param name="options">The options for the decoder.</param>
public void Decode<TColor>(Image<TColor> image, Stream stream, IGifDecoderOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
new GifDecoderCore<TColor>(options).Decode(image, stream);
}
}
}

15
src/ImageSharp.Formats.Png/PngDecoder.cs

@ -36,7 +36,20 @@ namespace ImageSharp.Formats
{
IPngDecoderOptions pngOptions = PngDecoderOptions.Create(options);
new PngDecoderCore(pngOptions).Decode(image, stream);
this.Decode(image, stream, pngOptions);
}
/// <summary>
/// Decodes the image from the specified stream to the <see cref="ImageBase{TColor}"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <param name="image">The <see cref="ImageBase{TColor}"/> to decode to.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <param name="options">The options for the decoder.</param>
public void Decode<TColor>(Image<TColor> image, Stream stream, IPngDecoderOptions options)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
new PngDecoderCore(options).Decode(image, stream);
}
}
}

Loading…
Cancel
Save