public void To32bppArgbSystemDrawingBitmap <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { using (Image <TPixel> image = provider.GetImage()) { using (System.Drawing.Bitmap sdBitmap = SystemDrawingBridge.To32bppArgbSystemDrawingBitmap(image)) { string fileName = provider.Utility.GetTestOutputFileName("png"); sdBitmap.Save(fileName, System.Drawing.Imaging.ImageFormat.Png); } } }
public void From32bppArgbSystemDrawingBitmap <TPixel>(TestImageProvider <TPixel> dummyProvider) where TPixel : unmanaged, IPixel <TPixel> { string path = TestFile.GetInputFileFullPath(TestImages.Png.Splash); using (var sdBitmap = new System.Drawing.Bitmap(path)) { using (Image <TPixel> image = SystemDrawingBridge.From32bppArgbSystemDrawingBitmap <TPixel>(sdBitmap)) { image.DebugSave(dummyProvider); } } }
public void From24bppRgbSystemDrawingBitmap <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { string path = SavePng(provider, PngColorType.Rgb); using (Image <TPixel> original = provider.GetImage()) { using (var sdBitmap = new System.Drawing.Bitmap(path)) { using (Image <TPixel> resaved = SystemDrawingBridge.From24bppRgbSystemDrawingBitmap <TPixel>(sdBitmap)) { ImageComparer comparer = ImageComparer.Exact; comparer.VerifySimilarity(original, resaved); } } } }
public void FromFromRgb24SystemDrawingBitmap2 <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { string path = SavePng(provider, PngColorType.Rgb); using (Image <TPixel> original = provider.GetImage()) { original.Mutate(c => c.MakeOpaque()); using (var sdBitmap = new System.Drawing.Bitmap(path)) { using (Image <TPixel> resaved = SystemDrawingBridge.FromFromRgb24SystemDrawingBitmap <TPixel>(sdBitmap)) { resaved.Mutate(c => c.MakeOpaque()); ImageComparer comparer = ImageComparer.Exact; comparer.VerifySimilarity(original, resaved); } } } }
public void From32bppArgbSystemDrawingBitmap2 <TPixel>(TestImageProvider <TPixel> provider) where TPixel : unmanaged, IPixel <TPixel> { if (TestEnvironment.IsLinux) { return; } string path = SavePng(provider, PngColorType.RgbWithAlpha); using (var sdBitmap = new System.Drawing.Bitmap(path)) { using (Image <TPixel> original = provider.GetImage()) using (Image <TPixel> resaved = SystemDrawingBridge.From32bppArgbSystemDrawingBitmap <TPixel>(sdBitmap)) { ImageComparer comparer = ImageComparer.Exact; comparer.VerifySimilarity(original, resaved); } } }