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 static void __hx_ctor_alphatab_rendering_glyphs_SvgCommand(global::alphatab.rendering.glyphs.SvgCommand __temp_me161) { unchecked { { } } }
public virtual void parseCommand(int cx, int cy, global::alphatab.platform.ICanvas canvas, global::alphatab.rendering.glyphs.SvgCommand cmd) { unchecked { bool canContinue = default(bool); int i = default(int); { string _g = cmd.cmd; switch (_g) { case "M": { this._currentX = (cx + (cmd.numbers[0] * this._xScale)); this._currentY = (cy + (cmd.numbers[1] * this._yScale)); canvas.moveTo(this._currentX, this._currentY); break; } case "m": { this._currentX += (cmd.numbers[0] * this._xScale); this._currentY += (cmd.numbers[1] * this._yScale); canvas.moveTo(this._currentX, this._currentY); break; } case "Z": case "z": { canvas.closePath(); break; } case "L": { i = 0; while ((i < cmd.numbers.length)) { this._currentX = (cx + (cmd.numbers[i++] * this._xScale)); this._currentY = (cy + (cmd.numbers[i++] * this._yScale)); canvas.lineTo(this._currentX, this._currentY); } break; } case "l": { i = 0; while ((i < cmd.numbers.length)) { this._currentX += (cmd.numbers[i++] * this._xScale); this._currentY += (cmd.numbers[i++] * this._yScale); canvas.lineTo(this._currentX, this._currentY); } break; } case "V": { i = 0; while ((i < cmd.numbers.length)) { this._currentY = (cy + (cmd.numbers[i++] * this._yScale)); canvas.lineTo(this._currentX, this._currentY); } break; } case "v": { i = 0; while ((i < cmd.numbers.length)) { this._currentY += (cmd.numbers[i++] * this._yScale); canvas.lineTo(this._currentX, this._currentY); } break; } case "H": { i = 0; while ((i < cmd.numbers.length)) { this._currentX = (cx + (cmd.numbers[i++] * this._xScale)); canvas.lineTo(this._currentX, this._currentY); } break; } case "h": { i = 0; while ((i < cmd.numbers.length)) { this._currentX += (cmd.numbers[i++] * this._xScale); canvas.lineTo(this._currentX, this._currentY); } break; } case "C": { i = 0; while ((i < cmd.numbers.length)) { double x1 = (cx + (cmd.numbers[i++] * this._xScale)); double y1 = (cy + (cmd.numbers[i++] * this._yScale)); double x2 = (cx + (cmd.numbers[i++] * this._xScale)); double y2 = (cy + (cmd.numbers[i++] * this._yScale)); double x3 = (cx + (cmd.numbers[i++] * this._xScale)); double y3 = (cy + (cmd.numbers[i++] * this._yScale)); this._lastControlX = x2; this._lastControlY = y2; this._currentX = x3; this._currentY = y3; canvas.bezierCurveTo(x1, y1, x2, y2, x3, y3); } break; } case "c": { i = 0; while ((i < cmd.numbers.length)) { double x11 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y11 = (this._currentY + (cmd.numbers[i++] * this._yScale)); double x21 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y21 = (this._currentY + (cmd.numbers[i++] * this._yScale)); double x31 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y31 = (this._currentY + (cmd.numbers[i++] * this._yScale)); this._lastControlX = x21; this._lastControlY = y21; this._currentX = x31; this._currentY = y31; canvas.bezierCurveTo(x11, y11, x21, y21, x31, y31); } break; } case "S": { i = 0; while ((i < cmd.numbers.length)) { double x12 = (cx + (cmd.numbers[i++] * this._xScale)); double y12 = (cy + (cmd.numbers[i++] * this._yScale)); canContinue = (((string.Equals(this._lastCmd, "c") || string.Equals(this._lastCmd, "C")) || string.Equals(this._lastCmd, "S")) || string.Equals(this._lastCmd, "s")); double x22 = default(double); if (canContinue) { x22 = (this._currentX + ((this._currentX - this._lastControlX))); } else { x22 = this._currentX; } double y22 = default(double); if (canContinue) { y22 = (this._currentY + ((this._currentY - this._lastControlY))); } else { y22 = this._currentY; } double x32 = (cx + (cmd.numbers[i++] * this._xScale)); double y32 = (cy + (cmd.numbers[i++] * this._yScale)); this._lastControlX = x22; this._lastControlY = y22; this._currentX = x32; this._currentY = y32; canvas.bezierCurveTo(x12, y12, x22, y22, x32, y32); } break; } case "s": { i = 0; while ((i < cmd.numbers.length)) { double x13 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y13 = (this._currentY + (cmd.numbers[i++] * this._yScale)); canContinue = (((string.Equals(this._lastCmd, "c") || string.Equals(this._lastCmd, "C")) || string.Equals(this._lastCmd, "S")) || string.Equals(this._lastCmd, "s")); double x23 = default(double); if (canContinue) { x23 = (this._currentX + ((this._currentX - this._lastControlX))); } else { x23 = this._currentX; } double y23 = default(double); if (canContinue) { y23 = (this._currentY + ((this._currentY - this._lastControlY))); } else { y23 = this._currentY; } double x33 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y33 = (this._currentY + (cmd.numbers[i++] * this._yScale)); this._lastControlX = x23; this._lastControlY = y23; this._currentX = x33; this._currentY = y33; canvas.bezierCurveTo(x13, y13, x23, y23, x33, y33); } break; } case "Q": { i = 0; while ((i < cmd.numbers.length)) { double x14 = (cx + (cmd.numbers[i++] * this._xScale)); double y14 = (cy + (cmd.numbers[i++] * this._yScale)); double x24 = (cx + (cmd.numbers[i++] * this._xScale)); double y24 = (cy + (cmd.numbers[i++] * this._yScale)); this._lastControlX = x14; this._lastControlY = y14; this._currentX = x24; this._currentY = y24; canvas.quadraticCurveTo(x14, y14, x24, y24); } break; } case "q": { i = 0; while ((i < cmd.numbers.length)) { double x15 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y15 = (this._currentY + (cmd.numbers[i++] * this._yScale)); double x25 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y25 = (this._currentY + (cmd.numbers[i++] * this._yScale)); this._lastControlX = x15; this._lastControlY = y15; this._currentX = x25; this._currentY = y25; canvas.quadraticCurveTo(x15, y15, x25, y25); } break; } case "T": { i = 0; while ((i < cmd.numbers.length)) { double x16 = (cx + (cmd.numbers[i++] * this._xScale)); double y16 = (cy + (cmd.numbers[i++] * this._yScale)); canContinue = (((string.Equals(this._lastCmd, "q") || string.Equals(this._lastCmd, "Q")) || string.Equals(this._lastCmd, "t")) || string.Equals(this._lastCmd, "T")); double cpx = default(double); if (canContinue) { cpx = (this._currentX + ((this._currentX - this._lastControlX))); } else { cpx = this._currentX; } double cpy = default(double); if (canContinue) { cpy = (this._currentY + ((this._currentY - this._lastControlY))); } else { cpy = this._currentY; } this._currentX = x16; this._currentY = y16; this._lastControlX = cpx; this._lastControlY = cpy; canvas.quadraticCurveTo(cpx, cpy, x16, y16); } break; } case "t": { i = 0; while ((i < cmd.numbers.length)) { double x17 = (this._currentX + (cmd.numbers[i++] * this._xScale)); double y17 = (this._currentY + (cmd.numbers[i++] * this._yScale)); double cpx1 = (this._currentX + ((this._currentX - this._lastControlX))); double cpy1 = (this._currentY + ((this._currentY - this._lastControlY))); canContinue = (((string.Equals(this._lastCmd, "q") || string.Equals(this._lastCmd, "Q")) || string.Equals(this._lastCmd, "t")) || string.Equals(this._lastCmd, "T")); double cpx2 = default(double); if (canContinue) { cpx2 = (this._currentX + ((this._currentX - this._lastControlX))); } else { cpx2 = this._currentX; } double cpy2 = default(double); if (canContinue) { cpy2 = (this._currentY + ((this._currentY - this._lastControlY))); } else { cpy2 = this._currentY; } this._lastControlX = cpx2; this._lastControlY = cpy2; canvas.quadraticCurveTo(cpx2, cpy2, x17, y17); } break; } } } this._lastCmd = cmd.cmd; } }
public virtual void parse() { unchecked { global::alphatab.rendering.utils.SvgPathParser parser = new global::alphatab.rendering.utils.SvgPathParser(global::haxe.lang.Runtime.toString(this._raw)); parser.reset(); this._parsed = new global::haxe.root.Array <object>(); while (!(parser.eof())) { global::alphatab.rendering.glyphs.SvgCommand command = new global::alphatab.rendering.glyphs.SvgCommand(); this._parsed.push(command); command.cmd = parser.getString(); { string _g = command.cmd; switch (_g) { case "M": { command.numbers = new global::haxe.root.Array <int>(new int[] { parser.getNumber(), parser.getNumber() }); break; } case "m": { command.numbers = new global::haxe.root.Array <int>(new int[] { parser.getNumber(), parser.getNumber() }); break; } case "Z": case "z": { { } break; } case "L": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "l": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "V": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "v": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "H": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "h": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "C": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "c": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "S": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "s": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "Q": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "q": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "T": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } case "t": { command.numbers = new global::haxe.root.Array <int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); }while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null <bool>))); break; } } } } this._raw = default(string); } }
public virtual void parse() { unchecked { global::alphatab.rendering.utils.SvgPathParser parser = new global::alphatab.rendering.utils.SvgPathParser(global::haxe.lang.Runtime.toString(this._raw)); parser.reset(); this._parsed = new global::haxe.root.Array<object>(); while ( ! (parser.eof()) ) { global::alphatab.rendering.glyphs.SvgCommand command = new global::alphatab.rendering.glyphs.SvgCommand(); this._parsed.push(command); command.cmd = parser.getString(); { string _g = command.cmd; switch (_g) { case "M": { command.numbers = new global::haxe.root.Array<int>(new int[]{parser.getNumber(), parser.getNumber()}); break; } case "m": { command.numbers = new global::haxe.root.Array<int>(new int[]{parser.getNumber(), parser.getNumber()}); break; } case "Z":case "z": { { } break; } case "L": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "l": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "V": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "v": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "H": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "h": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "C": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "c": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "S": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "s": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "Q": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "q": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "T": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } case "t": { command.numbers = new global::haxe.root.Array<int>(); do { command.numbers.push(parser.getNumber()); command.numbers.push(parser.getNumber()); } while (global::alphatab.rendering.utils.SvgPathParser.isNumber(parser.currentToken, default(global::haxe.lang.Null<bool>))); break; } } } } this._raw = default(string); } }