Example #1
0
        public RestMetrics(Graphics graphics, RestSymbol rest, float gap, int numberOfStafflines, float ledgerlineStrokeWidth)
            : base(rest.DurationClass, true, rest.FontHeight)
        {
            float dy = 0;

            if (numberOfStafflines > 1)
            {
                dy = gap * (numberOfStafflines / 2);
            }

            _top            = _top + dy;
            _bottom        += dy;
            _originY       += dy;          // the staffline on which the rest is aligned
            _ledgerlineStub = gap * 0.75F;
            Move((Left - Right) / 2F, 0F); // centre the glyph horizontally
            switch (rest.DurationClass)
            {
            case DurationClass.breve:
            case DurationClass.semibreve:
                Move(gap * -0.25F, 0F);
                if (numberOfStafflines == 1)
                {
                    Move(0F, gap);
                }
                _ledgerline = new LedgerlineBlockMetrics(Left - _ledgerlineStub, Right + _ledgerlineStub, ledgerlineStrokeWidth);
                _ledgerline.AddLedgerline(_originY - gap, 0F);
                _ledgerline.Move(gap * 0.17F, 0F);
                _top -= (gap * 1.5F);
                break;

            case DurationClass.minim:
                Move(gap * 0.18F, 0);
                _ledgerline = new LedgerlineBlockMetrics(Left - _ledgerlineStub, Right + _ledgerlineStub - (gap * 0.3F), ledgerlineStrokeWidth);
                _ledgerline.AddLedgerline(_originY, 0F);
                _bottom += (gap * 1.5F);
                break;

            case DurationClass.quaver:
                _top    -= gap * 0.5F;
                _bottom += gap * 0.5F;
                break;

            case DurationClass.semiquaver:
                _top    -= gap * 0.5F;
                _bottom += gap * 0.5F;
                break;

            case DurationClass.threeFlags:
                _top    -= gap * 0.5F;
                _right  += gap * 0.2F;
                _bottom += gap * 0.5F;
                _left   -= gap * 0.2F;
                break;

            case DurationClass.fourFlags:
                _top     -= gap * 0.5F;
                _right   += gap * 0.1F;
                _bottom  += gap * 1.25F;
                _left    -= gap * 0.1F;
                _originY += gap;
                break;

            case DurationClass.fiveFlags:
                _top     -= gap * 1.5F;
                _right   += gap * 0.2F;
                _bottom  += gap * 1.25F;
                _left    -= gap * 0.2F;
                _originY += gap;
                break;
            }
        }
Example #2
0
        public RestMetrics(Graphics graphics, RestSymbol rest, float gap, int numberOfStafflines, float ledgerlineStrokeWidth)
            : base(rest.DurationClass, true, rest.FontHeight)
        {
            float dy = 0;
            if(numberOfStafflines > 1)
                dy = gap * (numberOfStafflines / 2);

            _top = _top + dy;
            _bottom += dy;
            _originY += dy; // the staffline on which the rest is aligned
            _ledgerlineStub = gap * 0.75F;
            Move((Left - Right) / 2F, 0F); // centre the glyph horizontally
            switch(rest.DurationClass)
            {
                case DurationClass.breve:
                case DurationClass.semibreve:
                    Move(gap * -0.25F, 0F);
                    if(numberOfStafflines == 1)
                        Move(0F, gap);
                    _ledgerline = new LedgerlineBlockMetrics(Left - _ledgerlineStub, Right + _ledgerlineStub, ledgerlineStrokeWidth);
                    _ledgerline.AddLedgerline(_originY - gap, 0F);
                    _ledgerline.Move(gap * 0.17F, 0F);
                    _top -= (gap * 1.5F);
                    break;
                case DurationClass.minim:
                    Move(gap * 0.18F, 0);
                    _ledgerline = new LedgerlineBlockMetrics(Left - _ledgerlineStub, Right + _ledgerlineStub - (gap * 0.3F), ledgerlineStrokeWidth);
                    _ledgerline.AddLedgerline(_originY, 0F);
                    _bottom += (gap * 1.5F);
                    break;
                case DurationClass.quaver:
                    _top -= gap * 0.5F;
                    _bottom += gap * 0.5F;
                    break;
                case DurationClass.semiquaver:
                    _top -= gap * 0.5F;
                    _bottom += gap * 0.5F;
                    break;
                case DurationClass.threeFlags:
                    _top -= gap * 0.5F;
                    _right += gap * 0.2F;
                    _bottom += gap * 0.5F;
                    _left -= gap * 0.2F;
                    break;
                case DurationClass.fourFlags:
                    _top -= gap * 0.5F;
                    _right += gap * 0.1F;
                    _bottom += gap * 1.25F;
                    _left -= gap * 0.1F;
                    _originY += gap;
                    break;
                case DurationClass.fiveFlags:
                    _top -= gap * 1.5F;
                    _right += gap * 0.2F;
                    _bottom += gap * 1.25F;
                    _left -= gap * 0.2F;
                    _originY += gap;
                    break;
            }
        }
Example #3
0
        public RestMetrics(Graphics graphics, RestSymbol rest, double gap, int numberOfStafflines, double ledgerlineStrokeWidth)
            : base(rest.DurationClass, rest.FontHeight, CSSObjectClass.rest)
        {
            double dy = 0;

            if (numberOfStafflines > 1)
            {
                dy = gap * (numberOfStafflines / 2);
            }

            _top            = _top + dy;
            _bottom        += dy;
            _originY       += dy;         // the staffline on which the rest is aligned
            _ledgerlineStub = gap * 0.75;
            Move((Left - Right) / 2, 0F); // centre the glyph horizontally
            CSSObjectClass llBlockClass = CSSObjectClass.ledgerlines;

            switch (rest.DurationClass)
            {
            case DurationClass.breve:
            case DurationClass.semibreve:
                Move(gap * -0.25, 0F);
                if (numberOfStafflines == 1)
                {
                    Move(0, gap);
                }
                _ledgerlineBlockMetrics = new LedgerlineBlockMetrics(Left - _ledgerlineStub, Right + _ledgerlineStub, ledgerlineStrokeWidth, llBlockClass);
                _ledgerlineBlockMetrics.AddLedgerline(_originY - gap, 0F);
                _ledgerlineBlockMetrics.Move(gap * 0.17, 0F);
                _top -= (gap * 1.5F);
                break;

            case DurationClass.minim:
                Move(gap * 0.18, 0);
                _ledgerlineBlockMetrics = new LedgerlineBlockMetrics(Left - _ledgerlineStub, Right + _ledgerlineStub - (gap * 0.3F), ledgerlineStrokeWidth, llBlockClass);
                _ledgerlineBlockMetrics.AddLedgerline(_originY, 0F);
                _bottom += (gap * 1.5F);
                break;

            case DurationClass.quaver:
                _top    -= gap * 0.5;
                _bottom += gap * 0.5;
                break;

            case DurationClass.semiquaver:
                _top    -= gap * 0.5;
                _bottom += gap * 0.5;
                break;

            case DurationClass.threeFlags:
                _top    -= gap * 0.5;
                _right  += gap * 0.2;
                _bottom += gap * 0.5;
                _left   -= gap * 0.2;
                break;

            case DurationClass.fourFlags:
                _top     -= gap * 0.5;
                _right   += gap * 0.1;
                _bottom  += gap * 1.25;
                _left    -= gap * 0.1;
                _originY += gap;
                break;

            case DurationClass.fiveFlags:
                _top     -= gap * 1.5;
                _right   += gap * 0.2;
                _bottom  += gap * 1.25;
                _left    -= gap * 0.2;
                _originY += gap;
                break;
            }
        }