mirror of https://github.com/SixLabors/ImageSharp
7 changed files with 70 additions and 48 deletions
@ -1,24 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
|
|
||||
namespace ImageSharp.Tests.TestUtilities.Integration |
|
||||
{ |
|
||||
using System.IO; |
|
||||
|
|
||||
using ImageSharp.Formats; |
|
||||
using ImageSharp.PixelFormats; |
|
||||
|
|
||||
public class ReferencePngEncoder : IImageEncoder |
|
||||
{ |
|
||||
public static ReferencePngEncoder Instance { get; } = new ReferencePngEncoder(); |
|
||||
|
|
||||
public void Encode<TPixel>(Image<TPixel> image, Stream stream) |
|
||||
where TPixel : struct, IPixel<TPixel> |
|
||||
{ |
|
||||
using (System.Drawing.Bitmap sdBitmap = IntegrationTestUtils.ToSystemDrawingBitmap(image)) |
|
||||
{ |
|
||||
sdBitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,32 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace ImageSharp.Tests.TestUtilities.ReferenceCodecs |
||||
|
{ |
||||
|
using System.Drawing.Imaging; |
||||
|
using System.IO; |
||||
|
|
||||
|
using ImageSharp.Formats; |
||||
|
using ImageSharp.PixelFormats; |
||||
|
|
||||
|
public class ReferenceEncoder : IImageEncoder |
||||
|
{ |
||||
|
private readonly System.Drawing.Imaging.ImageFormat imageFormat; |
||||
|
|
||||
|
public ReferenceEncoder(ImageFormat imageFormat) |
||||
|
{ |
||||
|
this.imageFormat = imageFormat; |
||||
|
} |
||||
|
|
||||
|
public static ReferenceEncoder Png { get; } = new ReferenceEncoder(System.Drawing.Imaging.ImageFormat.Png); |
||||
|
|
||||
|
public void Encode<TPixel>(Image<TPixel> image, Stream stream) |
||||
|
where TPixel : struct, IPixel<TPixel> |
||||
|
{ |
||||
|
using (System.Drawing.Bitmap sdBitmap = SystemDrawingBridge.ToSystemDrawingBitmap(image)) |
||||
|
{ |
||||
|
sdBitmap.Save(stream, this.imageFormat); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue