Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
 public AlphaTabCanvas()
 {
     var settings = Settings.defaults();
     settings.engine = "wpf";
     Settings = settings;
     _renderer = new ScoreRenderer(settings, this);
     _renderer.addRenderFinishedListener(new ActionFunction(OnRenderFinished));
 }
Beispiel #4
0
        public AlphaTabControl()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.ContainerControl, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);

            var settings = Settings.defaults();
            settings.engine = "gdi";
            Settings = settings;
            _renderer = new ScoreRenderer(settings, this);
            _renderer.addRenderFinishedListener(new ActionFunction(OnRenderFinished));
        }