Exemplo n.º 1
0
        protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
        {
            PaintNonGrouped(cx, cy, canvas);

            var lineSpacing = LineSpacing * Scale;
            var textWidth = canvas.MeasureText(_label);
            var startX = cx + X + textWidth + lineSpacing;
            var lineY = cy + Y + (LineTopPadding * Scale);
            var lineSize = LineSize * Scale;

            if (endX > startX)
            {
                var lineX = startX;
                while (lineX < endX)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(lineX, (int)lineY);
                    canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                    lineX += lineSize + lineSpacing;
                    canvas.Stroke();
                }
                canvas.BeginPath();
                canvas.MoveTo(endX, (int)(lineY - LineTopOffset * Scale));
                canvas.LineTo(endX, (int)(lineY + LineTopOffset * Scale));
                canvas.Stroke();
            }
        }
Exemplo n.º 2
0
        protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
        {
            PaintNonGrouped(cx, cy, canvas);

            var lineSpacing = LineSpacing * Scale;
            var textWidth   = canvas.MeasureText(_label);
            var startX      = cx + X + textWidth + lineSpacing;
            var lineY       = cy + Y + (LineTopPadding * Scale);
            var lineSize    = LineSize * Scale;

            if (endX > startX)
            {
                var lineX = startX;
                while (lineX < endX)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(lineX, (int)lineY);
                    canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                    lineX += lineSize + lineSpacing;
                    canvas.Stroke();
                }
                canvas.BeginPath();
                canvas.MoveTo(endX, (int)(lineY - LineTopOffset * Scale));
                canvas.LineTo(endX, (int)(lineY + LineTopOffset * Scale));
                canvas.Stroke();
            }
        }
Exemplo n.º 3
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var scoreBarRenderer = (ScoreBarRenderer)Renderer;
            var lineSize         = scoreBarRenderer.LineOffset;
            var topY             = cy + Y + scoreBarRenderer.GetNoteY(_beat.MaxNote);
            var bottomY          = cy + Y + scoreBarRenderer.GetNoteY(_beat.MinNote) + lineSize;
            var arrowX           = cx + X + Width / 2;
            var arrowSize        = 8 * Scale;

            if (_beat.BrushType == BrushType.ArpeggioUp || _beat.BrushType == BrushType.ArpeggioDown)
            {
                var size       = 14 * Scale;
                var waveTop    = topY;
                var waveBottom = bottomY;

                if (_beat.BrushType == BrushType.ArpeggioUp)
                {
                    waveTop    -= lineSize;
                    waveBottom -= arrowSize;
                    var steps = Math.Floor((waveBottom - waveTop) / size);
                    for (var i = 0; i < steps; i++)
                    {
                        canvas.FillMusicFontSymbol(cx + X + (2 * Scale), waveBottom - ((i + 1) * size), 1, MusicFontSymbol.WaveVertical);
                    }
                }
                else
                {
                    waveTop    += arrowSize;
                    waveBottom += lineSize;
                    var steps = Math.Floor((waveBottom - waveTop) / size);
                    for (var i = 0; i < steps; i++)
                    {
                        canvas.FillMusicFontSymbol(cx + X + (2 * Scale), waveTop + (i * size), 1, MusicFontSymbol.WaveVertical);
                    }
                }

                if (_beat.BrushType == BrushType.ArpeggioUp)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, bottomY);
                    canvas.LineTo(arrowX + arrowSize / 2, bottomY - arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, bottomY - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else if (_beat.BrushType == BrushType.ArpeggioDown)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, topY);
                    canvas.LineTo(arrowX + arrowSize / 2, topY + arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, topY + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
            }
        }
Exemplo n.º 4
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            //TODO: Create webfont version

            var scoreBarRenderer = (ScoreBarRenderer)Renderer;
            var lineSize         = scoreBarRenderer.LineOffset;
            var startY           = cy + Y + (scoreBarRenderer.GetNoteY(_beat.MaxNote) - lineSize);
            var endY             = cy + Y + scoreBarRenderer.GetNoteY(_beat.MinNote) + lineSize;
            var arrowX           = cx + X + Width / 2;
            var arrowSize        = 8 * Scale;

            if (_beat.BrushType != BrushType.None)
            {
                if (_beat.BrushType == BrushType.ArpeggioUp)
                {
                    var lineStartY = startY - arrowSize;
                    var lineEndY   = endY - arrowSize;

                    canvas.BeginRotate(cx + X + 2 * Scale, lineEndY, -90);
                    var glyph = new NoteVibratoGlyph(0, 0, VibratoType.Slight);
                    glyph.Renderer = Renderer;
                    glyph.DoLayout();
                    glyph.Width = Math.Abs(lineEndY - lineStartY);
                    glyph.Paint(0, 0, canvas);
                    canvas.EndRotate();

                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, endY);
                    canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else if (_beat.BrushType == BrushType.ArpeggioDown)
                {
                    var lineStartY = startY + arrowSize;
                    var lineEndY   = endY + arrowSize;

                    canvas.BeginRotate(cx + X + 7 * Scale, lineStartY, 90);
                    var glyph = new NoteVibratoGlyph(0, 0, VibratoType.Slight);
                    glyph.Renderer = Renderer;
                    glyph.DoLayout();
                    glyph.Width = Math.Abs(lineEndY - lineStartY);
                    glyph.Paint(0, 0, canvas);
                    canvas.EndRotate();

                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
            }
        }
Exemplo n.º 5
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // TODO: Create webfont version

            var tabBarRenderer = (TabBarRenderer)Renderer;
            var res            = Renderer.Resources;
            var startY         = cy + X + (tabBarRenderer.GetNoteY(_beat.MaxNote) - res.TablatureFont.Size / 2);
            var endY           = cy + Y + tabBarRenderer.GetNoteY(_beat.MinNote) + res.TablatureFont.Size / 2;
            var arrowX         = (int)(cx + X + Width / 2);
            var arrowSize      = 8 * Scale;

            if (_beat.BrushType != BrushType.None)
            {
                if (_beat.BrushType == BrushType.BrushUp || _beat.BrushType == BrushType.BrushDown)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX, endY);
                    canvas.Stroke();
                }
                else
                {
                    //var size = 15 * Scale;
                    //var steps = Math.Abs(endY - startY) / size;
                    //for (var i = 0; i < steps; i++)
                    //{
                    //    canvas.FillMusicFontSymbol(cx + X + (3 * Scale), 1, startY + (i * size), MusicFontSymbol.WaveVertical);
                    //}
                }

                if (_beat.BrushType == BrushType.BrushUp || _beat.BrushType == BrushType.ArpeggioUp)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, endY);
                    canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
            }
        }
Exemplo n.º 6
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var tabBarRenderer = (TabBarRenderer)Renderer;
            var res = Renderer.Resources;
            var startY = cy + X + (tabBarRenderer.GetNoteY(_beat.MaxNote) - res.TablatureFont.Size / 2);
            var endY = cy + Y + tabBarRenderer.GetNoteY(_beat.MinNote) + res.TablatureFont.Size / 2;
            var arrowX = (int)(cx + X + Width / 2);
            var arrowSize = 8 * Scale;

            if (_beat.BrushType != BrushType.None)
            {
                if (_beat.BrushType == BrushType.BrushUp || _beat.BrushType == BrushType.BrushDown)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX, endY);
                    canvas.Stroke();
                }
                else
                {
                    var size = 15 * Scale;
                    var steps = Math.Abs(endY - startY) / size;
                    for (var i = 0; i < steps; i++)
                    {
                        canvas.FillMusicFontSymbol(cx + X + (3 * Scale), 1, startY + (i * size), MusicFontSymbol.WaveVertical);
                    }
                }

                if (_beat.BrushType == BrushType.BrushUp || _beat.BrushType == BrushType.ArpeggioUp)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, endY);
                    canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
            }
        }
Exemplo n.º 7
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var blockWidth = 4 * Scale;

            var top    = cy + Y + Renderer.TopPadding;
            var bottom = cy + Y + Renderer.Height - Renderer.BottomPadding;
            var left   = cx + X + 0.5f;
            // big bar
            var h = bottom - top;

            canvas.FillRect(left, top, blockWidth, h);

            // line
            left += (blockWidth * 2) - 0.5f;
            canvas.BeginPath();
            canvas.MoveTo(left, top);
            canvas.LineTo(left, bottom);
            canvas.Stroke();

            //circles
            left += 3 * Scale;

            var circleSize = _circleSize * Scale;
            var middle     = (top + bottom) / 2;

            canvas.FillCircle(left, middle - (circleSize * _dotOffset), circleSize);
            canvas.FillCircle(left, middle + (circleSize * _dotOffset), circleSize);
        }
Exemplo n.º 8
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // calculate offsets per step
            var dX = Width / BendPoint.MaxPosition;
            var maxValue = 0;
            for (int i = 0, j = _note.BendPoints.Count; i < j; i++)
            {
                if (_note.BendPoints[i].Value > maxValue)
                {
                    maxValue = _note.BendPoints[i].Value;
                }
            }

            cx += X;
            cy += Y;

            canvas.BeginPath();
            for (int i = 0, j = _note.BendPoints.Count - 1; i < j; i++)
            {
                var firstPt = _note.BendPoints[i];
                var secondPt = _note.BendPoints[i + 1];

                // draw pre-bend if previous
                if (i == 0 && firstPt.Value != 0 && !_note.IsTieDestination)
                {
                    PaintBend(new BendPoint(), firstPt, cx, cy, dX, canvas);
                }

                // don't draw a line if there's no offset and it's the last point
                if (firstPt.Value == secondPt.Value && i == _note.BendPoints.Count - 2) continue;

                PaintBend(firstPt, secondPt,  cx, cy, dX, canvas);
            }
        }
Exemplo n.º 9
0
        //private static readonly Random Random = new Random();
        protected override void PaintBackground(float cx, float cy, ICanvas canvas)
        {
            var res = Resources;

            //var c = new Color((byte)Random.Next(255),
            //                  (byte)Random.Next(255),
            //                  (byte)Random.Next(255),
            //                  100);
            //canvas.Color = c;
            //canvas.FillRect(cx + X, cy + Y, Width, Height);

            //
            // draw string lines
            //
            canvas.Color = res.StaveLineColor;
            var lineY = cy + Y + GlyphOverflow;

            for (var i = 0; i < 5; i++)
            {
                if (i > 0)
                {
                    lineY += LineOffset;
                }
                canvas.BeginPath();
                canvas.MoveTo(cx + X, (int)lineY);
                canvas.LineTo(cx + X + Width, (int)lineY);
                canvas.Stroke();
            }

            canvas.Color = res.MainGlyphColor;
        }
Exemplo n.º 10
0
        private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            var beat = h.Beats[0];

            if (beat.Duration == Duration.Whole)
            {
                return;
            }

            //
            // draw line
            //

            var beatLineX = h.GetBeatLineX(beat) + Scale;

            const float topY    = 0;
            var         bottomY = Height;

            float beamY = _direction == BeamDirection.Down ? bottomY : topY;

            canvas.BeginPath();
            canvas.MoveTo(cx + X + beatLineX, cy + Y + topY);
            canvas.LineTo(cx + X + beatLineX, cy + Y + bottomY);
            canvas.Stroke();


            //
            // Draw beam
            //
            var glyph = new BeamGlyph(beatLineX, beamY, beat.Duration, _direction, false);

            glyph.Renderer = this;
            glyph.DoLayout();
            glyph.Paint(cx + X, cy + Y, canvas);
        }
Exemplo n.º 11
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var blockWidth = 4 * Scale;

            var top = cy + Y + Renderer.TopPadding;
            var bottom = cy + Y + Renderer.Height - Renderer.BottomPadding;
            var left = cx + X + 0.5f;
            // big bar
            var h = bottom - top;
            canvas.FillRect(left, top, blockWidth, h);

            // line
            left += (blockWidth * 2) - 0.5f;
            canvas.BeginPath();
            canvas.MoveTo(left, top);
            canvas.LineTo(left, bottom);
            canvas.Stroke();

            //circles 
            left += 3 * Scale;

            var circleSize = _circleSize * Scale;
            var middle = (top + bottom) / 2;
            canvas.FillCircle(left, middle - (circleSize * _dotOffset), circleSize);
            canvas.FillCircle(left, middle + (circleSize * _dotOffset), circleSize);
        }
Exemplo n.º 12
0
        protected override void PaintBackground(float cx, float cy, ICanvas canvas)
        {
            base.PaintBackground(cx, cy, canvas);

            var res = Resources;

            //
            // draw string lines
            //
            canvas.Color = res.StaveLineColor;
            var lineY = cy + Y + NumberOverflow;

            for (int i = 0, j = Bar.Staff.Track.Tuning.Length; i < j; i++)
            {
                if (i > 0)
                {
                    lineY += LineOffset;
                }
                canvas.BeginPath();
                canvas.MoveTo(cx + X, (int)lineY);
                canvas.LineTo(cx + X + Width, (int)lineY);
                canvas.Stroke();
            }

            canvas.Color = res.MainGlyphColor;

            // Info guides for debugging

            //DrawInfoGuide(canvas, cx, cy, 0, new Color(255, 0, 0)); // top
            //DrawInfoGuide(canvas, cx, cy, stave.StaveTop, new Color(0, 255, 0)); // stavetop
            //DrawInfoGuide(canvas, cx, cy, stave.StaveBottom, new Color(0,255,0)); // stavebottom
            //DrawInfoGuide(canvas, cx, cy, Height, new Color(255, 0, 0)); // bottom
        }
Exemplo n.º 13
0
        /// <summary>
        /// paints a tie between the two given points
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="scale"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="down"></param>
        public static void PaintTie(ICanvas canvas, float scale, float x1, float y1, float x2, float y2,
                                    bool down = false)
        {
            if (x1 == x2 && y1 == y2)
            {
                return;
            }
            // ensure endX > startX
            if (x2 < x1)
            {
                var t = x1;
                x1 = x2;
                x2 = t;
                t  = y1;
                y1 = y2;
                y2 = t;
            }
            //
            // calculate control points
            //

            var offset = 22 * scale;
            var size   = 4 * scale;
            // normal vector
            var normalVectorX = (y2 - y1);
            var normalVectorY = (x2 - x1);
            var length        = (float)Math.Sqrt((normalVectorX * normalVectorX) + (normalVectorY * normalVectorY));

            if (down)
            {
                normalVectorX *= -1;
            }
            else
            {
                normalVectorY *= -1;
            }

            // make to unit vector
            normalVectorX /= length;
            normalVectorY /= length;

            // center of connection
            var centerX = (x2 + x1) / 2;
            var centerY = (y2 + y1) / 2;

            // control points
            var cp1X = centerX + (offset * normalVectorX);
            var cp1Y = centerY + (offset * normalVectorY);
            var cp2X = centerX + ((offset - size) * normalVectorX);
            var cp2Y = centerY + ((offset - size) * normalVectorY);


            canvas.BeginPath();
            canvas.MoveTo(x1, y1);
            canvas.QuadraticCurveTo(cp1X, cp1Y, x2, y2);
            canvas.QuadraticCurveTo(cp2X, cp2Y, x1, y1);
            canvas.ClosePath();
        }
Exemplo n.º 14
0
 private static void PaintSingleBar(ICanvas canvas, float x1, float y1, float x2, float y2, float size)
 {
     canvas.BeginPath();
     canvas.MoveTo(x1, y1);
     canvas.LineTo(x2, y2);
     canvas.LineTo(x2, y2 - size);
     canvas.LineTo(x1, y1 - size);
     canvas.ClosePath();
     canvas.Fill();
 }
Exemplo n.º 15
0
 private static void PaintSingleBar(ICanvas canvas, float x1, float y1, float x2, float y2, float size)
 {
     canvas.BeginPath();
     canvas.MoveTo(x1, y1);
     canvas.LineTo(x2, y2);
     canvas.LineTo(x2, y2 - size);
     canvas.LineTo(x1, y1 - size);
     canvas.ClosePath();
     canvas.Fill();
 }
Exemplo n.º 16
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            //TODO: Create webfont version

            var scoreBarRenderer = (ScoreBarRenderer)Renderer;
            var lineSize         = scoreBarRenderer.LineOffset;
            var startY           = cy + Y + (scoreBarRenderer.GetNoteY(_beat.MaxNote) - lineSize / 2);
            var endY             = cy + Y + scoreBarRenderer.GetNoteY(_beat.MinNote) + lineSize;
            var arrowX           = cx + X + Width / 2;
            var arrowSize        = 8 * Scale;

            if (_beat.BrushType != BrushType.None)
            {
                //if (_beat.BrushType == BrushType.ArpeggioUp || _beat.BrushType == BrushType.ArpeggioDown)
                //{
                //    var size = 15 * Scale;
                //    var steps = Math.Abs(endY - startY) / size;
                //    for (var i = 0; i < steps; i++)
                //    {
                //        canvas.FillMusicFontSymbol(cx + X + (3 * Scale), 1, startY + (i * size), MusicFontSymbol.WaveVertical);
                //    }
                //}

                if (_beat.BrushType == BrushType.ArpeggioUp)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, endY);
                    canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else if (_beat.BrushType == BrushType.ArpeggioDown)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
            }
        }
Exemplo n.º 17
0
        private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            foreach (var beat in h.Beats)
            {
                if (beat.Duration == Duration.Whole || beat.Duration == Duration.DoubleWhole || beat.Duration == Duration.QuadrupleWhole)
                {
                    return;
                }


                //
                // draw line
                //

                var beatLineX = h.GetBeatLineX(beat);
                var y1        = cy + Y;
                var y2        = cy + Y + Height;

                var startGlyph = (TabBeatGlyph)GetOnNotesGlyphForBeat(beat);
                if (startGlyph.NoteNumbers == null)
                {
                    y1 += Height - RhythmHeight;
                }
                else
                {
                    y1 += startGlyph.NoteNumbers.GetNoteY(startGlyph.NoteNumbers.MinStringNote) + LineOffset / 2;
                }

                if (h.Direction == BeamDirection.Up)
                {
                    beatLineX -= startGlyph.Width / 2f;
                }
                else
                {
                    beatLineX += startGlyph.Width / 2f;
                }

                canvas.BeginPath();
                canvas.MoveTo(cx + X + beatLineX, y1);
                canvas.LineTo(cx + X + beatLineX, y2);
                canvas.Stroke();

                //
                // Draw beam
                //
                if (beat.Duration > Duration.Quarter)
                {
                    var glyph = new BeamGlyph(0, 0, beat.Duration, BeamDirection.Down, false);
                    glyph.Renderer = this;
                    glyph.DoLayout();
                    glyph.Paint(cx + X + beatLineX, y2, canvas);
                }
            }
        }
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var size = 6 * Scale;

            canvas.BeginPath();
            canvas.MoveTo(cx + X, cy + Y);
            canvas.QuadraticCurveTo(cx + X + (Width / 2), cy + Y, cx + X + Width, cy + Y - size);
            canvas.MoveTo(cx + X, cy + Y);
            canvas.QuadraticCurveTo(cx + X + (Width / 2), cy + Y, cx + X + Width, cy + Y + size);
            canvas.Stroke();
        }
Exemplo n.º 19
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var size = 6 * Scale;

            canvas.BeginPath();
            canvas.MoveTo(cx + X, cy + Y);
            canvas.QuadraticCurveTo(cx + X + (Width / 2), cy + Y, cx + X + Width, cy + Y - size);
            canvas.MoveTo(cx + X, cy + Y);
            canvas.QuadraticCurveTo(cx + X + (Width / 2), cy + Y, cx + X + Width, cy + Y + size);
            canvas.Stroke();
        }
Exemplo n.º 20
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var scoreBarRenderer = (ScoreBarRenderer)Renderer;
            var lineSize = scoreBarRenderer.LineOffset;
            var startY = cy + Y + (scoreBarRenderer.GetNoteY(_beat.MaxNote) - lineSize / 2);
            var endY = cy + Y + scoreBarRenderer.GetNoteY(_beat.MinNote) + lineSize;
            var arrowX = cx + X + Width / 2;
            var arrowSize = 8 * Scale;

            if (_beat.BrushType != BrushType.None)
            {
                if (_beat.BrushType == BrushType.ArpeggioUp || _beat.BrushType == BrushType.ArpeggioDown)
                {
                    var size = 15 * Scale;
                    var steps = Math.Abs(endY - startY) / size;
                    for (var i = 0; i < steps; i++)
                    {
                        canvas.FillMusicFontSymbol(cx + X + (3 * Scale), 1, startY + (i * size), MusicFontSymbol.WaveVertical);
                    }
                }

                if (_beat.BrushType == BrushType.ArpeggioUp)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, endY);
                    canvas.LineTo(arrowX + arrowSize / 2, endY - arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, endY - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else if (_beat.BrushType == BrushType.ArpeggioDown)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(arrowX, startY);
                    canvas.LineTo(arrowX + arrowSize / 2, startY + arrowSize);
                    canvas.LineTo(arrowX - arrowSize / 2, startY + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
            }
        }
Exemplo n.º 21
0
        protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
        {
            var size = PaintOttava(cx, cy, canvas);

            var lineSpacing = LineRangedGlyph.LineSpacing * Scale;
            var startX      = cx + X + size + lineSpacing;
            var lineY       = cy + Y;

            lineY += _aboveStaff ? 2 * Scale : Height - 2 * Scale;

            var lineSize = LineRangedGlyph.LineSize * Scale;


            if (endX > startX)
            {
                var lineX = startX;
                while (lineX < endX)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(lineX, (int)lineY);
                    canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                    lineX += lineSize + lineSpacing;
                    canvas.Stroke();
                }

                canvas.BeginPath();
                if (_aboveStaff)
                {
                    canvas.MoveTo(endX, lineY);
                    canvas.LineTo(endX, cy + Y + Height);
                }
                else
                {
                    canvas.MoveTo(endX, lineY);
                    canvas.LineTo(endX, cy + Y);
                }

                canvas.Stroke();
            }
        }
Exemplo n.º 22
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var size = 6 * Scale;
            var width = Math.Max(Width, 14*Scale);

            var offset = Renderer.Height/2;

            canvas.BeginPath();
            canvas.MoveTo(cx + X, cy + Y + offset);
            canvas.QuadraticCurveTo(cx + X + (width / 2), cy + Y + offset, cx + X + width, cy + Y + offset - size);
            canvas.MoveTo(cx + X, cy + Y + offset);
            canvas.QuadraticCurveTo(cx + X + (width / 2), cy + Y + offset, cx + X + width, cy + Y + offset + size);
            canvas.Stroke();
        }
Exemplo n.º 23
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var size  = 6 * Scale;
            var width = Math.Max(Width, 14 * Scale);

            var offset = Renderer.Height / 2;

            canvas.BeginPath();
            canvas.MoveTo(cx + X, cy + Y + offset);
            canvas.QuadraticCurveTo(cx + X + (width / 2), cy + Y + offset, cx + X + width, cy + Y + offset - size);
            canvas.MoveTo(cx + X, cy + Y + offset);
            canvas.QuadraticCurveTo(cx + X + (width / 2), cy + Y + offset, cx + X + width, cy + Y + offset + size);
            canvas.Stroke();
        }
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;

            canvas.Font      = res.EffectFont;
            canvas.TextAlign = TextAlign.Left;
            var textWidth = canvas.MeasureText(_label);

            canvas.FillText(_label, cx + X, cy + Y);

            // check if we need lines
            if (_isExpanded)
            {
                var lineSpacing = LineSpacing * Scale;
                var startX      = cx + X + textWidth + lineSpacing;
                var endX        = cx + X + Width - lineSpacing - lineSpacing;
                var lineY       = cy + Y + (LineTopPadding * Scale);
                var lineSize    = LineSize * Scale;

                if (endX > startX)
                {
                    var lineX = startX;
                    while (lineX < endX)
                    {
                        canvas.BeginPath();
                        canvas.MoveTo(lineX, (int)lineY);
                        canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                        lineX += lineSize + lineSpacing;
                        canvas.Stroke();
                    }
                    canvas.BeginPath();
                    canvas.MoveTo(endX, (int)(lineY - LineTopOffset * Scale));
                    canvas.LineTo(endX, (int)(lineY + LineTopOffset * Scale));
                    canvas.Stroke();
                }
            }
        }
Exemplo n.º 25
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var res = Renderer.Resources;
            canvas.Font = res.EffectFont;
            canvas.TextAlign = TextAlign.Left;
            var textWidth = canvas.MeasureText(_label);
            canvas.FillText(_label, cx + X, cy + Y);

            // check if we need lines
            if (_isExpanded)
            {
                var lineSpacing = LineSpacing * Scale;
                var startX = cx + X + textWidth + lineSpacing;
                var endX = cx + X + Width - lineSpacing - lineSpacing;
                var lineY = cy + Y + (LineTopPadding * Scale);
                var lineSize = LineSize * Scale;

                if (endX > startX)
                {
                    var lineX = startX;
                    while (lineX < endX)
                    {
                        canvas.BeginPath();
                        canvas.MoveTo(lineX, (int)lineY);
                        canvas.LineTo(Math.Min(lineX + lineSize, endX), (int)lineY);
                        lineX += lineSize + lineSpacing;
                        canvas.Stroke();
                    }
                    canvas.BeginPath();
                    canvas.MoveTo(endX, (int)(lineY - LineTopOffset * Scale));
                    canvas.LineTo(endX, (int)(lineY + LineTopOffset * Scale));
                    canvas.Stroke();

                }
            }
        }
Exemplo n.º 26
0
        protected void DrawBendSlur(ICanvas canvas, float x1, float y1, float x2, float y2, bool down, float scale, string slurText = null)
        {
            var normalVectorX = (y2 - y1);
            var normalVectorY = (x2 - x1);
            var length        = (float)Math.Sqrt((normalVectorX * normalVectorX) + (normalVectorY * normalVectorY));

            if (down)
            {
                normalVectorX *= -1;
            }
            else
            {
                normalVectorY *= -1;
            }

            // make to unit vector
            normalVectorX /= length;
            normalVectorY /= length;

            // center of connection
            // TODO: should be 1/3
            var centerX = (x2 + x1) / 2;
            var centerY = (y2 + y1) / 2;

            var offset = SlurHeight * scale;

            if (x2 - x1 < 20)
            {
                offset /= 2;
            }
            var cp1X = centerX + (offset * normalVectorX);
            var cp1Y = centerY + (offset * normalVectorY);

            canvas.BeginPath();

            canvas.MoveTo(x1, y1);
            canvas.LineTo(cp1X, cp1Y);
            canvas.LineTo(x2, y2);

            canvas.Stroke();

            if (!string.IsNullOrEmpty(slurText))
            {
                var w          = canvas.MeasureText(slurText);
                var textOffset = down ? 0 : -canvas.Font.Size;
                canvas.FillText(slurText, cp1X - w / 2, cp1Y + textOffset);
            }
        }
Exemplo n.º 27
0
        protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
        {
            var startX = cx + X;
            var width  = endX - startX;
            var loops  = (int)Math.Max(1, width / _stepSize);

            canvas.BeginPath();
            canvas.MoveTo(startX, cy + Y);
            for (int i = 0; i < loops; i++)
            {
                canvas.LineTo(startX + _stepSize / 2, cy + Y + Height);
                canvas.LineTo(startX + _stepSize, cy + Y);
                startX += _stepSize;
            }

            canvas.Stroke();
        }
Exemplo n.º 28
0
 public override void Paint(float cx, float cy, ICanvas canvas)
 {
     var height = Height * Scale;
     canvas.BeginPath();
     if (_crescendo == CrescendoType.Crescendo)
     {
         canvas.MoveTo(cx + X + Width, cy + Y);
         canvas.LineTo(cx + X, cy + Y + (height / 2));
         canvas.LineTo(cx + X + Width, cy + Y + height);
     }
     else
     {
         canvas.MoveTo(cx + X, cy + Y);
         canvas.LineTo(cx + X + Width, cy + Y + (height / 2));
         canvas.LineTo(cx + X, cy + Y + height);
     }
     canvas.Stroke();
 }
Exemplo n.º 29
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var height = Height * Scale;

            canvas.BeginPath();
            if (_crescendo == CrescendoType.Crescendo)
            {
                canvas.MoveTo(cx + X + Width, cy + Y);
                canvas.LineTo(cx + X, cy + Y + (height / 2));
                canvas.LineTo(cx + X + Width, cy + Y + height);
            }
            else
            {
                canvas.MoveTo(cx + X, cy + Y);
                canvas.LineTo(cx + X + Width, cy + Y + (height / 2));
                canvas.LineTo(cx + X, cy + Y + height);
            }
            canvas.Stroke();
        }
Exemplo n.º 30
0
 protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
 {
     var startX = cx + X;
     var height = Height * Scale;
     canvas.BeginPath();
     if (_crescendo == CrescendoType.Crescendo)
     {
         canvas.MoveTo(endX, cy + Y);
         canvas.LineTo(startX, cy + Y + height / 2);
         canvas.LineTo(endX, cy + Y + height);
     }
     else
     {
         canvas.MoveTo(cx + X, cy + Y);
         canvas.LineTo(endX, cy + Y + (height / 2));
         canvas.LineTo(cx + X, cy + Y + height);
     }
     canvas.Stroke();
 }
Exemplo n.º 31
0
        protected override void PaintGrouped(float cx, float cy, float endX, ICanvas canvas)
        {
            var startX = cx + X;
            var height = Height * Scale;

            canvas.BeginPath();
            if (_crescendo == CrescendoType.Crescendo)
            {
                canvas.MoveTo(endX, cy + Y);
                canvas.LineTo(startX, cy + Y + height / 2);
                canvas.LineTo(endX, cy + Y + height);
            }
            else
            {
                canvas.MoveTo(cx + X, cy + Y);
                canvas.LineTo(endX, cy + Y + (height / 2));
                canvas.LineTo(cx + X, cy + Y + height);
            }
            canvas.Stroke();
        }
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var blockWidth = 4 * Scale;

            var top    = cy + Y + Renderer.TopPadding;
            var bottom = cy + Y + Renderer.Height - Renderer.BottomPadding;
            var left   = (int)(cx + X);
            var h      = bottom - top;

            // line
            canvas.BeginPath();
            canvas.MoveTo(left, top);
            canvas.LineTo(left, bottom);
            canvas.Stroke();

            if (_isLast)
            {
                // big bar
                left += (int)((3 * Scale) + 0.5f);
                canvas.FillRect(left, top, blockWidth, h);
            }
        }
Exemplo n.º 33
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var blockWidth = 4 * Scale;

            var top = cy + Y + Renderer.TopPadding;
            var bottom = cy + Y + Renderer.Height - Renderer.BottomPadding;
            var left = (int)(cx + X);
            var h = bottom - top;

            // line
            canvas.BeginPath();
            canvas.MoveTo(left, top);
            canvas.LineTo(left, bottom);
            canvas.Stroke();

            if (_isLast)
            {
                // big bar
                left += (int)((3 * Scale) + 0.5f);
                canvas.FillRect(left, top, blockWidth, h);
            }
        }
Exemplo n.º 34
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            // calculate offsets per step
            var dX       = Width / BendPoint.MaxPosition;
            var maxValue = 0;

            for (int i = 0, j = _note.BendPoints.Count; i < j; i++)
            {
                if (_note.BendPoints[i].Value > maxValue)
                {
                    maxValue = _note.BendPoints[i].Value;
                }
            }

            cx += X;
            cy += Y;

            canvas.BeginPath();
            for (int i = 0, j = _note.BendPoints.Count - 1; i < j; i++)
            {
                var firstPt  = _note.BendPoints[i];
                var secondPt = _note.BendPoints[i + 1];

                // draw pre-bend if previous
                if (i == 0 && firstPt.Value != 0 && !_note.IsTieDestination)
                {
                    PaintBend(new BendPoint(), firstPt, cx, cy, dX, canvas);
                }

                // don't draw a line if there's no offset and it's the last point
                if (firstPt.Value == secondPt.Value && i == _note.BendPoints.Count - 2)
                {
                    continue;
                }

                PaintBend(firstPt, secondPt, cx, cy, dX, canvas);
            }
        }
Exemplo n.º 35
0
        private void RenderTriplet(float cx, float cy, ICanvas canvas)
        {
            cy += 2 * Scale;
            var font = Renderer.Resources.EffectFont;

            canvas.Font = new Font(font.Family, font.Size * 0.8f, font.Style);

            var rightX = cx + NoteSeparation * Scale + 3 * Scale;

            canvas.BeginPath();
            canvas.MoveTo(cx, cy + (3 * Scale));
            canvas.LineTo(cx, cy);
            canvas.LineTo(cx + (5 * Scale), cy);

            canvas.MoveTo(rightX + (5 * Scale), cy + (3 * Scale));
            canvas.LineTo(rightX + (5 * Scale), cy);
            canvas.LineTo(rightX, cy);

            canvas.Stroke();

            canvas.FillText("3", cx + (7 * Scale), cy - (10 * Scale));

            canvas.Font = font;
        }
Exemplo n.º 36
0
        private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            for (int i = 0, j = h.Beats.Count; i < j; i++)
            {
                var beat = h.Beats[i];

                var correction = NoteHeadGlyph.NoteHeadHeight / 2;

                //
                // draw line
                //
                var beatLineX = h.GetBeatLineX(beat) + Scale;

                var direction = h.Direction;

                var y1 = cy + Y + (direction == BeamDirection.Up
                            ? GetScoreY(GetNoteLine(beat.MinNote), correction - 1)
                            : GetScoreY(GetNoteLine(beat.MaxNote), correction - 1));

                var y2 = cy + Y + CalculateBeamY(h, beatLineX);

                canvas.BeginPath();
                canvas.MoveTo(cx + X + beatLineX, y1);
                canvas.LineTo(cx + X + beatLineX, y2);
                canvas.Stroke();

                var brokenBarOffset = 6 * Scale;
                var barSpacing      = 6 * Scale;
                var barSize         = 3 * Scale;
                var barCount        = beat.Duration.GetIndex() - 2;
                var barStart        = cy + Y;
                if (direction == BeamDirection.Down)
                {
                    barSpacing = -barSpacing;
                    barSize    = -barSize;
                }

                for (var barIndex = 0; barIndex < barCount; barIndex++)
                {
                    float barStartX;
                    float barEndX;

                    float barStartY;
                    float barEndY;

                    var barY = barStart + (barIndex * barSpacing);

                    //
                    // Bar to Next?
                    //
                    if (i < h.Beats.Count - 1)
                    {
                        // full bar?
                        if (IsFullBarJoin(beat, h.Beats[i + 1], barIndex))
                        {
                            barStartX = beatLineX;
                            barEndX   = h.GetBeatLineX(h.Beats[i + 1]) + Scale;
                        }
                        // broken bar?
                        else if (i == 0 || !IsFullBarJoin(h.Beats[i - 1], beat, barIndex))
                        {
                            barStartX = beatLineX;
                            barEndX   = barStartX + brokenBarOffset;
                        }
                        else
                        {
                            continue;
                        }
                        barStartY = barY + CalculateBeamY(h, barStartX);
                        barEndY   = barY + CalculateBeamY(h, barEndX);
                        PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                    }
                    //
                    // Broken Bar to Previous?
                    //
                    else if (i > 0 && !IsFullBarJoin(beat, h.Beats[i - 1], barIndex))
                    {
                        barStartX = beatLineX - brokenBarOffset;
                        barEndX   = beatLineX;

                        barStartY = barY + CalculateBeamY(h, barStartX);
                        barEndY   = barY + CalculateBeamY(h, barEndX);

                        PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                    }
                }
            }
        }
Exemplo n.º 37
0
        private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletHelper h)
        {
            var res      = Resources;
            var oldAlign = canvas.TextAlign;

            canvas.TextAlign = TextAlign.Center;
            // check if we need to paint simple footer
            if (h.Beats.Count == 1 || !h.IsFull)
            {
                for (int i = 0, j = h.Beats.Count; i < j; i++)
                {
                    var beat          = h.Beats[i];
                    var beamingHelper = _helpers.BeamHelperLookup[h.VoiceIndex][beat.Index];
                    if (beamingHelper == null)
                    {
                        continue;
                    }
                    var direction = beamingHelper.Direction;

                    var tupletX = beamingHelper.GetBeatLineX(beat) + Scale;
                    var tupletY = cy + Y + CalculateBeamY(beamingHelper, tupletX);

                    var offset = direction == BeamDirection.Up
                                ? res.EffectFont.Size * 1.8f
                                : -3 * Scale;

                    canvas.Font = res.EffectFont;
                    canvas.FillText(h.Tuplet.ToString(), cx + X + tupletX, tupletY - offset);
                }
            }
            else
            {
                var firstBeat = h.Beats[0];
                var lastBeat  = h.Beats[h.Beats.Count - 1];

                var beamingHelper = _helpers.BeamHelperLookup[h.VoiceIndex][firstBeat.Index];
                if (beamingHelper != null)
                {
                    var direction = beamingHelper.Direction;

                    //
                    // Calculate the overall area of the tuplet bracket

                    var startX = beamingHelper.GetBeatLineX(firstBeat) + Scale;
                    var endX   = beamingHelper.GetBeatLineX(lastBeat) + Scale;

                    //
                    // Calculate how many space the text will need
                    canvas.Font = res.EffectFont;
                    var s  = h.Tuplet.ToString();
                    var sw = canvas.MeasureText(s);
                    var sp = 3 * Scale;

                    //
                    // Calculate the offsets where to break the bracket
                    var middleX  = (startX + endX) / 2;
                    var offset1X = middleX - sw / 2 - sp;
                    var offset2X = middleX + sw / 2 + sp;

                    //
                    // calculate the y positions for our bracket

                    var startY   = CalculateBeamY(beamingHelper, startX);
                    var offset1Y = CalculateBeamY(beamingHelper, offset1X);
                    var middleY  = CalculateBeamY(beamingHelper, middleX);
                    var offset2Y = CalculateBeamY(beamingHelper, offset2X);
                    var endY     = CalculateBeamY(beamingHelper, endX);

                    var offset = 10 * Scale;
                    var size   = 5 * Scale;
                    if (direction == BeamDirection.Down)
                    {
                        offset *= -1;
                        size   *= -1;
                    }

                    //
                    // draw the bracket
                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + startX, (int)(cy + Y + startY - offset));
                    canvas.LineTo(cx + X + startX, (int)(cy + Y + startY - offset - size));
                    canvas.LineTo(cx + X + offset1X, (int)(cy + Y + offset1Y - offset - size));
                    canvas.Stroke();

                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + offset2X, (int)(cy + Y + offset2Y - offset - size));
                    canvas.LineTo(cx + X + endX, (int)(cy + Y + endY - offset - size));
                    canvas.LineTo(cx + X + endX, (int)(cy + Y + endY - offset));
                    canvas.Stroke();

                    //
                    // Draw the string
                    canvas.FillText(s, cx + X + middleX, cy + Y + middleY - offset - size - res.EffectFont.Size);
                }
            }
            canvas.TextAlign = oldAlign;
        }
Exemplo n.º 38
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);
            }
        }
Exemplo n.º 39
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var r = (ScoreBarRenderer)Renderer;

            cx += r.X;
            cy += r.Y;
            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();
        }
Exemplo n.º 40
0
        private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            for (int i = 0, j = h.Beats.Count; i < j; i++)
            {
                var beat = h.Beats[i];

                if (h.HasBeatLineX(beat))
                {
                    //
                    // draw line
                    //
                    var beatLineX = h.GetBeatLineX(beat) + Scale;

                    var y1 = cy + Y;
                    var y2 = cy + Y + Height;

                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + beatLineX, y1);
                    canvas.LineTo(cx + X + beatLineX, y2);
                    canvas.Stroke();

                    var brokenBarOffset = (6 * Scale);
                    var barSpacing = (6 * Scale);
                    var barSize = (3 * Scale);
                    var barCount = beat.Duration.GetIndex() - 2;
                    var barStart = cy + Y;
                    if (_direction == BeamDirection.Down)
                    {
                        barSpacing = -barSpacing;
                        barStart += Height;
                    }

                    for (int barIndex = 0; barIndex < barCount; barIndex++)
                    {
                        float barStartX;
                        float barEndX;

                        float barStartY;
                        float barEndY;

                        var barY = barStart + (barIndex * barSpacing);

                        //
                        // Broken Bar to Next
                        //
                        if (h.Beats.Count == 1)
                        {
                            barStartX = beatLineX;
                            barEndX = beatLineX + brokenBarOffset;
                            barStartY = barY;
                            barEndY = barY;
                            PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                        }
                        //
                        // Bar to Next?
                        //
                        else if (i < h.Beats.Count - 1)
                        {
                            // full bar?
                            if (IsFullBarJoin(beat, h.Beats[i + 1], barIndex))
                            {
                                barStartX = beatLineX;
                                barEndX = h.GetBeatLineX(h.Beats[i + 1]) + Scale;
                            }
                            // broken bar?
                            else if (i == 0 || !IsFullBarJoin(h.Beats[i - 1], beat, barIndex))
                            {
                                barStartX = beatLineX;
                                barEndX = barStartX + brokenBarOffset;
                            }
                            else
                            {
                                continue;
                            }
                            barStartY = barY;
                            barEndY = barY;
                            PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                        }
                        //
                        // Broken Bar to Previous?
                        //
                        else if (i > 0 && !IsFullBarJoin(beat, h.Beats[i - 1], barIndex))
                        {
                            barStartX = beatLineX - brokenBarOffset;
                            barEndX = beatLineX;

                            barStartY = barY;
                            barEndY = barY;

                            PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                        }
                    }
                }
            }
        }
Exemplo n.º 41
0
        private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            var beat = h.Beats[0];

            if (beat.Duration == Duration.Whole || beat.Duration == Duration.DoubleWhole)
            {
                return;
            }

            //
            // draw line
            //

            var beatLineX = h.GetBeatLineX(beat) + Scale;

            const float topY = 0;
            var bottomY = Height;

            float beamY = _direction == BeamDirection.Down ? bottomY : topY;

            canvas.BeginPath();
            canvas.MoveTo(cx + X + beatLineX, cy + Y + topY);
            canvas.LineTo(cx + X + beatLineX, cy + Y + bottomY);
            canvas.Stroke();

            //
            // Draw beam
            //
            var glyph = new BeamGlyph(beatLineX, beamY, beat.Duration, _direction, false);
            glyph.Renderer = this;
            glyph.DoLayout();
            glyph.Paint(cx + X, cy + Y, canvas);
        }
Exemplo n.º 42
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var tabBarRenderer = (TabBarRenderer)Renderer;
            var res            = Renderer.Resources;
            var startX         = cx + X + _parent.OnNotes.Width / 2;
            var endX           = _beat.NextBeat == null || _beat.Voice != _beat.NextBeat.Voice
                    ? cx + X + _parent.OnNotes.Width / 2 + _parent.PostNotes.Width
                    : cx + tabBarRenderer.GetBeatX(_beat.NextBeat);
            var startY     = cy + X;
            var textOffset = 3 * Scale;

            var sizeY = WhammyMaxOffset * Scale;

            var old = canvas.TextAlign;

            canvas.TextAlign = TextAlign.Center;
            if (_beat.WhammyBarPoints.Count >= 2)
            {
                var dx = (endX - startX) / Beat.WhammyBarMaxPosition;
                var dy = sizeY / Beat.WhammyBarMaxValue;

                canvas.BeginPath();
                for (int i = 0, j = _beat.WhammyBarPoints.Count - 1; i < j; i++)
                {
                    var pt1 = _beat.WhammyBarPoints[i];
                    var pt2 = _beat.WhammyBarPoints[i + 1];

                    if (pt1.Value == pt2.Value && i == _beat.WhammyBarPoints.Count - 2)
                    {
                        continue;
                    }

                    var pt1X = startX + (dx * pt1.Offset);
                    var pt1Y = startY - (dy * pt1.Value);

                    var pt2X = startX + (dx * pt2.Offset);
                    var pt2Y = startY - (dy * pt2.Value);

                    canvas.MoveTo(pt1X, pt1Y);
                    canvas.LineTo(pt2X, pt2Y);

                    if (pt2.Value != 0)
                    {
                        var dv = pt2.Value / 4.0;
                        var up = (pt2.Value - pt1.Value) >= 0;
                        var s  = "";
                        if (dv < 0)
                        {
                            s += "-";
                        }

                        if (dv >= 1 || dv <= -1)
                        {
                            s += Math.Abs(dv) + " ";
                        }

                        dv -= (int)dv;
                        if (dv == 0.25)
                        {
                            s += "1/4";
                        }
                        else if (dv == 0.5)
                        {
                            s += "1/2";
                        }
                        else if (dv == 0.75)
                        {
                            s += "3/4";
                        }

                        canvas.Font = res.GraceFont;
                        //var size = canvas.MeasureText(s);
                        var sy = up
                                    ? pt2Y - res.GraceFont.Size - textOffset
                                    : pt2Y + textOffset;
                        var sx = pt2X;
                        canvas.FillText(s, sx, sy);
                    }
                }
                canvas.Stroke();
            }
            canvas.TextAlign = old;
        }
Exemplo n.º 43
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var r = (TabBarRenderer)Renderer;

            var sizeX = 12 * Scale;
            var sizeY = 3 * Scale;
            float startX;
            float startY;
            float endX;
            float endY;
            switch (_type)
            {
                case SlideType.Shift:
                case SlideType.Legato:
                    float startOffsetY;
                    float endOffsetY;

                    if (_startNote.SlideTarget == null)
                    {
                        startOffsetY = 0;
                        endOffsetY = 0;
                    }
                    else if (_startNote.SlideTarget.Fret > _startNote.Fret)
                    {
                        startOffsetY = sizeY;
                        endOffsetY = sizeY * -1;
                    }
                    else
                    {
                        startOffsetY = sizeY * -1;
                        endOffsetY = sizeY;
                    }

                    startX = cx + r.GetNoteX(_startNote);
                    startY = cy + r.GetNoteY(_startNote) + startOffsetY;
                    if (_startNote.SlideTarget != null)
                    {
                        endX = cx + r.GetNoteX(_startNote.SlideTarget, false);
                        endY = cy + r.GetNoteY(_startNote.SlideTarget) + endOffsetY;
                    }
                    else
                    {
                        endX = cx + _parent.X + _parent.PostNotes.X + _parent.PostNotes.Width;
                        endY = startY;
                    }
                    break;

                case SlideType.IntoFromBelow:
                    endX = cx + r.GetNoteX(_startNote, false);
                    endY = cy + r.GetNoteY(_startNote);

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

                    startX = endX - sizeX;
                    startY = cy + r.GetNoteY(_startNote) - sizeY;
                    break;
                case SlideType.OutUp:
                    startX = cx + r.GetNoteX(_startNote);
                    startY = cy + r.GetNoteY(_startNote);

                    endX = startX + sizeX;
                    endY = cy + r.GetNoteY(_startNote) - sizeY;
                    break;

                case SlideType.OutDown:
                    startX = cx + r.GetNoteX(_startNote);
                    startY = cy + r.GetNoteY(_startNote);

                    endX = startX + sizeX;
                    endY = cy + r.GetNoteY(_startNote) + sizeY;
                    break;
                default:
                    return;
            }

            canvas.BeginPath();
            canvas.MoveTo(startX, startY);
            canvas.LineTo(endX, endY);
            canvas.Stroke();
        }
Exemplo n.º 44
0
        /// <summary>
        /// paints a tie between the two given points
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="scale"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="down"></param>
        public static void PaintTie(ICanvas canvas, float scale, float x1, float y1, float x2, float y2,
            bool down = false)
        {
            // ensure endX > startX
            if (x2 > x1)
            {
                var t = x1;
                x1 = x2;
                x2 = t;
                t = y1;
                y1 = y2;
                y2 = t;
            }
            //
            // calculate control points
            //
            var offset = 15 * scale;
            var size = 4 * scale;
            // normal vector
            var normalVectorX = (y2 - y1);
            var normalVectorY = (x2 - x1);
            var length = (float)Math.Sqrt((normalVectorX * normalVectorX) + (normalVectorY * normalVectorY));
            if (down)
                normalVectorX *= -1;
            else
                normalVectorY *= -1;

            // make to unit vector
            normalVectorX /= length;
            normalVectorY /= length;

            // center of connection
            var centerX = (x2 + x1) / 2;
            var centerY = (y2 + y1) / 2;

            // control points
            var cp1X = centerX + (offset * normalVectorX);
            var cp1Y = centerY + (offset * normalVectorY);
            var cp2X = centerX + ((offset - size) * normalVectorX);
            var cp2Y = centerY + ((offset - size) * normalVectorY);
            canvas.BeginPath();
            canvas.MoveTo(x1, y1);
            canvas.QuadraticCurveTo(cp1X, cp1Y, x2, y2);
            canvas.QuadraticCurveTo(cp2X, cp2Y, x1, y1);
            canvas.ClosePath();
        }
Exemplo n.º 45
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var tabBarRenderer = (TabBarRenderer)Renderer;
            var res = Renderer.Resources;
            var startX = cx + X + _parent.OnNotes.Width / 2;
            var endX = _beat.NextBeat == null || _beat.Voice != _beat.NextBeat.Voice
                    ? cx + X + _parent.Width
                    : cx + tabBarRenderer.GetBeatX(_beat.NextBeat);
            var startY = cy + X;
            var textOffset = 3 * Scale;

            var sizeY = WhammyMaxOffset * Scale;

            var old = canvas.TextAlign;
            canvas.TextAlign = TextAlign.Center;
            if (_beat.WhammyBarPoints.Count >= 2)
            {
                var dx = (endX - startX) / Beat.WhammyBarMaxPosition;
                var dy = sizeY / Beat.WhammyBarMaxValue;

                canvas.BeginPath();
                for (int i = 0, j = _beat.WhammyBarPoints.Count - 1; i < j; i++)
                {
                    var pt1 = _beat.WhammyBarPoints[i];
                    var pt2 = _beat.WhammyBarPoints[i + 1];

                    if (pt1.Value == pt2.Value && i == _beat.WhammyBarPoints.Count - 2) continue;

                    var pt1X = startX + (dx * pt1.Offset);
                    var pt1Y = startY - (dy * pt1.Value);

                    var pt2X = startX + (dx * pt2.Offset);
                    var pt2Y = startY - (dy * pt2.Value);

                    canvas.MoveTo(pt1X, pt1Y);
                    canvas.LineTo(pt2X, pt2Y);

                    if (pt2.Value != 0)
                    {
                        var dv = pt2.Value / 4.0;
                        var up = (pt2.Value - pt1.Value) >= 0;
                        var s = "";
                        if (dv < 0) s += "-";

                        if (dv >= 1 || dv <= -1)
                            s += Math.Abs(dv) + " ";

                        dv -= (int)dv;
                        if (dv == 0.25)
                            s += "1/4";
                        else if (dv == 0.5)
                            s += "1/2";
                        else if (dv == 0.75)
                            s += "3/4";

                        canvas.Font = res.GraceFont;
                        //var size = canvas.MeasureText(s);
                        var sy = up
                                    ? pt2Y - res.GraceFont.Size - textOffset
                                    : pt2Y + textOffset;
                        var sx = pt2X;
                        canvas.FillText(s, sx, sy);

                    }
                }
                canvas.Stroke();
            }
            canvas.TextAlign = old;
        }
Exemplo n.º 46
0
        private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            var beat = h.Beats[0];

            var isGrace = beat.GraceType != GraceType.None;
            var scaleMod = isGrace ? NoteHeadGlyph.GraceScale : 1;

            //
            // draw line
            //

            var stemSize = GetFooterStemSize(h.ShortestDuration);

            var beatLineX = h.GetBeatLineX(beat) + Scale;

            var direction = h.Direction;

            var topY = GetScoreY(GetNoteLine(beat.MaxNote));
            var bottomY = GetScoreY(GetNoteLine(beat.MinNote));
            float beamY;
            float fingeringY;
            if (direction == BeamDirection.Down)
            {
                bottomY += stemSize * scaleMod;
                beamY = bottomY;
                fingeringY = cy + Y + bottomY;
            }
            else
            {
                topY -= stemSize * scaleMod;
                beamY = topY;
                fingeringY = cy + Y + topY;
            }

            PaintFingering(canvas, beat, cx + X + beatLineX, direction, fingeringY);

            if (beat.Duration == Duration.Whole || beat.Duration == Duration.DoubleWhole)
            {
                return;
            }

            canvas.BeginPath();
            canvas.MoveTo(cx + X + beatLineX, cy + Y + topY);
            canvas.LineTo(cx + X + beatLineX, cy + Y + bottomY);
            canvas.Stroke();

            if (isGrace)
            {
                var graceSizeY = 15 * Scale;
                var graceSizeX = 12 * Scale;

                canvas.BeginPath();
                if (direction == BeamDirection.Down)
                {
                    canvas.MoveTo(cx + X + beatLineX - (graceSizeX / 2), cy + Y + bottomY - graceSizeY);
                    canvas.LineTo(cx + X + beatLineX + (graceSizeX / 2), cy + Y + bottomY);
                }
                else
                {
                    canvas.MoveTo(cx + X + beatLineX - (graceSizeX / 2), cy + Y + topY + graceSizeY);
                    canvas.LineTo(cx + X + beatLineX + (graceSizeX / 2), cy + Y + topY);
                }
                canvas.Stroke();
            }

            //
            // Draw beam
            //
            if (beat.Duration > Duration.Quarter)
            {
                var glyph = new BeamGlyph(beatLineX - Scale / 2f, beamY, beat.Duration, direction, isGrace);
                glyph.Renderer = this;
                glyph.DoLayout();
                glyph.Paint(cx + X, cy + Y, canvas);
            }
        }
Exemplo n.º 47
0
        private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            for (int i = 0, j = h.Beats.Count; i < j; i++)
            {
                var beat = h.Beats[i];

                //
                // draw line
                //
                var beatLineX = h.GetBeatLineX(beat) + Scale;

                var direction = h.Direction;

                var y1 = cy + Y + (direction == BeamDirection.Up
                            ? GetScoreY(GetNoteLine(beat.MinNote))
                            : GetScoreY(GetNoteLine(beat.MaxNote)));

                var y2 = cy + Y + CalculateBeamY(h, beatLineX);

                canvas.BeginPath();
                canvas.MoveTo(cx + X + beatLineX, y1);
                canvas.LineTo(cx + X + beatLineX, y2);
                canvas.Stroke();

                float fingeringY = y2;
                if (direction == BeamDirection.Down)
                {
                    fingeringY += canvas.Font.Size * 2f;
                }
                else if (i != 0)
                {
                    fingeringY -= canvas.Font.Size * 1.5f;
                }
                PaintFingering(canvas, beat, cx + X + beatLineX, direction, fingeringY);

                var brokenBarOffset = 6 * Scale;
                var barSpacing = 6 * Scale;
                var barSize = 3 * Scale;
                var barCount = beat.Duration.GetIndex() - 2;
                var barStart = cy + Y;
                if (direction == BeamDirection.Down)
                {
                    barSpacing = -barSpacing;
                    barSize = -barSize;
                }

                for (var barIndex = 0; barIndex < barCount; barIndex++)
                {
                    float barStartX;
                    float barEndX;

                    float barStartY;
                    float barEndY;

                    var barY = barStart + (barIndex * barSpacing);

                    //
                    // Bar to Next?
                    //
                    if (i < h.Beats.Count - 1)
                    {
                        // full bar?
                        if (IsFullBarJoin(beat, h.Beats[i + 1], barIndex))
                        {
                            barStartX = beatLineX;
                            barEndX = h.GetBeatLineX(h.Beats[i + 1]) + Scale;
                        }
                        // broken bar?
                        else if (i == 0 || !IsFullBarJoin(h.Beats[i - 1], beat, barIndex))
                        {
                            barStartX = beatLineX;
                            barEndX = barStartX + brokenBarOffset;
                        }
                        else
                        {
                            continue;
                        }
                        barStartY = barY + CalculateBeamY(h, barStartX);
                        barEndY = barY + CalculateBeamY(h, barEndX);
                        PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                    }
                    //
                    // Broken Bar to Previous?
                    //
                    else if (i > 0 && !IsFullBarJoin(beat, h.Beats[i - 1], barIndex))
                    {
                        barStartX = beatLineX - brokenBarOffset;
                        barEndX = beatLineX;

                        barStartY = barY + CalculateBeamY(h, barStartX);
                        barEndY = barY + CalculateBeamY(h, barEndX);

                        PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                    }
                }
            }
        }
Exemplo n.º 48
0
        //private static readonly Random Random = new Random();
        protected override void PaintBackground(float cx, float cy, ICanvas canvas)
        {
            base.PaintBackground(cx, cy, canvas);

            var res = Resources;

            //var c = new Color((byte)Std.Random(255),
            //                  (byte)Std.Random(255),
            //                  (byte)Std.Random(255),
            //                  100);
            //canvas.Color = c;
            //canvas.FillRect(cx + X, cy + Y, Width, Height);

            //
            // draw string lines
            //
            canvas.Color = res.StaveLineColor;
            var lineY = cy + Y + TopPadding;

            for (var i = 0; i < 5; i++)
            {
                if (i > 0) lineY += LineOffset;
                canvas.BeginPath();
                canvas.MoveTo(cx + X, (int)lineY);
                canvas.LineTo(cx + X + Width, (int)lineY);
                canvas.Stroke();
            }

            canvas.Color = res.MainGlyphColor;
        }
Exemplo n.º 49
0
        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();
        }
Exemplo n.º 50
0
        private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            var beat = h.Beats[0];

            if (beat.Duration == Duration.Whole)
            {
                return;
            }

            var isGrace  = beat.GraceType != GraceType.None;
            var scaleMod = isGrace ? NoteHeadGlyph.GraceScale : 1;

            //
            // draw line
            //

            var stemSize = GetStemSize(h.MaxDuration);

            var correction = ((NoteHeadGlyph.NoteHeadHeight * scaleMod) / 2);
            var beatLineX  = h.GetBeatLineX(beat) + Scale;

            var direction = h.Direction;

            var topY    = GetScoreY(GetNoteLine(beat.MaxNote), correction);
            var bottomY = GetScoreY(GetNoteLine(beat.MinNote), correction);

            float beamY;

            if (direction == BeamDirection.Down)
            {
                bottomY += stemSize * scaleMod;
                beamY    = bottomY;
            }
            else
            {
                topY -= stemSize * scaleMod;
                beamY = topY;
            }

            canvas.BeginPath();
            canvas.MoveTo(cx + X + beatLineX, cy + Y + topY);
            canvas.LineTo(cx + X + beatLineX, cy + Y + bottomY);
            canvas.Stroke();

            if (isGrace)
            {
                var graceSizeY = 15 * Scale;
                var graceSizeX = 12 * Scale;


                canvas.BeginPath();
                if (direction == BeamDirection.Down)
                {
                    canvas.MoveTo(cx + X + beatLineX - (graceSizeX / 2), cy + Y + bottomY - graceSizeY);
                    canvas.LineTo(cx + X + beatLineX + (graceSizeX / 2), cy + Y + bottomY);
                }
                else
                {
                    canvas.MoveTo(cx + X + beatLineX - (graceSizeX / 2), cy + Y + topY + graceSizeY);
                    canvas.LineTo(cx + X + beatLineX + (graceSizeX / 2), cy + Y + topY);
                }
                canvas.Stroke();
            }

            //
            // Draw beam
            //
            if (beat.Duration > Duration.Quarter)
            {
                var glyph = new BeamGlyph(beatLineX, beamY, beat.Duration, direction, isGrace);
                glyph.Renderer = this;
                glyph.DoLayout();
                glyph.Paint(cx + X, cy + Y, canvas);
            }
        }
Exemplo n.º 51
0
        private void PaintBend(BendPoint firstPt, BendPoint secondPt, float cx, float cy, float dX, ICanvas canvas)
        {
            var r = (TabBarRenderer)Renderer;
            var res = Renderer.Resources;

            var overflowOffset = r.LineOffset / 2;

            var x1 = cx + (dX * firstPt.Offset);
            var y1 = cy - (_bendValueHeight * firstPt.Value);
            if (firstPt.Value == 0)
            {
                y1 += r.GetNoteY(_note);
            }
            else
            {
                y1 += overflowOffset;
            }
            var x2 = cx + (dX * secondPt.Offset);
            var y2 = cy - (_bendValueHeight * secondPt.Value);
            if (secondPt.Value == 0)
            {
                y2 += r.GetNoteY(_note);
            }
            else
            {
                y2 += overflowOffset;
            }

            // what type of arrow? (up/down)
            var arrowOffset = 0f;
            var arrowSize = 6 * Scale;
            if (secondPt.Value > firstPt.Value)
            {
                canvas.BeginPath();
                canvas.MoveTo(x2, y2);
                canvas.LineTo(x2 - arrowSize * 0.5f, y2 + arrowSize);
                canvas.LineTo(x2 + arrowSize * 0.5f, y2 + arrowSize);
                canvas.ClosePath();
                canvas.Fill();
                arrowOffset = arrowSize;
            }
            else if (secondPt.Value != firstPt.Value)
            {
                canvas.BeginPath();
                canvas.MoveTo(x2, y2);
                canvas.LineTo(x2 - arrowSize * 0.5f, y2 - arrowSize);
                canvas.LineTo(x2 + arrowSize * 0.5f, y2 - arrowSize);
                canvas.ClosePath();
                canvas.Fill();
                arrowOffset = -arrowSize;
            }
            canvas.Stroke();

            if (firstPt.Value == secondPt.Value)
            {
                // draw horizontal line
                canvas.MoveTo(x1, y1);
                canvas.LineTo(x2, y2);
                canvas.Stroke();
            }
            else
            {
                if (x2 > x1)
                {
                    // draw bezier lien from first to second point
                    canvas.MoveTo(x1, y1);
                    canvas.BezierCurveTo(x2, y1, x2, y2 + arrowOffset, x2, y2 + arrowOffset);
                    canvas.Stroke();
                }
                else
                {
                    canvas.MoveTo(x1, y1);
                    canvas.LineTo(x2, y2);
                    canvas.Stroke();
                }
            }

            if (secondPt.Value != 0)
            {
                var dV = secondPt.Value;
                var up = secondPt.Value > firstPt.Value;
                dV = Math.Abs(dV);

                // calculate label
                var s = "";
                // Full Steps
                if (dV == 4 && up)
                {
                    s = "full";
                    dV -= 4;
                }
                else if (dV >= 4)
                {
                    int steps = dV / 4;
                    s += steps;
                    // Quaters
                    dV -= steps * 4;
                }

                if (dV > 0)
                {
                    s += GetFractionSign(dV);
                }

                if (s != "")
                {
                    if (!up)
                    {
                        s = "-" + s;
                    }

                    // draw label
                    canvas.Font = res.TablatureFont;
                    var size = canvas.MeasureText(s);
                    var y = up ? y2 - res.TablatureFont.Size - (2 * Scale) : y2 + (2 * Scale);
                    var x = x2 - size / 2;

                    canvas.FillText(s, x, y);
                }
            }
        }
Exemplo n.º 52
0
        private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            for (int i = 0, j = h.Beats.Count; i < j; i++)
            {
                var beat = h.Beats[i];

                if (h.HasBeatLineX(beat))
                {
                    //
                    // draw line
                    //
                    var beatLineX = h.GetBeatLineX(beat);
                    var y1        = cy + Y;
                    var y2        = cy + Y + Height;

                    var startGlyph = (TabBeatGlyph)GetOnNotesGlyphForBeat(beat);
                    if (startGlyph.NoteNumbers == null)
                    {
                        y1 += Height - RhythmHeight;
                    }
                    else
                    {
                        y1 += startGlyph.NoteNumbers.GetNoteY(startGlyph.NoteNumbers.MinStringNote) + LineOffset / 2;
                    }

                    if (h.Direction == BeamDirection.Up)
                    {
                        beatLineX -= startGlyph.Width / 2f;
                    }
                    else
                    {
                        beatLineX += startGlyph.Width / 2f;
                    }

                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + beatLineX, y1);
                    canvas.LineTo(cx + X + beatLineX, y2);
                    canvas.Stroke();

                    var brokenBarOffset = (6 * Scale);
                    var barSpacing      = (6 * Scale);
                    var barSize         = (3 * Scale);
                    var barCount        = beat.Duration.GetIndex() - 2;
                    var barStart        = cy + Y;
                    barSpacing = -barSpacing;
                    barStart  += Height;

                    for (int barIndex = 0; barIndex < barCount; barIndex++)
                    {
                        float barStartX;
                        float barEndX;

                        float barStartY;
                        float barEndY;

                        var barY = barStart + (barIndex * barSpacing);

                        //
                        // Broken Bar to Next
                        //
                        if (h.Beats.Count == 1)
                        {
                            barStartX = beatLineX;
                            barEndX   = beatLineX + brokenBarOffset;
                            barStartY = barY;
                            barEndY   = barY;
                            PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                        }
                        //
                        // Bar to Next?
                        //
                        else if (i < h.Beats.Count - 1)
                        {
                            // full bar?
                            if (BeamingHelper.IsFullBarJoin(beat, h.Beats[i + 1], barIndex))
                            {
                                barStartX = beatLineX;
                                barEndX   = h.GetBeatLineX(h.Beats[i + 1]) + Scale;

                                var endGlyph = GetOnNotesGlyphForBeat(h.Beats[i + 1]);
                                if (h.Direction == BeamDirection.Up)
                                {
                                    barEndX -= endGlyph.Width / 2f;
                                }
                                else
                                {
                                    barEndX += endGlyph.Width / 2f;
                                }
                            }
                            // broken bar?
                            else if (i == 0 || !BeamingHelper.IsFullBarJoin(h.Beats[i - 1], beat, barIndex))
                            {
                                barStartX = beatLineX;
                                barEndX   = barStartX + brokenBarOffset;
                            }
                            else
                            {
                                continue;
                            }
                            barStartY = barY;
                            barEndY   = barY;
                            PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                        }
                        //
                        // Broken Bar to Previous?
                        //
                        else if (i > 0 && !BeamingHelper.IsFullBarJoin(beat, h.Beats[i - 1], barIndex))
                        {
                            barStartX = beatLineX - brokenBarOffset;
                            barEndX   = beatLineX;

                            barStartY = barY;
                            barEndY   = barY;

                            PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize);
                        }
                    }
                }
            }
        }
Exemplo n.º 53
0
        public override void Paint(float cx, float cy, ICanvas canvas)
        {
            var r = (TabBarRenderer)Renderer;
            var res = Renderer.Resources;
            // calculate offsets per step
            var dX = Width / BendPoint.MaxPosition;
            var maxValue = 0;
            for (int i = 0, j = _note.BendPoints.Count; i < j; i++)
            {
                if (_note.BendPoints[i].Value > maxValue)
                {
                    maxValue = _note.BendPoints[i].Value;
                }
            }

            var dY = maxValue == 0 ? 0 : _height / maxValue;

            var xx = cx + X;
            var yy = cy + Y + r.GetNoteY(_note);

            canvas.BeginPath();
            for (int i = 0, j = _note.BendPoints.Count - 1; i < j; i++)
            {
                var firstPt = _note.BendPoints[i];
                var secondPt = _note.BendPoints[i + 1];

                // don't draw a line if there's no offset and it's the last point
                if (firstPt.Value == secondPt.Value && i == _note.BendPoints.Count - 2) continue;

                var x1 = xx + (dX * firstPt.Offset);
                var y1 = yy - (dY * firstPt.Value);
                var x2 = xx + (dX * secondPt.Offset);
                var y2 = yy - (dY * secondPt.Value);

                if (firstPt.Value == secondPt.Value)
                {
                    // draw horizontal line
                    canvas.MoveTo(x1, y1);
                    canvas.LineTo(x2, y2);
                    canvas.Stroke();
                }
                else
                {
                    // draw bezier lien from first to second point
                    var hx = x1 + (x2 - x1);
                    var hy = yy - (dY * firstPt.Value);
                    canvas.MoveTo(x1, y1);
                    canvas.BezierCurveTo(hx, hy, x2, y2, x2, y2);
                    canvas.Stroke();
                }

                // what type of arrow? (up/down)
                var arrowSize = 6 * Scale;
                if (secondPt.Value > firstPt.Value)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(x2, y2);
                    canvas.LineTo(x2 - arrowSize * 0.5f, y2 + arrowSize);
                    canvas.LineTo(x2 + arrowSize * 0.5f, y2 + arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                else if (secondPt.Value != firstPt.Value)
                {
                    canvas.BeginPath();
                    canvas.MoveTo(x2, y2);
                    canvas.LineTo(x2 - arrowSize * 0.5f, y2 - arrowSize);
                    canvas.LineTo(x2 + arrowSize * 0.5f, y2 - arrowSize);
                    canvas.ClosePath();
                    canvas.Fill();
                }
                canvas.Stroke();

                if (secondPt.Value != 0)
                {
                    var dV = (secondPt.Value - firstPt.Value);
                    var up = dV > 0;
                    dV = Math.Abs(dV);

                    // calculate label
                    var s = "";
                    // Full Steps
                    if (dV == 4)
                    {
                        s = "full";
                        dV -= 4;
                    }
                    else if (dV > 4)
                    {
                        s += dV / 4 + " ";
                        // Quaters
                        dV -= dV / 4;
                    }

                    if (dV > 0)
                    {
                        s += dV + "/4";
                    }

                    if (s != "")
                    {
                        if (!up)
                        {
                            s = "-" + s;
                        }

                        // draw label
                        canvas.Font = res.TablatureFont;
                        var size = canvas.MeasureText(s);
                        var y = up ? y2 - res.TablatureFont.Size - (2 * Scale) : y2 + (2 * Scale);
                        var x = x2 - size / 2;

                        canvas.FillText(s, x, y);
                    }
                }
            }
        }
Exemplo n.º 54
0
        protected override void PaintBackground(float cx, float cy, ICanvas canvas)
        {
            base.PaintBackground(cx, cy, canvas);

            var res = Resources;

            //
            // draw string lines
            //
            canvas.Color = res.StaveLineColor;
            var lineY = cy + Y + TopPadding;

            for (int i = 0, j = Bar.Staff.Track.Tuning.Length; i < j; i++)
            {
                if (i > 0) lineY += LineOffset;
                canvas.BeginPath();
                canvas.MoveTo(cx + X, (int)lineY);
                canvas.LineTo(cx + X + Width, (int)lineY);
                canvas.Stroke();
            }

            canvas.Color = res.MainGlyphColor;

            // Info guides for debugging

            //DrawInfoGuide(canvas, cx, cy, 0, new Color(255, 0, 0)); // top
            //DrawInfoGuide(canvas, cx, cy, stave.StaveTop, new Color(0, 255, 0)); // stavetop
            //DrawInfoGuide(canvas, cx, cy, stave.StaveBottom, new Color(0,255,0)); // stavebottom
            //DrawInfoGuide(canvas, cx, cy, Height, new Color(255, 0, 0)); // bottom
        }
Exemplo n.º 55
0
        private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletHelper h)
        {
            var res = Resources;
            var oldAlign = canvas.TextAlign;
            canvas.TextAlign = TextAlign.Center;
            // check if we need to paint simple footer
            if (h.Beats.Count == 1 || !h.IsFull)
            {
                for (int i = 0, j = h.Beats.Count; i < j; i++)
                {
                    var beat = h.Beats[i];
                    var beamingHelper = Helpers.BeamHelperLookup[h.VoiceIndex][beat.Index];
                    if (beamingHelper == null) continue;
                    var direction = beamingHelper.Direction;

                    var tupletX = beamingHelper.GetBeatLineX(beat) + Scale;
                    var tupletY = cy + Y + CalculateBeamY(beamingHelper, tupletX);

                    var offset = direction == BeamDirection.Up
                                ? res.EffectFont.Size * 1.8f
                                : -3 * Scale;

                    canvas.Font = res.EffectFont;
                    canvas.FillText(h.Tuplet.ToString(), cx + X + tupletX, tupletY - offset);
                }
            }
            else
            {
                var firstBeat = h.Beats[0];
                var lastBeat = h.Beats[h.Beats.Count - 1];

                var firstBeamingHelper = Helpers.BeamHelperLookup[h.VoiceIndex][firstBeat.Index];
                var lastBeamingHelper = Helpers.BeamHelperLookup[h.VoiceIndex][lastBeat.Index];
                if (firstBeamingHelper != null && lastBeamingHelper != null)
                {
                    var direction = firstBeamingHelper.Direction;

                    //
                    // Calculate the overall area of the tuplet bracket

                    var startX = firstBeamingHelper.GetBeatLineX(firstBeat) + Scale;
                    var endX = lastBeamingHelper.GetBeatLineX(lastBeat) + Scale;

                    //
                    // Calculate how many space the text will need
                    canvas.Font = res.EffectFont;
                    var s = h.Tuplet.ToString();
                    var sw = canvas.MeasureText(s);
                    var sp = 3 * Scale;

                    //
                    // Calculate the offsets where to break the bracket
                    var middleX = (startX + endX) / 2;
                    var offset1X = middleX - sw / 2 - sp;
                    var offset2X = middleX + sw / 2 + sp;

                    //
                    // calculate the y positions for our bracket

                    var startY = CalculateBeamY(firstBeamingHelper, startX);
                    var offset1Y = CalculateBeamY(firstBeamingHelper, offset1X);
                    var middleY = CalculateBeamY(firstBeamingHelper, middleX);
                    var offset2Y = CalculateBeamY(lastBeamingHelper, offset2X);
                    var endY = CalculateBeamY(lastBeamingHelper, endX);

                    var offset = 10 * Scale;
                    var size = 5 * Scale;
                    if (direction == BeamDirection.Down)
                    {
                        offset *= -1;
                        size *= -1;
                    }

                    //
                    // draw the bracket
                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + startX, (int)(cy + Y + startY - offset));
                    canvas.LineTo(cx + X + startX, (int)(cy + Y + startY - offset - size));
                    canvas.LineTo(cx + X + offset1X, (int)(cy + Y + offset1Y - offset - size));
                    canvas.Stroke();

                    canvas.BeginPath();
                    canvas.MoveTo(cx + X + offset2X, (int)(cy + Y + offset2Y - offset - size));
                    canvas.LineTo(cx + X + endX, (int)(cy + Y + endY - offset - size));
                    canvas.LineTo(cx + X + endX, (int)(cy + Y + endY - offset));
                    canvas.Stroke();

                    //
                    // Draw the string
                    canvas.FillText(s, cx + X + middleX, cy + Y + middleY - offset - size - res.EffectFont.Size);
                }
            }
            canvas.TextAlign = oldAlign;
        }
Exemplo n.º 56
0
        public void Paint(float cx, float cy, ICanvas canvas)
        {
            for (int i = 0, j = _allStaves.Count; i < j; i++)
            {
                _allStaves[i].Paint(cx + X, cy + Y, canvas);
            }

            var res = Layout.Renderer.RenderingResources;

            if (Staves.Count > 0)
            {
                //
                // Draw start grouping
                //

                if (_firstStaveInAccolade != null && _lastStaveInAccolade != null)
                {
                    //
                    // draw grouping line for all staves
                    //

                    var firstStart = cy + Y + _firstStaveInAccolade.Y + _firstStaveInAccolade.StaveTop + _firstStaveInAccolade.TopSpacing + _firstStaveInAccolade.TopOverflow;
                    var lastEnd    = cy + Y + _lastStaveInAccolade.Y + _lastStaveInAccolade.TopSpacing + _lastStaveInAccolade.TopOverflow
                                     + _lastStaveInAccolade.StaveBottom;

                    var acooladeX = cx + X + _firstStaveInAccolade.X;

                    canvas.Color = res.BarSeperatorColor;

                    canvas.BeginPath();
                    canvas.MoveTo(acooladeX, firstStart);
                    canvas.LineTo(acooladeX, lastEnd);
                    canvas.Stroke();
                }

                //
                // Draw accolade for each track group
                //
                canvas.Font = res.EffectFont;
                for (int i = 0, j = Staves.Count; i < j; i++)
                {
                    var g          = Staves[i];
                    var firstStart = cy + Y + g.FirstStaveInAccolade.Y + g.FirstStaveInAccolade.StaveTop + g.FirstStaveInAccolade.TopSpacing + g.FirstStaveInAccolade.TopOverflow;
                    var lastEnd    = cy + Y + g.LastStaveInAccolade.Y + g.LastStaveInAccolade.TopSpacing + g.LastStaveInAccolade.TopOverflow
                                     + g.LastStaveInAccolade.StaveBottom;

                    var acooladeX = cx + X + g.FirstStaveInAccolade.X;

                    var barSize   = (3 * Layout.Renderer.Settings.Scale);
                    var barOffset = barSize;

                    var accoladeStart = firstStart - (barSize * 4);
                    var accoladeEnd   = lastEnd + (barSize * 4);

                    // text
                    if (Index == 0)
                    {
                        canvas.FillText(g.Track.ShortName, cx + X + (AccoladeLabelSpacing * Layout.Scale), firstStart);
                    }

                    // rect
                    canvas.FillRect(acooladeX - barOffset - barSize, accoladeStart, barSize, accoladeEnd - accoladeStart);

                    var spikeStartX = acooladeX - barOffset - barSize;
                    var spikeEndX   = acooladeX + barSize * 2;

                    // top spike
                    canvas.BeginPath();
                    canvas.MoveTo(spikeStartX, accoladeStart);
                    canvas.BezierCurveTo(spikeStartX, accoladeStart, spikeStartX, accoladeStart, spikeEndX, accoladeStart - barSize);
                    canvas.BezierCurveTo(acooladeX, accoladeStart + barSize, spikeStartX, accoladeStart + barSize, spikeStartX, accoladeStart + barSize);
                    canvas.ClosePath();
                    canvas.Fill();

                    // bottom spike
                    canvas.BeginPath();
                    canvas.MoveTo(spikeStartX, accoladeEnd);
                    canvas.BezierCurveTo(spikeStartX, accoladeEnd, acooladeX, accoladeEnd, spikeEndX, accoladeEnd + barSize);
                    canvas.BezierCurveTo(acooladeX, accoladeEnd - barSize, spikeStartX, accoladeEnd - barSize, spikeStartX, accoladeEnd - barSize);
                    canvas.ClosePath();

                    canvas.Fill();
                }
            }
        }
Exemplo n.º 57
0
        public void Paint(float cx, float cy, ICanvas canvas)
        {
            for (int i = 0, j = _allStaves.Count; i < j; i++)
            {
                _allStaves[i].Paint(cx + X, cy + Y, canvas);
            }

            var res = Layout.Renderer.RenderingResources;

            if (Staves.Count > 0)
            {
                //
                // Draw start grouping
                //

                if (_firstStaveInAccolade != null && _lastStaveInAccolade != null)
                {
                    //
                    // draw grouping line for all staves
                    //

                    var firstStart = cy + Y + _firstStaveInAccolade.Y + _firstStaveInAccolade.StaveTop + _firstStaveInAccolade.TopSpacing + _firstStaveInAccolade.TopOverflow;
                    var lastEnd = cy + Y + _lastStaveInAccolade.Y + _lastStaveInAccolade.TopSpacing + _lastStaveInAccolade.TopOverflow
                                         + _lastStaveInAccolade.StaveBottom;

                    var acooladeX = cx + X + _firstStaveInAccolade.X;

                    canvas.Color = res.BarSeperatorColor;

                    canvas.BeginPath();
                    canvas.MoveTo(acooladeX, firstStart);
                    canvas.LineTo(acooladeX, lastEnd);
                    canvas.Stroke();
                }

                //
                // Draw accolade for each track group
                //
                canvas.Font = res.EffectFont;
                for (int i = 0, j = Staves.Count; i < j; i++)
                {
                    var g = Staves[i];
                    var firstStart = cy + Y + g.FirstStaveInAccolade.Y + g.FirstStaveInAccolade.StaveTop + g.FirstStaveInAccolade.TopSpacing + g.FirstStaveInAccolade.TopOverflow;
                    var lastEnd = cy + Y + g.LastStaveInAccolade.Y + g.LastStaveInAccolade.TopSpacing + g.LastStaveInAccolade.TopOverflow
                                         + g.LastStaveInAccolade.StaveBottom;

                    var acooladeX = cx + X + g.FirstStaveInAccolade.X;

                    var barSize = (3 * Layout.Renderer.Settings.Scale);
                    var barOffset = barSize;

                    var accoladeStart = firstStart - (barSize * 4);
                    var accoladeEnd = lastEnd + (barSize * 4);

                    // text
                    if (Index == 0)
                    {
                        canvas.FillText(g.Track.ShortName, cx + X + (AccoladeLabelSpacing * Layout.Scale), firstStart);
                    }

                    // rect
                    canvas.FillRect(acooladeX - barOffset - barSize, accoladeStart, barSize, accoladeEnd - accoladeStart);

                    var spikeStartX = acooladeX - barOffset - barSize;
                    var spikeEndX = acooladeX + barSize * 2;

                    // top spike
                    canvas.BeginPath();
                    canvas.MoveTo(spikeStartX, accoladeStart);
                    canvas.BezierCurveTo(spikeStartX, accoladeStart, spikeStartX, accoladeStart, spikeEndX, accoladeStart - barSize);
                    canvas.BezierCurveTo(acooladeX, accoladeStart + barSize, spikeStartX, accoladeStart + barSize, spikeStartX, accoladeStart + barSize);
                    canvas.ClosePath();
                    canvas.Fill();

                    // bottom spike
                    canvas.BeginPath();
                    canvas.MoveTo(spikeStartX, accoladeEnd);
                    canvas.BezierCurveTo(spikeStartX, accoladeEnd, acooladeX, accoladeEnd, spikeEndX, accoladeEnd + barSize);
                    canvas.BezierCurveTo(acooladeX, accoladeEnd - barSize, spikeStartX, accoladeEnd - barSize, spikeStartX, accoladeEnd - barSize);
                    canvas.ClosePath();

                    canvas.Fill();
                }
            }
        }
Exemplo n.º 58
0
        private void RenderTriplet(float cx, float cy, ICanvas canvas)
        {
            cy += 2*Scale;
            var font = Renderer.Resources.EffectFont;
            canvas.Font = new Font(font.Family, font.Size * 0.8f, font.Style);

            var rightX = cx + NoteSeparation * Scale + 3 * Scale;

            canvas.BeginPath();
            canvas.MoveTo(cx, cy + (3 * Scale));
            canvas.LineTo(cx, cy);
            canvas.LineTo(cx + (5 * Scale), cy);

            canvas.MoveTo(rightX + (5 * Scale), cy + (3 * Scale));
            canvas.LineTo(rightX + (5 * Scale), cy);
            canvas.LineTo(rightX, cy);

            canvas.Stroke();

            canvas.FillText("3", cx + (7 * Scale), cy - (10 * Scale));

            canvas.Font = font;
        }