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.model.Track track = this.renderer.stave.staveGroup.layout.renderer.track; global::alphatab.rendering.RenderingResources res = this.renderer.stave.staveGroup.layout.renderer.renderingResources; double startY = ( ( cy + this.y ) + ( ( 10 * this.renderer.stave.staveGroup.layout.renderer.settings.scale ) * 0.6 ) ); int endY = ( ( cy + this.y ) + tabBarRenderer.getTabY(track.tuning.length, new global::haxe.lang.Null<int>(-2, true)) ); double fontScale = ((double) (1) ); double correction = ((double) (0) ); { int _g = track.tuning.length; switch (_g) { case 4: { fontScale = 0.6; break; } case 5: { fontScale = 0.8; break; } case 6: { fontScale = 1.1; correction = ((double) (1) ); break; } case 7: { fontScale = 1.15; break; } case 8: { fontScale = 1.35; break; } } } global::alphatab.platform.model.Font font = res.tabClefFont.clone(); font.setSize(( font.getSize() * fontScale )); canvas.setColor(res.mainGlyphColor); canvas.setFont(font); canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Center); canvas.fillText("T", ((double) (( ( cx + this.x ) + ( this.width / 2 ) )) ), startY); canvas.fillText("A", ((double) (( ( cx + this.x ) + ( this.width / 2 ) )) ), ( ( startY + font.getSize() ) - ((int) (( correction * this.renderer.stave.staveGroup.layout.renderer.settings.scale )) ) )); canvas.fillText("B", ((double) (( ( cx + this.x ) + ( this.width / 2 ) )) ), ( startY + ( (( font.getSize() - ((int) (( correction * this.renderer.stave.staveGroup.layout.renderer.settings.scale )) ) )) * 2 ) )); } }
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(); } } } }
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(); } } }
public virtual void paintTupletHelper(int cx, int cy, global::alphatab.platform.ICanvas canvas, global::alphatab.rendering.utils.TupletHelper h) { unchecked { global::alphatab.rendering.RenderingResources res = this.stave.staveGroup.layout.renderer.renderingResources; global::alphatab.platform.model.TextAlign oldAlign = canvas.getTextAlign(); canvas.setTextAlign(global::alphatab.platform.model.TextAlign.Center); if (( ( h.beats.length == 1 ) || ! ((( h.beats.length == h.tuplet ))) )) { int _g1 = 0; int _g = h.beats.length; while (( _g1 < _g )) { int i = _g1++; global::alphatab.model.Beat beat = ((global::alphatab.model.Beat) (h.beats[i]) ); global::alphatab.rendering.utils.BeamingHelper beamingHelper = ((global::alphatab.rendering.utils.BeamingHelper) (((global::haxe.ds.IntMap<object>) (global::haxe.ds.IntMap<object>.__hx_cast<object>(((global::haxe.ds.IntMap) (this._beamHelperLookup[h.voiceIndex]) ))) ).@get(beat.index).@value) ); global::alphatab.rendering.utils.BeamDirection direction = beamingHelper.getDirection(); int tupletX = default(int); { double x = ( beamingHelper.getBeatLineX(beat) + this.stave.staveGroup.layout.renderer.settings.scale ); tupletX = ((int) (x) ); } int tupletY = ( ( cy + this.y ) + this.calculateBeamY(beamingHelper, tupletX) ); int offset = default(int); if (( direction == global::alphatab.rendering.utils.BeamDirection.Up )) { double x1 = ( res.effectFont.getSize() * 1.8 ); offset = ((int) (x1) ); } else { offset = - ((((int) (( 3 * this.stave.staveGroup.layout.renderer.settings.scale )) ))) ; } canvas.setFont(res.effectFont); canvas.fillText(global::Std.@string(h.tuplet), ((double) (( ( cx + this.x ) + tupletX )) ), ((double) (( tupletY - offset )) )); } } else { global::alphatab.model.Beat firstBeat = ((global::alphatab.model.Beat) (h.beats[0]) ); global::alphatab.model.Beat lastBeat = ((global::alphatab.model.Beat) (h.beats[( h.beats.length - 1 )]) ); global::alphatab.rendering.utils.BeamingHelper beamingHelper1 = ((global::alphatab.rendering.utils.BeamingHelper) (((global::haxe.ds.IntMap<object>) (global::haxe.ds.IntMap<object>.__hx_cast<object>(((global::haxe.ds.IntMap) (this._beamHelperLookup[h.voiceIndex]) ))) ).@get(firstBeat.index).@value) ); global::alphatab.rendering.utils.BeamDirection direction1 = beamingHelper1.getDirection(); int startX = default(int); { double x2 = ( beamingHelper1.getBeatLineX(firstBeat) + this.stave.staveGroup.layout.renderer.settings.scale ); startX = ((int) (x2) ); } int endX = default(int); { double x3 = ( beamingHelper1.getBeatLineX(lastBeat) + this.stave.staveGroup.layout.renderer.settings.scale ); endX = ((int) (x3) ); } canvas.setFont(res.effectFont); string s = global::Std.@string(h.tuplet); double sw = canvas.measureText(s); int sp = ((int) (( 3 * this.stave.staveGroup.layout.renderer.settings.scale )) ); int middleX = ( (( startX + endX )) / 2 ); int offset1X = ((int) (( ( middleX - ( sw / 2 ) ) - sp )) ); int offset2X = ((int) (( ( middleX + ( sw / 2 ) ) + sp )) ); int startY = this.calculateBeamY(beamingHelper1, startX); int offset1Y = this.calculateBeamY(beamingHelper1, offset1X); int middleY = this.calculateBeamY(beamingHelper1, middleX); int offset2Y = this.calculateBeamY(beamingHelper1, offset2X); int endY = this.calculateBeamY(beamingHelper1, endX); int offset1 = ((int) (( 10 * this.stave.staveGroup.layout.renderer.settings.scale )) ); int size = ((int) (( 5 * this.stave.staveGroup.layout.renderer.settings.scale )) ); if (( direction1 == global::alphatab.rendering.utils.BeamDirection.Down )) { offset1 *= -1; size *= -1; } canvas.beginPath(); canvas.moveTo(((double) (( ( cx + this.x ) + startX )) ), ((double) (( ( ( cy + this.y ) + startY ) - offset1 )) )); canvas.lineTo(((double) (( ( cx + this.x ) + startX )) ), ((double) (( ( ( ( cy + this.y ) + startY ) - offset1 ) - size )) )); canvas.lineTo(((double) (( ( cx + this.x ) + offset1X )) ), ((double) (( ( ( ( cy + this.y ) + offset1Y ) - offset1 ) - size )) )); canvas.stroke(); canvas.beginPath(); canvas.moveTo(((double) (( ( cx + this.x ) + offset2X )) ), ((double) (( ( ( ( cy + this.y ) + offset2Y ) - offset1 ) - size )) )); canvas.lineTo(((double) (( ( cx + this.x ) + endX )) ), ((double) (( ( ( ( cy + this.y ) + endY ) - offset1 ) - size )) )); canvas.lineTo(((double) (( ( cx + this.x ) + endX )) ), ((double) (( ( ( cy + this.y ) + endY ) - offset1 )) )); canvas.stroke(); canvas.fillText(s, ((double) (( ( cx + this.x ) + middleX )) ), ( ( ( ( ( cy + this.y ) + middleY ) - offset1 ) - size ) - res.effectFont.getSize() )); } canvas.setTextAlign(oldAlign); } }