mirror of https://github.com/SixLabors/ImageSharp
22 changed files with 157 additions and 41 deletions
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:70469b88029e09c8ae5342ffe0fdeaab640d6d5aec8f1e9c2e0c66fdc540ac95 |
||||
|
size 447170 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:66ea88b72f5281872f7745f8a9fc52524c56374134276320e33c7a1289a136b7 |
||||
|
size 450534 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:2caaf6c168c900dbfc1984cf4309032ced4f8c4b8274d2dacfdec8d29fdbd9d5 |
||||
|
size 431023 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:de905f2be709c191fec7fdd659f4f36f65022ebc7286c291d91dab8980e24fb6 |
||||
|
size 458942 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:c91056290a6fca55673c959540ee329de1f501e3943b7cd2c8b31be119f835ae |
||||
|
size 464896 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:f31d0e0e35c19812dfdaecb400e2a3348f8ebd19ae61b6f4310bdab2fdf8ed8c |
||||
|
size 469121 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:ff82fe20b547f5e20c6d4c40266b856a38a94e1ef5e870478fcf9a81221aaa2d |
||||
|
size 429460 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:4f84095fde69319ec1e2b052ad62228e46565b0e3aa99ebcc635f4be9349d8e9 |
||||
|
size 467253 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:a723e94408e446fffc44ce80016fbb463c7014ca90bf352bfe5da425572fbc77 |
||||
|
size 426904 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:f7c190fc65290277ed7805961fc8625b68ca98bbd1445802c104e990901ebcbc |
||||
|
size 432999 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:8bb323798907fe4b0145a64b57d06ea42726b7acbb7f03fdff9b59e0d572941c |
||||
|
size 390539 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:214df91833d4fdf8f0940a62645070093bf00b13fcb3748407526414a9c504bb |
||||
|
size 418080 |
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:78b9122639130418d8589718674b979315dd21d7fe25c07794f9cd8475ac99e0 |
||||
|
size 460956 |
||||
@ -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); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue