static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage AlphaTab.ScoreDump.exe Path");
                return;
            }

            // load score
            Score score = ScoreLoader.loadScore(args[0]);

            // render score with svg engine
            Settings settings = Settings.defaults();

            settings.engine = "gdi";
            ScoreRenderer renderer = new ScoreRenderer(settings, null);

            // iterate tracks
            for (int i = 0; i < score.tracks.length; i++)
            {
                Track track = (Track)score.tracks[i];

                // render track
                Console.WriteLine("Rendering track {0} - {1}", i + 1, track.name);
                renderer.render(track);

                // write png
                FileInfo info = new FileInfo(args[0]);
                string   path = Path.Combine(info.DirectoryName, Path.GetFileNameWithoutExtension(info.Name) + "-" + i + ".png");
                using (Bitmap bmp = ((GdiCanvas)renderer.canvas).getImage())
                {
                    bmp.Save(path, ImageFormat.Png);
                }
            }
        }
 public void InvalidateTrack()
 {
     if (Track == null)
     {
         return;
     }
     _renderer.render(Track);
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage AlphaTab.ScoreDump.exe Path");
                return;
            }

            // we need to use english culture to have correct string variants of floating points (dot as decimal separator)
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-us");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");

            // load score
            Score score = ScoreLoader.loadScore(args[0]);

            // render score with svg engine
            Settings settings = Settings.defaults();

            settings.engine = "svg";
            ScoreRenderer renderer = new ScoreRenderer(settings, null);

            // get iterate tracks
            for (int i = 0; i < score.tracks.length; i++)
            {
                Track track = (Track)score.tracks[i];
                // render track
                Console.WriteLine("Rendering track {0} - {1}", i + 1, track.name);
                renderer.render(track);

                // write svg file
                string   svg  = ((SvgCanvas)renderer.canvas).toSvg(true, "alphaTab");
                FileInfo info = new FileInfo(args[0]);
                string   path = Path.Combine(info.DirectoryName, Path.GetFileNameWithoutExtension(info.Name) + "-" + i + ".svg");
                File.WriteAllText(path, svg);
            }
        }