Esempio n. 1
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);
        }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h)
        {
            var beat = h.Beats[0];

            if (beat.GraceType == GraceType.BendGrace || (beat.GraceType != GraceType.None && Settings.DisplayMode == DisplayMode.SongBook))
            {
                return;
            }

            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    = GetYPositionForNoteValue(h.MaxNoteValue);
            var   bottomY = GetYPositionForNoteValue(h.MinNoteValue);
            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 || beat.Duration == Duration.QuadrupleWhole)
            {
                return;
            }

            canvas.LineWidth = StemWidth * Scale;
            canvas.BeginPath();
            canvas.MoveTo(cx + X + beatLineX, cy + Y + topY);
            canvas.LineTo(cx + X + beatLineX, cy + Y + bottomY);
            canvas.Stroke();
            canvas.LineWidth = Scale;

            if (beat.GraceType == GraceType.BeforeBeat)
            {
                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 || isGrace)
            {
                var glyph = new BeamGlyph(beatLineX - Scale / 2f, beamY, beat.Duration, direction, isGrace);
                glyph.Renderer = this;
                glyph.DoLayout();
                glyph.Paint(cx + X, cy + Y, canvas);
            }
        }