|
After Width: | Height: | Size: 437 KiB |
|
After Width: | Height: | Size: 440 KiB |
|
After Width: | Height: | Size: 421 KiB |
|
After Width: | Height: | Size: 448 KiB |
|
After Width: | Height: | Size: 454 KiB |
|
After Width: | Height: | Size: 458 KiB |
|
After Width: | Height: | Size: 419 KiB |
|
After Width: | Height: | Size: 456 KiB |
|
After Width: | Height: | Size: 417 KiB |
|
After Width: | Height: | Size: 423 KiB |
|
After Width: | Height: | Size: 381 KiB |
|
After Width: | Height: | Size: 408 KiB |
|
After Width: | Height: | Size: 450 KiB |
@ -0,0 +1,40 @@ |
|||
namespace ImageSharp.Tests.TestUtilities.Integration |
|||
{ |
|||
using System; |
|||
using System.Drawing; |
|||
using System.IO; |
|||
|
|||
using ImageSharp.Formats; |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
public class ReferenceDecoder : IImageDecoder |
|||
{ |
|||
public static ReferenceDecoder Instance { get; } = new ReferenceDecoder(); |
|||
|
|||
public Image<TPixel> Decode<TPixel>(Configuration configuration, Stream stream, IDecoderOptions options) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (var sourceBitmap = new System.Drawing.Bitmap(stream)) |
|||
{ |
|||
if (sourceBitmap.PixelFormat == System.Drawing.Imaging.PixelFormat.Format32bppArgb) |
|||
{ |
|||
return IntegrationTestUtils.FromSystemDrawingBitmap<TPixel>(sourceBitmap); |
|||
} |
|||
|
|||
using (var convertedBitmap = new System.Drawing.Bitmap( |
|||
sourceBitmap.Width, |
|||
sourceBitmap.Height, |
|||
System.Drawing.Imaging.PixelFormat.Format32bppArgb)) |
|||
{ |
|||
using (var g = Graphics.FromImage(convertedBitmap)) |
|||
{ |
|||
g.DrawImage(sourceBitmap, new PointF(0, 0)); |
|||
} |
|||
return IntegrationTestUtils.FromSystemDrawingBitmap<TPixel>(convertedBitmap); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
namespace ImageSharp.Tests.TestUtilities.Integration |
|||
{ |
|||
using System; |
|||
using System.IO; |
|||
|
|||
using ImageSharp.Formats; |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
public class ReferencePngDecoder : IImageDecoder |
|||
{ |
|||
public static ReferencePngDecoder Instance { get; } = new ReferencePngDecoder(); |
|||
|
|||
public Image<TPixel> Decode<TPixel>(Configuration configuration, Stream stream, IDecoderOptions options) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
using (var sdBitmap = new System.Drawing.Bitmap(stream)) |
|||
{ |
|||
if (!sdBitmap.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png)) |
|||
{ |
|||
throw new Exception("Reference image should be a Png!"); |
|||
} |
|||
if (sdBitmap.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb) |
|||
{ |
|||
throw new Exception("Reference image pixel format should be PixelFormat.Format32bppArgb!"); |
|||
} |
|||
|
|||
return IntegrationTestUtils.FromSystemDrawingBitmap<TPixel>(sdBitmap); |
|||
} |
|||
} |
|||
} |
|||
} |
|||