AlphaTab.Rendering.Glyphs.ScoreSlideLineGlyph.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 r = (ScoreBarRenderer)Renderer;
            var sizeX = 12 * Scale;
            var offsetX = 1 * Scale;
            float startX;
            float startY;
            float endX;
            float endY;
            switch (_type)
            {
                case SlideType.Shift:
                case SlideType.Legato:
                    startX = cx + r.GetNoteX(_startNote) + offsetX;
                    startY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight / 2;

                    if (_startNote.SlideTarget != null)
                    {
                        endX = cx + r.GetNoteX(_startNote.SlideTarget, false) - offsetX;
                        endY = cy + r.GetNoteY(_startNote.SlideTarget) + NoteHeadGlyph.NoteHeadHeight / 2;
                    }
                    else
                    {
                        endX = cx + _parent.X;
                        endY = startY;
                    }
                    break;
                case SlideType.IntoFromBelow:
                    endX = cx + r.GetNoteX(_startNote, false) - offsetX;
                    endY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight / 2;

                    startX = endX - sizeX;
                    startY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight;
                    break;
                case SlideType.IntoFromAbove:
                    endX = cx + r.GetNoteX(_startNote, false) - offsetX;
                    endY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight / 2;

                    startX = endX - sizeX;
                    startY = cy + r.GetNoteY(_startNote);
                    break;
                case SlideType.OutUp:
                    startX = cx + r.GetNoteX(_startNote) + offsetX;
                    startY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight / 2;
                    endX = startX + sizeX;
                    endY = cy + r.GetNoteY(_startNote);
                    break;
                case SlideType.OutDown:
                    startX = cx + r.GetNoteX(_startNote) + offsetX;
                    startY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight / 2;
                    endX = startX + sizeX;
                    endY = cy + r.GetNoteY(_startNote) + NoteHeadGlyph.NoteHeadHeight;
                    break;
                default:
                    return;
            }

            canvas.BeginPath();
            canvas.MoveTo(startX, startY);
            canvas.LineTo(endX, endY);
            canvas.Stroke();
        }