From 9ac270c6d64be2df9e472f6fd449003997efc5bc Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 19 Feb 2017 14:55:42 +0100 Subject: [PATCH] Added overloads to the decoder that use the coder specific options. --- src/ImageSharp.Formats.Gif/GifDecoder.cs | 15 ++++++++++++++- src/ImageSharp.Formats.Png/PngDecoder.cs | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp.Formats.Gif/GifDecoder.cs b/src/ImageSharp.Formats.Gif/GifDecoder.cs index ce97689e9..88a3d5e43 100644 --- a/src/ImageSharp.Formats.Gif/GifDecoder.cs +++ b/src/ImageSharp.Formats.Gif/GifDecoder.cs @@ -19,7 +19,20 @@ namespace ImageSharp.Formats { IGifDecoderOptions gifOptions = GifDecoderOptions.Create(options); - new GifDecoderCore(gifOptions).Decode(image, stream); + this.Decode(image, stream, gifOptions); + } + + /// + /// Decodes the image from the specified stream to the . + /// + /// The pixel format. + /// The to decode to. + /// The containing image data. + /// The options for the decoder. + public void Decode(Image image, Stream stream, IGifDecoderOptions options) + where TColor : struct, IPackedPixel, IEquatable + { + new GifDecoderCore(options).Decode(image, stream); } } } diff --git a/src/ImageSharp.Formats.Png/PngDecoder.cs b/src/ImageSharp.Formats.Png/PngDecoder.cs index c731ae448..658de9e66 100644 --- a/src/ImageSharp.Formats.Png/PngDecoder.cs +++ b/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); + } + + /// + /// Decodes the image from the specified stream to the . + /// + /// The pixel format. + /// The to decode to. + /// The containing image data. + /// The options for the decoder. + public void Decode(Image image, Stream stream, IPngDecoderOptions options) + where TColor : struct, IPackedPixel, IEquatable + { + new PngDecoderCore(options).Decode(image, stream); } } }