This glyph allows to group several other glyphs to be drawn at the same x position
Inheritance: Glyph
コード例 #1
0
        private void CreateBeatDot(int line, float offset, GlyphGroup group)
        {
            var sr = (ScoreBarRenderer)Renderer;

            group.AddGlyph(new CircleGlyph(0, sr.GetScoreY(line, offset + 2), 1.5f * Scale));
        }
コード例 #2
0
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;

            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads               = new ScoreNoteChordGlyph();
                    NoteHeads.Beat          = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;
                    NoteLoop(CreateNoteGlyph);
                    AddGlyph(NoteHeads);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale, false));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            NoteLoop(n => CreateBeatDot(sr.GetNoteLine(n), 2, group));
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine   = 0;
                    var line      = 0;
                    var offset    = 0;
                    var dotOffset = 0;

                    switch (Container.Beat.Duration)
                    {
                    case Duration.Whole:
                        line    = 4;
                        dotLine = 4;
                        break;

                    case Duration.Half:
                        line    = 5;
                        dotLine = 5;
                        break;

                    case Duration.Quarter:
                        line      = 7;
                        offset    = -2;
                        dotLine   = 4;
                        dotOffset = 3;
                        break;

                    case Duration.Eighth:
                        line      = 8;
                        dotLine   = 4;
                        dotOffset = 3;
                        break;

                    case Duration.Sixteenth:
                        line      = 10;
                        dotLine   = 4;
                        dotOffset = 3;
                        break;

                    case Duration.ThirtySecond:
                        line      = 10;
                        dotLine   = 2;
                        dotOffset = 2;
                        break;

                    case Duration.SixtyFourth:
                        line      = 12;
                        dotLine   = 2;
                        dotOffset = 2;
                        break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    AddGlyph(new RestGlyph(0, y, Container.Beat.Duration));

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale, false));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, dotOffset, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();
            if (NoteHeads != null)
            {
                NoteHeads.UpdateBeamingHelper(X);
            }
        }
コード例 #3
0
ファイル: ScoreBeatGlyph.cs プロジェクト: CoderLine/alphaTab
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;
            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads = new ScoreNoteChordGlyph();
                    NoteHeads.Beat = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;
                    foreach (var note in Container.Beat.Notes)
                    {
                        CreateNoteGlyph(note);
                    }
                    AddGlyph(NoteHeads);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            foreach (var note in Container.Beat.Notes)
                            {
                                CreateBeatDot(sr.GetNoteLine(note), group);
                            }
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine = 0;
                    var line = 0;
                    var offset = 0;

                    switch (Container.Beat.Duration)
                    {
                        case Duration.QuadrupleWhole:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.DoubleWhole:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.Whole:
                            line = 4;
                            dotLine = 5;
                            break;
                        case Duration.Half:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.Quarter:
                            line = 6;
                            offset = -2;
                            dotLine = 5;
                            break;
                        case Duration.Eighth:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.Sixteenth:
                            line = 6;
                            dotLine = 5;
                            break;
                        case Duration.ThirtySecond:
                            line = 6;
                            dotLine = 3;
                            break;
                        case Duration.SixtyFourth:
                            line = 6;
                            dotLine = 3;
                            break;
                        case Duration.OneHundredTwentyEighth:
                            line = 6;
                            dotLine = 3;
                            break;
                        case Duration.TwoHundredFiftySixth:
                            line = 6;
                            dotLine = 3;
                            break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    RestGlyph = new ScoreRestGlyph(0, y, Container.Beat.Duration);
                    RestGlyph.Beat = Container.Beat;
                    RestGlyph.BeamingHelper = BeamingHelper;
                    AddGlyph(RestGlyph);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();
        }
コード例 #4
0
ファイル: ScoreBeatGlyph.cs プロジェクト: CoderLine/alphaTab
 private void CreateBeatDot(int line, GlyphGroup group)
 {
     var sr = (ScoreBarRenderer)Renderer;
     group.AddGlyph(new CircleGlyph(0, sr.GetScoreY(line), 1.5f * Scale));
 }
コード例 #5
0
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;

            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads               = new ScoreNoteChordGlyph();
                    NoteHeads.Beat          = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;

                    var ghost = new GhostNoteContainerGlyph(false);
                    ghost.Renderer = Renderer;

                    foreach (var note in Container.Beat.Notes)
                    {
                        if (note.IsVisible)
                        {
                            CreateNoteGlyph(note);
                            ghost.AddParenthesis(note);
                        }
                    }
                    AddGlyph(NoteHeads);

                    if (!ghost.IsEmpty)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 4 * (Container.Beat.GraceType != GraceType.None ? NoteHeadGlyph.GraceScale : 1) * Scale));
                        AddGlyph(ghost);
                    }

                    //
                    // Whammy Bar
                    if (Container.Beat.HasWhammyBar)
                    {
                        var whammy = new ScoreWhammyBarGlyph(Container.Beat);
                        whammy.Renderer = Renderer;
                        whammy.DoLayout();

                        Container.Ties.Add(whammy);
                    }

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            foreach (var note in Container.Beat.Notes)
                            {
                                CreateBeatDot(sr.GetNoteLine(note), group);
                            }
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine = 0;
                    var line    = 0;
                    var offset  = 0;

                    switch (Container.Beat.Duration)
                    {
                    case Duration.QuadrupleWhole:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.DoubleWhole:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.Whole:
                        line    = 4;
                        dotLine = 5;
                        break;

                    case Duration.Half:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.Quarter:
                        line    = 6;
                        offset  = -2;
                        dotLine = 5;
                        break;

                    case Duration.Eighth:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.Sixteenth:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.ThirtySecond:
                        line    = 6;
                        dotLine = 3;
                        break;

                    case Duration.SixtyFourth:
                        line    = 6;
                        dotLine = 3;
                        break;

                    case Duration.OneHundredTwentyEighth:
                        line    = 6;
                        dotLine = 3;
                        break;

                    case Duration.TwoHundredFiftySixth:
                        line    = 6;
                        dotLine = 3;
                        break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    RestGlyph               = new ScoreRestGlyph(0, y, Container.Beat.Duration);
                    RestGlyph.Beat          = Container.Beat;
                    RestGlyph.BeamingHelper = BeamingHelper;
                    AddGlyph(RestGlyph);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();

            if (Container.Beat.IsEmpty)
            {
                CenterX = Width / 2;
            }
            else if (Container.Beat.IsRest)
            {
                CenterX = RestGlyph.X + RestGlyph.Width / 2;
            }
            else
            {
                CenterX = NoteHeads.X + NoteHeads.Width / 2;
            }
        }
コード例 #6
0
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;

            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads               = new ScoreNoteChordGlyph();
                    NoteHeads.Beat          = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;
                    foreach (var note in Container.Beat.Notes)
                    {
                        CreateNoteGlyph(note);
                    }
                    AddGlyph(NoteHeads);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            foreach (var note in Container.Beat.Notes)
                            {
                                CreateBeatDot(sr.GetNoteLine(note), group);
                            }
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine = 0;
                    var line    = 0;
                    var offset  = 0;

                    switch (Container.Beat.Duration)
                    {
                    case Duration.QuadrupleWhole:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.DoubleWhole:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.Whole:
                        line    = 4;
                        dotLine = 5;
                        break;

                    case Duration.Half:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.Quarter:
                        line    = 6;
                        offset  = -2;
                        dotLine = 5;
                        break;

                    case Duration.Eighth:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.Sixteenth:
                        line    = 6;
                        dotLine = 5;
                        break;

                    case Duration.ThirtySecond:
                        line    = 6;
                        dotLine = 3;
                        break;

                    case Duration.SixtyFourth:
                        line    = 6;
                        dotLine = 3;
                        break;

                    case Duration.OneHundredTwentyEighth:
                        line    = 6;
                        dotLine = 3;
                        break;

                    case Duration.TwoHundredFiftySixth:
                        line    = 6;
                        dotLine = 3;
                        break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    RestGlyph               = new ScoreRestGlyph(0, y, Container.Beat.Duration);
                    RestGlyph.Beat          = Container.Beat;
                    RestGlyph.BeamingHelper = BeamingHelper;
                    AddGlyph(RestGlyph);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();
        }
コード例 #7
0
ファイル: ScoreBeatGlyph.cs プロジェクト: eriser/alphaTab
        public override void DoLayout()
        {
            // create glyphs
            var sr = (ScoreBarRenderer)Renderer;
            if (!Container.Beat.IsEmpty)
            {
                if (!Container.Beat.IsRest)
                {
                    //
                    // Note heads
                    //
                    NoteHeads = new ScoreNoteChordGlyph();
                    NoteHeads.Beat = Container.Beat;
                    NoteHeads.BeamingHelper = BeamingHelper;
                    NoteLoop(CreateNoteGlyph);
                    AddGlyph(NoteHeads);

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale, false));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            NoteLoop(n => CreateBeatDot(sr.GetNoteLine(n), 2, group));
                            AddGlyph(group);
                        }
                    }
                }
                else
                {
                    var dotLine = 0;
                    var line = 0;
                    var offset = 0;
                    var dotOffset = 0;

                    switch (Container.Beat.Duration)
                    {
                        case Duration.Whole:
                            line = 4;
                            dotLine = 4;
                            break;
                        case Duration.Half:
                            line = 5;
                            dotLine = 5;
                            break;
                        case Duration.Quarter:
                            line = 7;
                            offset = -2;
                            dotLine = 4;
                            dotOffset = 3;
                            break;
                        case Duration.Eighth:
                            line = 8;
                            dotLine = 4;
                            dotOffset = 3;
                            break;
                        case Duration.Sixteenth:
                            line = 10;
                            dotLine = 4;
                            dotOffset = 3;
                            break;
                        case Duration.ThirtySecond:
                            line = 10;
                            dotLine = 2;
                            dotOffset = 2;
                            break;
                        case Duration.SixtyFourth:
                            line = 12;
                            dotLine = 2;
                            dotOffset = 2;
                            break;
                    }

                    var y = sr.GetScoreY(line, offset);

                    AddGlyph(new RestGlyph(0, y, Container.Beat.Duration));

                    //
                    // Note dots
                    //
                    if (Container.Beat.Dots > 0)
                    {
                        AddGlyph(new SpacingGlyph(0, 0, 5 * Scale, false));
                        for (var i = 0; i < Container.Beat.Dots; i++)
                        {
                            var group = new GlyphGroup(0, 0);
                            CreateBeatDot(dotLine, dotOffset, group);
                            AddGlyph(group);
                        }
                    }
                }
            }

            base.DoLayout();
            if (NoteHeads != null)
            {
                NoteHeads.UpdateBeamingHelper(X);
            }
        }