public static void paintSingleBar(global::alphatab.platform.ICanvas canvas, int x1, int y1, int x2, int y2, int size) { unchecked { canvas.beginPath(); canvas.moveTo(((double) (x1) ), ((double) (y1) )); canvas.lineTo(((double) (x2) ), ((double) (y2) )); canvas.lineTo(((double) (x2) ), ((double) (( y2 - size )) )); canvas.lineTo(((double) (x1) ), ((double) (( y1 - size )) )); canvas.closePath(); canvas.fill(); } }
public static void paintTie(global::alphatab.platform.ICanvas canvas, double scale, double x1, double y1, double x2, double y2, global::haxe.lang.Null<bool> down) { unchecked { bool __temp_down200 = ( (global::haxe.lang.Runtime.eq((down).toDynamic(), (default(global::haxe.lang.Null<bool>)).toDynamic())) ? (((bool) (false) )) : (down.@value) ); if (( x2 > x1 )) { double t = x1; x1 = x2; x2 = t; t = y1; y1 = y2; y2 = t; } double offset = ( 15 * scale ); double size = ( 4 * scale ); double normalVector_x = ( y2 - y1 ); double normalVector_y = ( x2 - x1 ); double length = global::System.Math.Sqrt(((double) (( ( normalVector_x * normalVector_x ) + ( normalVector_y * normalVector_y ) )) )); if (__temp_down200) { normalVector_x *= ((double) (-1) ); } else { normalVector_y *= ((double) (-1) ); } normalVector_x /= length; normalVector_y /= length; double center_x = ( (( x2 + x1 )) / 2 ); double center_y = ( (( y2 + y1 )) / 2 ); double cp1_x = ( center_x + ( offset * normalVector_x ) ); double cp1_y = ( center_y + ( offset * normalVector_y ) ); double cp2_x = ( center_x + ( (( offset - size )) * normalVector_x ) ); double cp2_y = ( center_y + ( (( offset - size )) * normalVector_y ) ); canvas.beginPath(); canvas.moveTo(x1, y1); canvas.quadraticCurveTo(cp1_x, cp1_y, x2, y2); canvas.quadraticCurveTo(cp2_x, cp2_y, x1, y1); canvas.closePath(); } }
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(); } } } }
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 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(); } } } }
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); } } } } } }