Exemple #1
0
        public virtual void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this.staves;
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.staves.Stave s = ((global::alphatab.rendering.staves.Stave)(_g1[_g]));
                        ++_g;
                        s.paint((cx + this.x), (cy + this.y), canvas);
                    }
                }

                global::alphatab.rendering.RenderingResources res = this.layout.renderer.renderingResources;
                if ((this.staves.length > 0))
                {
                    if (((this._firstStaveInAccolade != default(global::alphatab.rendering.staves.Stave)) && (this._lastStaveInAccolade != default(global::alphatab.rendering.staves.Stave))))
                    {
                        int firstStart = (((((cy + this.y) + this._firstStaveInAccolade.y) + this._firstStaveInAccolade.staveTop) + this._firstStaveInAccolade.topSpacing) + this._firstStaveInAccolade.getTopOverflow());
                        int lastEnd    = (((((cy + this.y) + this._lastStaveInAccolade.y) + this._lastStaveInAccolade.topSpacing) + this._lastStaveInAccolade.getTopOverflow()) + this._lastStaveInAccolade.staveBottom);
                        canvas.setColor(res.barSeperatorColor);
                        canvas.beginPath();
                        canvas.moveTo(((double)(((cx + this.x) + this._firstStaveInAccolade.x))), ((double)(firstStart)));
                        canvas.lineTo(((double)(((cx + this.x) + this._lastStaveInAccolade.x))), ((double)(lastEnd)));
                        canvas.stroke();
                        int barSize       = ((int)((3 * this.layout.renderer.settings.scale)));
                        int barOffset     = barSize;
                        int accoladeStart = (firstStart - (barSize * 4));
                        int accoladeEnd   = (lastEnd + (barSize * 4));
                        canvas.fillRect(((double)((((cx + this.x) - barOffset) - barSize))), ((double)(accoladeStart)), ((double)(barSize)), ((double)((accoladeEnd - accoladeStart))));
                        int spikeStartX = (((cx + this.x) - barOffset) - barSize);
                        int spikeEndX   = ((cx + this.x) + (barSize * 2));
                        canvas.beginPath();
                        canvas.moveTo(((double)(spikeStartX)), ((double)(accoladeStart)));
                        canvas.bezierCurveTo(((double)(spikeStartX)), ((double)(accoladeStart)), ((double)(this.x)), ((double)(accoladeStart)), ((double)(spikeEndX)), ((double)((accoladeStart - barSize))));
                        canvas.bezierCurveTo(((double)((cx + this.x))), ((double)((accoladeStart + barSize))), ((double)(spikeStartX)), ((double)((accoladeStart + barSize))), ((double)(spikeStartX)), ((double)((accoladeStart + barSize))));
                        canvas.closePath();
                        canvas.fill();
                        canvas.beginPath();
                        canvas.moveTo(((double)(spikeStartX)), ((double)(accoladeEnd)));
                        canvas.bezierCurveTo(((double)(spikeStartX)), ((double)(accoladeEnd)), ((double)(this.x)), ((double)(accoladeEnd)), ((double)(spikeEndX)), ((double)((accoladeEnd + barSize))));
                        canvas.bezierCurveTo(((double)(this.x)), ((double)((accoladeEnd - barSize))), ((double)(spikeStartX)), ((double)((accoladeEnd - barSize))), ((double)(spikeStartX)), ((double)((accoladeEnd - barSize))));
                        canvas.closePath();
                        canvas.fill();
                    }
                }
            }
        }
Exemple #2
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                if ((this._svg == default(global::alphatab.rendering.glyphs.LazySvg)))
                {
                    return;
                }

                this._xScale = (this._xGlyphScale * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
                this._yScale = (this._yGlyphScale * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
                global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                canvas.setColor(res.mainGlyphColor);
                int startX = (this.x + cx);
                int startY = (this.y + cy);
                this._currentX = ((double)(startX));
                this._currentY = ((double)(startY));
                canvas.setColor(new global::alphatab.platform.model.Color(((int)(0)), ((int)(0)), ((int)(0)), ((global::haxe.lang.Null <int>)(default(global::haxe.lang.Null <int>)))));
                canvas.beginPath();
                {
                    int _g = 0;
                    global::haxe.root.Array <object> _g1 = this._svg.@get();
                    while ((_g < _g1.length))
                    {
                        global::alphatab.rendering.glyphs.SvgCommand c = ((global::alphatab.rendering.glyphs.SvgCommand)(_g1[_g]));
                        ++_g;
                        this.parseCommand(startX, startY, canvas, c);
                    }
                }

                canvas.fill();
            }
        }
 public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
 {
     unchecked
     {
         global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
         canvas.setColor(res.mainGlyphColor);
         double blockWidth = (4 * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
         int    top        = ((cy + this.y) + this.renderer.getTopPadding());
         int    bottom     = (((cy + this.y) + this.renderer.height) - this.renderer.getBottomPadding());
         double left       = ((cx + this.x) + 0.5);
         int    h          = (bottom - top);
         canvas.fillRect(left, ((double)(top)), blockWidth, ((double)(h)));
         left += ((blockWidth * 2) - 0.5);
         canvas.beginPath();
         canvas.moveTo(left, ((double)(top)));
         canvas.lineTo(left, ((double)(bottom)));
         canvas.stroke();
         left += (3 * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
         double circleSize = (this._circleSize * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
         double middle     = (((double)(((top + bottom)))) / 2);
         canvas.beginPath();
         canvas.circle(left, (middle - (circleSize * this._dotOffset)), circleSize);
         canvas.circle(left, (middle + (circleSize * this._dotOffset)), circleSize);
         canvas.fill();
     }
 }
 public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
 {
     unchecked
     {
         canvas.beginPath();
         canvas.circle(((double)((cx + this.x))), ((double)((cy + this.y))), this._size);
         canvas.fill();
     }
 }
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                if (((this._endNote == default(global::alphatab.model.Note)) || (this._startNote.beat.index != this._endNote.beat.index)))
                {
                    return;
                }

                global::alphatab.rendering.TabBarRenderer r = ((global::alphatab.rendering.TabBarRenderer)(this.renderer));
                global::alphatab.rendering.glyphs.TabBeatContainerGlyph parent = ((global::alphatab.rendering.glyphs.TabBeatContainerGlyph)(this._parent));
                global::alphatab.rendering.RenderingResources           res    = r.stave.staveGroup.layout.renderer.renderingResources;
                int startX = (cx + r.getNoteX(this._startNote, default(global::haxe.lang.Null <bool>)));
                int endX   = default(int);
                if ((this._endNote == default(global::alphatab.model.Note)))
                {
                    endX = (((cx + parent.x) + parent.postNotes.x) + parent.postNotes.width);
                }
                else
                {
                    endX = (cx + r.getNoteX(this._endNote, new global::haxe.lang.Null <bool>(false, true)));
                }

                bool   down   = (this._startNote.@string > 3);
                double offset = (res.tablatureFont.getSize() / 2);
                if (down)
                {
                    offset *= ((double)(-1));
                }

                double startY = ((cy + r.getNoteY(this._startNote)) + offset);
                double endY   = default(double);
                if ((this._endNote == default(global::alphatab.model.Note)))
                {
                    endY = startY;
                }
                else
                {
                    endY = ((cy + r.getNoteY(this._endNote)) + offset);
                }

                global::alphatab.rendering.glyphs.TieGlyph.paintTie(canvas, this.renderer.stave.staveGroup.layout.renderer.settings.scale, ((double)(startX)), startY, ((double)(endX)), endY, new global::haxe.lang.Null <bool>((this._startNote.@string > 3), true));
                canvas.setColor(this.renderer.stave.staveGroup.layout.renderer.renderingResources.mainGlyphColor);
                canvas.fill();
            }
        }
Exemple #6
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                if (((this._endNote == default(global::alphatab.model.Note)) || (this._startNote.beat.index != this._endNote.beat.index)))
                {
                    return;
                }

                global::alphatab.rendering.ScoreBarRenderer          r      = ((global::alphatab.rendering.ScoreBarRenderer)(this.renderer));
                global::alphatab.rendering.glyphs.BeatContainerGlyph parent = ((global::alphatab.rendering.glyphs.BeatContainerGlyph)(this._parent));
                int startX = (cx + r.getNoteX(this._startNote, default(global::haxe.lang.Null <bool>)));
                int endX   = default(int);
                if ((this._endNote == default(global::alphatab.model.Note)))
                {
                    endX = (((cx + parent.x) + parent.postNotes.x) + parent.postNotes.width);
                }
                else
                {
                    endX = (cx + r.getNoteX(this._endNote, new global::haxe.lang.Null <bool>(false, true)));
                }

                double startY = ((cy + r.getNoteY(this._startNote)) + 4.5);
                double endY   = default(double);
                if ((this._endNote == default(global::alphatab.model.Note)))
                {
                    endY = startY;
                }
                else
                {
                    endY = ((cy + r.getNoteY(this._endNote)) + 4.5);
                }

                global::alphatab.rendering.glyphs.TieGlyph.paintTie(canvas, this.renderer.stave.staveGroup.layout.renderer.settings.scale, ((double)(startX)), startY, ((double)(endX)), endY, new global::haxe.lang.Null <bool>((r.getBeatDirection(this._startNote.beat) == global::alphatab.rendering.utils.BeamDirection.Down), true));
                canvas.setColor(this.renderer.stave.staveGroup.layout.renderer.renderingResources.mainGlyphColor);
                canvas.fill();
            }
        }
Exemple #7
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                global::alphatab.rendering.TabBarRenderer     tabBarRenderer = ((global::alphatab.rendering.TabBarRenderer)(this.renderer));
                global::alphatab.rendering.RenderingResources res            = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                int startY         = default(int);
                int __temp_stmt600 = default(int);
                {
                    double x = (tabBarRenderer.getNoteY(this._beat.maxNote()) - (res.tablatureFont.getSize() / 2));
                    __temp_stmt600 = ((int)(x));
                }

                startY = ((cy + this.y) + __temp_stmt600);
                double endY      = (((cy + this.y) + tabBarRenderer.getNoteY(this._beat.minNote())) + (res.tablatureFont.getSize() / 2));
                int    arrowX    = ((int)(((cx + this.x) + (((double)(this.width)) / 2))));
                double arrowSize = (8 * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
                canvas.setColor(res.mainGlyphColor);
                if ((this._beat.brushType != global::alphatab.model.BrushType.None))
                {
                    if (((this._beat.brushType == global::alphatab.model.BrushType.BrushUp) || (this._beat.brushType == global::alphatab.model.BrushType.BrushDown)))
                    {
                        canvas.beginPath();
                        canvas.moveTo(((double)(arrowX)), ((double)(startY)));
                        canvas.lineTo(((double)(arrowX)), endY);
                        canvas.stroke();
                    }
                    else
                    {
                        int size  = ((int)((15 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                        int steps = default(int);
                        {
                            double v = (global::System.Math.Abs(((double)((endY - startY)))) / size);
                            {
                                double x1 = global::System.Math.Floor(((double)(v)));
                                steps = ((int)(x1));
                            }
                        }

                        {
                            int _g = 0;
                            while ((_g < ((int)(steps))))
                            {
                                int i = _g++;
                                global::alphatab.rendering.glyphs.SvgGlyph arrow = new global::alphatab.rendering.glyphs.SvgGlyph(new global::haxe.lang.Null <int>(((int)((3 * this.renderer.stave.staveGroup.layout.renderer.settings.scale))), true), new global::haxe.lang.Null <int>(0, true), ((global::alphatab.rendering.glyphs.LazySvg)(global::alphatab.rendering.glyphs.MusicFont.WaveVertical)), ((double)(1)), ((double)(1)));
                                arrow.renderer = this.renderer;
                                arrow.doLayout();
                                arrow.paint((cx + this.x), (startY + (i * size)), canvas);
                            }
                        }
                    }

                    if (((this._beat.brushType == global::alphatab.model.BrushType.BrushUp) || (this._beat.brushType == global::alphatab.model.BrushType.ArpeggioUp)))
                    {
                        canvas.beginPath();
                        canvas.moveTo(((double)(arrowX)), endY);
                        canvas.lineTo(((double)(((int)((arrowX + (arrowSize / 2)))))), ((double)(((int)((endY - arrowSize))))));
                        canvas.lineTo(((double)(((int)((arrowX - (arrowSize / 2)))))), ((double)(((int)((endY - arrowSize))))));
                        canvas.closePath();
                        canvas.fill();
                    }
                    else
                    {
                        canvas.beginPath();
                        canvas.moveTo(((double)(arrowX)), ((double)(startY)));
                        canvas.lineTo(((double)(((int)((arrowX + (arrowSize / 2)))))), ((double)(((int)((startY + arrowSize))))));
                        canvas.lineTo(((double)(((int)((arrowX - (arrowSize / 2)))))), ((double)(((int)((startY + arrowSize))))));
                        canvas.closePath();
                        canvas.fill();
                    }
                }
            }
        }
Exemple #8
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                global::alphatab.rendering.TabBarRenderer     r   = ((global::alphatab.rendering.TabBarRenderer)(this.renderer));
                global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                double dX       = (((double)(this.width)) / 60);
                int    maxValue = 0;
                {
                    int _g1 = 0;
                    int _g  = this._note.bendPoints.length;
                    while ((_g1 < _g))
                    {
                        int i = _g1++;
                        if ((((global::alphatab.model.BendPoint)(this._note.bendPoints[i])).@value > maxValue))
                        {
                            maxValue = ((global::alphatab.model.BendPoint)(this._note.bendPoints[i])).@value;
                        }
                    }
                }

                double dY = (((double)(this._height)) / maxValue);
                int    xx = (cx + this.x);
                int    yy = ((cy + this.y) + r.getNoteY(this._note));
                canvas.beginPath();
                {
                    int _g11 = 0;
                    int _g2  = (this._note.bendPoints.length - 1);
                    while ((_g11 < _g2))
                    {
                        int i1 = _g11++;
                        global::alphatab.model.BendPoint firstPt  = ((global::alphatab.model.BendPoint)(this._note.bendPoints[i1]));
                        global::alphatab.model.BendPoint secondPt = ((global::alphatab.model.BendPoint)(this._note.bendPoints[(i1 + 1)]));
                        if (((firstPt.@value == secondPt.@value) && (i1 == (this._note.bendPoints.length - 2))))
                        {
                            continue;
                        }

                        double x1 = (xx + (dX * firstPt.offset));
                        double y1 = (yy - (dY * firstPt.@value));
                        double x2 = (xx + (dX * secondPt.offset));
                        double y2 = (yy - (dY * secondPt.@value));
                        if ((firstPt.@value == secondPt.@value))
                        {
                            canvas.moveTo(x1, y1);
                            canvas.lineTo(x2, y2);
                            canvas.stroke();
                        }
                        else
                        {
                            double hx = (x1 + ((x2 - x1)));
                            double hy = (yy - (dY * firstPt.@value));
                            canvas.moveTo(x1, y1);
                            canvas.bezierCurveTo(hx, hy, x2, y2, x2, y2);
                            canvas.stroke();
                        }

                        double arrowSize = (6 * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
                        if ((secondPt.@value > firstPt.@value))
                        {
                            canvas.beginPath();
                            canvas.moveTo(x2, y2);
                            canvas.lineTo((x2 - (arrowSize * 0.5)), (y2 + arrowSize));
                            canvas.lineTo((x2 + (arrowSize * 0.5)), (y2 + arrowSize));
                            canvas.closePath();
                            canvas.fill();
                        }
                        else
                        {
                            if ((secondPt.@value != firstPt.@value))
                            {
                                canvas.beginPath();
                                canvas.moveTo(x2, y2);
                                canvas.lineTo((x2 - (arrowSize * 0.5)), (y2 - arrowSize));
                                canvas.lineTo((x2 + (arrowSize * 0.5)), (y2 - arrowSize));
                                canvas.closePath();
                                canvas.fill();
                            }
                        }

                        canvas.stroke();
                        if ((secondPt.@value != 0))
                        {
                            double dV = ((double)((secondPt.@value - firstPt.@value)));
                            bool   up = (dV > 0);
                            dV = global::System.Math.Abs(((double)(dV)));
                            string s = "";
                            if ((dV == 4))
                            {
                                s   = "full";
                                dV -= ((double)(4));
                            }
                            else
                            {
                                if ((dV > 4))
                                {
                                    int __temp_stmt594 = default(int);
                                    {
                                        double x = global::System.Math.Floor(((double)((dV / 4))));
                                        __temp_stmt594 = ((int)(x));
                                    }

                                    string __temp_stmt593 = global::Std.@string(__temp_stmt594);
                                    string __temp_stmt592 = global::haxe.lang.Runtime.concat(__temp_stmt593, " ");
                                    s = global::haxe.lang.Runtime.concat(s, __temp_stmt592);
                                    {
                                        double x3 = global::System.Math.Floor(((double)(dV)));
                                        dV -= ((double)(((int)(x3))));
                                    }
                                }
                            }

                            if ((dV > 0))
                            {
                                s = global::haxe.lang.Runtime.concat(s, global::haxe.lang.Runtime.concat(global::Std.@string(dV), "/4"));
                            }

                            if (!(string.Equals(s, "")))
                            {
                                if (!(up))
                                {
                                    s = global::haxe.lang.Runtime.concat("-", s);
                                }

                                canvas.setFont(res.tablatureFont);
                                double size = canvas.measureText(s);
                                double y    = default(double);
                                if (up)
                                {
                                    y = ((y2 - res.tablatureFont.getSize()) - (2 * this.renderer.stave.staveGroup.layout.renderer.settings.scale));
                                }
                                else
                                {
                                    y = (y2 + (2 * this.renderer.stave.staveGroup.layout.renderer.settings.scale));
                                }

                                double x4 = (x2 - (size / 2));
                                canvas.fillText(s, x4, y);
                            }
                        }
                    }
                }
            }
        }