Ejemplo n.º 1
0
        public override void paint(int cx, int cy, global::alphatab.platform.ICanvas canvas)
        {
            unchecked
            {
                double step  = (11 * this.renderer.stave.staveGroup.layout.renderer.settings.scale);
                int    loops = default(int);
                {
                    double v = global::System.Math.Max(((double)(1)), ((double)((this.width / step))));
                    {
                        double x = global::System.Math.Floor(((double)(v)));
                        loops = ((int)(x));
                    }
                }

                global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources;
                canvas.setColor(res.mainGlyphColor);
                canvas.setFont(res.effectFont);
                canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Left);
                double textWidth = canvas.measureText(this._label);
                canvas.fillText(this._label, ((double)((cx + this.x))), ((double)((cy + this.y))));
                if (this._isExpanded)
                {
                    int    lineSpacing = ((int)((3 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                    double startX      = (((cx + this.x) + textWidth) + lineSpacing);
                    int    endX        = ((((cx + this.x) + this.width) - lineSpacing) - lineSpacing);
                    int    lineY       = ((cy + this.y) + ((int)((8 * this.renderer.stave.staveGroup.layout.renderer.settings.scale))));
                    int    lineSize    = ((int)((8 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                    if ((endX > startX))
                    {
                        double lineX = startX;
                        while ((lineX < endX))
                        {
                            canvas.beginPath();
                            canvas.moveTo(lineX, ((double)(lineY)));
                            int __temp_stmt606 = default(int);
                            {
                                double x1 = global::System.Math.Min(((double)((lineX + lineSize))), ((double)(endX)));
                                __temp_stmt606 = ((int)(x1));
                            }

                            canvas.lineTo(((double)(__temp_stmt606)), ((double)(lineY)));
                            lineX += ((double)((lineSize + lineSpacing)));
                            canvas.stroke();
                        }

                        canvas.beginPath();
                        canvas.moveTo(((double)(endX)), ((double)((lineY - ((int)((6 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)))))));
                        canvas.lineTo(((double)(endX)), ((double)((lineY + ((int)((6 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)))))));
                        canvas.stroke();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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);
                canvas.setFont(res.barNumberFont);
                string s = global::haxe.lang.Runtime.concat("x", global::Std.@string(this._count));
                int    w = default(int);
                {
                    double x = (canvas.measureText(s) / 1.5);
                    w = ((int)(x));
                }

                canvas.fillText(s, ((double)(((cx + this.x) - w))), ((double)((cy + this.y))));
            }
        }
Ejemplo n.º 3
0
        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.setFont(res.markerFont);
                canvas.setColor(res.mainGlyphColor);
                double textw = canvas.measureText("tr");
                canvas.fillText("tr", ((double)((cx + this.x))), ((double)((cy + this.y))));
                double startX = textw;
                double endX   = (this.width - startX);
                double step   = ((11 * this.renderer.stave.staveGroup.layout.renderer.settings.scale) * this._scale);
                int    loops  = default(int);
                {
                    double v = global::System.Math.Max(((double)(1)), ((double)((((endX - startX)) / step))));
                    {
                        double x = global::System.Math.Floor(((double)(v)));
                        loops = ((int)(x));
                    }
                }

                int loopX = ((int)(startX));
                {
                    int _g = 0;
                    while ((_g < loops))
                    {
                        int i = _g++;
                        global::alphatab.rendering.glyphs.SvgGlyph glyph = new global::alphatab.rendering.glyphs.SvgGlyph(new global::haxe.lang.Null <int>(loopX, true), new global::haxe.lang.Null <int>(0, true), ((global::alphatab.rendering.glyphs.LazySvg)(global::alphatab.rendering.glyphs.MusicFont.WaveHorizontal)), ((double)(this._scale)), ((double)(this._scale)));
                        glyph.renderer = this.renderer;
                        int __temp_stmt607 = default(int);
                        {
                            double x1 = (res.markerFont.getSize() / 2);
                            __temp_stmt607 = ((int)(x1));
                        }

                        glyph.paint((cx + this.x), ((cy + this.y) + __temp_stmt607), canvas);
                        {
                            double x2 = global::System.Math.Floor(((double)(step)));
                            loopX += ((int)(x2));
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
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);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
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;
                double startX = ((cx + this.x) + (((double)(this._parent.onNotes.width)) / 2));
                double endX   = default(double);
                if (((this._beat.nextBeat == default(global::alphatab.model.Beat)) || (this._beat.voice != this._beat.nextBeat.voice)))
                {
                    endX = (((cx + this.x) + (((double)(this._parent.onNotes.width)) / 2)) + this._parent.postNotes.width);
                }
                else
                {
                    endX = ((double)((cx + tabBarRenderer.getBeatX(this._beat.nextBeat))));
                }

                int startY     = (cy + this.y);
                int textOffset = ((int)((3 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                int sizeY      = ((int)((60 * this.renderer.stave.staveGroup.layout.renderer.settings.scale)));
                canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Center);
                if ((this._beat.whammyBarPoints.length >= 2))
                {
                    double dx = (((endX - startX)) / 60);
                    double dy = (((double)(sizeY)) / 24);
                    canvas.beginPath();
                    {
                        int _g1 = 0;
                        int _g  = (this._beat.whammyBarPoints.length - 1);
                        while ((_g1 < _g))
                        {
                            int i = _g1++;
                            global::alphatab.model.BendPoint pt1 = ((global::alphatab.model.BendPoint)(this._beat.whammyBarPoints[i]));
                            global::alphatab.model.BendPoint pt2 = ((global::alphatab.model.BendPoint)(this._beat.whammyBarPoints[(i + 1)]));
                            if (((pt1.@value == pt2.@value) && (i == (this._beat.whammyBarPoints.length - 2))))
                            {
                                continue;
                            }

                            int pt1X = ((int)((startX + (dx * pt1.offset))));
                            int pt1Y = ((int)((startY - (dy * pt1.@value))));
                            int pt2X = ((int)((startX + (dx * pt2.offset))));
                            int pt2Y = ((int)((startY - (dy * pt2.@value))));
                            canvas.moveTo(((double)(pt1X)), ((double)(pt1Y)));
                            canvas.lineTo(((double)(pt2X)), ((double)(pt2Y)));
                            if ((pt2.@value != 0))
                            {
                                double dv = (pt2.@value / 4.0);
                                bool   up = ((pt2.@value - pt1.@value) >= 0);
                                string s  = "";
                                if ((dv < 0))
                                {
                                    s = global::haxe.lang.Runtime.concat(s, "-");
                                }

                                if (((dv >= 1) || (dv <= -1)))
                                {
                                    int __temp_stmt605 = default(int);
                                    {
                                        double v = global::System.Math.Abs(((double)(dv)));
                                        {
                                            double x = global::System.Math.Floor(((double)(v)));
                                            __temp_stmt605 = ((int)(x));
                                        }
                                    }

                                    string __temp_stmt604 = global::Std.@string(__temp_stmt605);
                                    string __temp_stmt603 = global::haxe.lang.Runtime.concat(__temp_stmt604, " ");
                                    s = global::haxe.lang.Runtime.concat(s, __temp_stmt603);
                                }

                                {
                                    double x1 = global::System.Math.Floor(((double)(dv)));
                                    dv -= ((double)(((int)(x1))));
                                }

                                if ((dv == 0.25))
                                {
                                    s = global::haxe.lang.Runtime.concat(s, "1/4");
                                }
                                else
                                {
                                    if ((dv == 0.5))
                                    {
                                        s = global::haxe.lang.Runtime.concat(s, "1/2");
                                    }
                                    else
                                    {
                                        if ((dv == 0.75))
                                        {
                                            s = global::haxe.lang.Runtime.concat(s, "3/4");
                                        }
                                    }
                                }

                                canvas.setFont(res.graceFont);
                                double size = canvas.measureText(s);
                                double sy   = default(double);
                                if (up)
                                {
                                    sy = ((pt2Y - res.graceFont.getSize()) - textOffset);
                                }
                                else
                                {
                                    sy = ((double)((pt2Y + textOffset)));
                                }

                                int sx = pt2X;
                                canvas.fillText(s, ((double)(sx)), sy);
                            }
                        }
                    }

                    canvas.stroke();
                }
            }
        }