AlphaTab.Rendering.Glyphs.ScoreNoteChordGlyph.Paint C# (CSharp) Method

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)
        {
            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);
            }
        }