public override void Paint(float cx, float cy, ICanvas canvas)
        {
            if (IsEmpty)
            {
                return;
            }
            var textWidth = NoteStringWidth + _trillNoteStringWidth;
            var x         = cx + X + (Width - textWidth) / 2;

            Renderer.ScoreRenderer.Canvas.Font = Renderer.Resources.GraceFont;
            canvas.FillText(_trillNoteString, x + NoteStringWidth + 3 * Scale, cy + Y);

            Renderer.ScoreRenderer.Canvas.Font = Renderer.Resources.TablatureFont;
            canvas.FillText(_noteString, x, cy + Y);

            if (Renderer.Settings.IncludeNoteBounds)
            {
                var noteBounds = new NoteBounds();
                noteBounds.Note           = _note;
                noteBounds.NoteHeadBounds = new Bounds
                {
                    X = cx + X,
                    Y = cy + Y,
                    W = Width,
                    H = Height
                };
                Renderer.ScoreRenderer.BoundsLookup.AddNote(noteBounds);
            }
        }
Exemple #2
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // TODO: this method seems to be quite heavy according to the profiler, why?
            var scoreRenderer = (ScoreBarRenderer)Renderer;

            //
            // Note Effects only painted once
            //
            var effectY = BeamingHelper.Direction == BeamDirection.Up
                            ? scoreRenderer.GetScoreY(MaxNote.Line, 1.5f * NoteHeadGlyph.NoteHeadHeight)
                            : scoreRenderer.GetScoreY(MinNote.Line, -1.0f * NoteHeadGlyph.NoteHeadHeight);
            // TODO: take care of actual glyph height
            var effectSpacing = (BeamingHelper.Direction == BeamDirection.Up)
                            ? 7 * Scale
                            : -7 * Scale;

            foreach (var effectKey in BeatEffects)
            {
                var g = BeatEffects[effectKey];
                g.Y = effectY;
                g.X = Width / 2;
                g.Paint(cx + X, cy + Y, canvas);
                effectY += effectSpacing;
            }

            if (Renderer.Settings.IncludeNoteBounds)
            {
                foreach (var note in _notes)
                {
                    if (_noteGlyphLookup.ContainsKey(note.Id))
                    {
                        var glyph      = _noteGlyphLookup[note.Id];
                        var noteBounds = new NoteBounds();
                        noteBounds.Note           = note;
                        noteBounds.NoteHeadBounds = new Bounds
                        {
                            X = cx + X + glyph.X,
                            Y = cy + Y + glyph.Y,
                            W = glyph.Width,
                            H = glyph.Height
                        };
                        Renderer.ScoreRenderer.BoundsLookup.AddNote(noteBounds);
                    }
                }
            }

            base.Paint(cx, cy, canvas);

            if (_tremoloPicking != null)
            {
                _tremoloPicking.Paint(cx, cy, canvas);
            }
        }