Paint() public method

public Paint ( float cx, float cy, ICanvas canvas ) : void
cx float
cy float
canvas ICanvas
return void
        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;
            }

            base.Paint(cx, cy, canvas);

            if (_tremoloPicking != null)
            {
                _tremoloPicking.Paint(cx, cy, canvas);
            }
        }
Example #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);
            }
        }
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            cx += X;
            cy += Y;
            // 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, cy, canvas);
                effectY += effectSpacing;
            }


            // TODO: Take care of beateffects in overflow

            var linePadding = 3 * Scale;
            var lineWidth   = Width + linePadding * 2;

            if (HasTopOverflow)
            {
                var color = canvas.Color;
                canvas.Color = Renderer.ScoreRenderer.RenderingResources.StaveLineColor;
                var l = -1;
                while (l >= MinNote.Line)
                {
                    // + 1 Because we want to place the line in the center of the note, not at the top
                    var lY = cy + scoreRenderer.GetScoreY(l);
                    canvas.FillRect(cx - linePadding, lY, lineWidth, Scale);
                    l -= 2;
                }
                canvas.Color = color;
            }

            if (HasBottomOverflow)
            {
                var color = canvas.Color;
                canvas.Color = Renderer.ScoreRenderer.RenderingResources.StaveLineColor;
                var l = 12;
                while (l <= MaxNote.Line)
                {
                    var lY = cy + scoreRenderer.GetScoreY(l);
                    canvas.FillRect(cx - linePadding, lY, lineWidth, Scale);
                    l += 2;
                }
                canvas.Color = color;
            }

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

            var infos = _infos;
            var x     = cx + _noteHeadPadding;

            foreach (var g in infos)
            {
                g.Glyph.Renderer = Renderer;
                g.Glyph.Paint(x, cy, canvas);
            }
        }
Example #4
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            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;
            }

            canvas.Color = Renderer.Layout.Renderer.RenderingResources.StaveLineColor;

            // TODO: Take care of beateffects in overflow

            var linePadding = 3 * Scale;

            if (HasTopOverflow)
            {
                var l = -1;
                while (l >= MinNote.Line)
                {
                    // + 1 Because we want to place the line in the center of the note, not at the top
                    var lY = cy + Y + scoreRenderer.GetScoreY(l);
                    canvas.BeginPath();
                    canvas.MoveTo(cx + X - linePadding, lY);
                    canvas.LineTo(cx + X + Width + linePadding, lY);
                    canvas.Stroke();
                    l -= 2;
                }
            }

            if (HasBottomOverflow)
            {
                var l = 12;
                while (l <= MaxNote.Line)
                {
                    var lY = cy + Y + scoreRenderer.GetScoreY(l);
                    canvas.BeginPath();
                    canvas.MoveTo(cx + X - linePadding, lY);
                    canvas.LineTo(cx + X + Width + linePadding, lY);
                    canvas.Stroke();
                    l += 2;
                }
            }

            canvas.Color = Beat.Voice.Index == 0
                ? Renderer.Layout.Renderer.RenderingResources.MainGlyphColor
                : Renderer.Layout.Renderer.RenderingResources.SecondaryGlyphColor;

            if (_tremoloPicking != null)
            {
                _tremoloPicking.Paint(cx + X, cy + Y, canvas);
            }
            for (int i = 0, j = _infos.Count; i < j; i++)
            {
                var g = _infos[i];
                g.Glyph.Renderer = Renderer;
                g.Glyph.Paint(cx + X + _noteHeadPadding, cy + Y, canvas);
            }
        }