Ejemplo n.º 1
0
        public void ProgressiveDecodeBackground_Theory(string file, long length)
        {
            using (FileStream fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (IDjvuReader reader = new DjvuReader(fs))
                {
                    BG44Chunk unk = new BG44Chunk(reader, null, null, "BG44", length);
                    unk.Initialize();
                    var map    = new InterWavePixelMapDecoder();
                    var result = unk.ProgressiveDecodeBackground(map);
                    Assert.Same(result, map);
#if !_APPVEYOR
                    string dumpsDir = Path.Combine(Util.ArtifactsDataPath, "dumps");
                    if (!System.IO.Directory.Exists(dumpsDir))
                    {
                        System.IO.Directory.CreateDirectory(dumpsDir);
                    }
                    using (System.Drawing.Bitmap image = map.GetPixelMap().ToImage())
                    {
                        string fileName = Path.GetFileNameWithoutExtension(file);
                        string outFile  = Path.Combine(dumpsDir, fileName + "_bg44.png");
                        using (FileStream stream = new FileStream(outFile, FileMode.Create))
                            image.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                    }
#endif
                }
        }