Example #1
0
 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);
         }
     }
 }
Example #2
0
        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);
                }
            }
        }
Example #3
0
        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);
                    }
                }
            }
        }
Example #5
0
        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);
                    }
            }
        }