aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPushkar Joshi2012-05-01 10:21:36 -0700
committerPushkar Joshi2012-05-01 10:21:36 -0700
commit14e101e3822da595baaaaeaf91e9a00c79ac4b38 (patch)
tree622b978a0ef354dc51bfa063494d2ecb18221044
parentf32420d51258f1caf048ac387985ee84f019604c (diff)
downloadninja-14e101e3822da595baaaaeaf91e9a00c79ac4b38.tar.gz
Fixed 1436 Brush: Calligraphic brushstroke is slightly thicker than the round tip brushstroke
-rwxr-xr-xjs/lib/geom/brush-stroke.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js
index 27d12f03..574cead1 100755
--- a/js/lib/geom/brush-stroke.js
+++ b/js/lib/geom/brush-stroke.js
@@ -657,11 +657,8 @@ var BrushStroke = function GLBrushStroke() {
657 ctx.lineCap="butt"; 657 ctx.lineCap="butt";
658 ctx.globalCompositeOperation = 'source-over'; 658 ctx.globalCompositeOperation = 'source-over';
659 ctx.globalAlpha = this._strokeColor[3]; 659 ctx.globalAlpha = this._strokeColor[3];
660 //todo figure out the correct formula for the line width 660
661 ctx.lineWidth=2; 661
662 if (t===numTraces-1){
663 ctx.lineWidth = 1;
664 }
665 for (t=0;t<numTraces;t++){ 662 for (t=0;t<numTraces;t++){
666 var disp = [brushStamp[t][0], brushStamp[t][1]]; 663 var disp = [brushStamp[t][0], brushStamp[t][1]];
667 var alphaVal = 1.0; 664 var alphaVal = 1.0;
@@ -671,6 +668,12 @@ var BrushStroke = function GLBrushStroke() {
671 alphaVal *= 1.0/ctx.lineWidth; //factor that accounts for lineWidth !== 1 668 alphaVal *= 1.0/ctx.lineWidth; //factor that accounts for lineWidth !== 1
672 } 669 }
673 ctx.save(); 670 ctx.save();
671 if (t === (numTraces-1)){
672 ctx.lineWidth = 1;
673 } else {
674 //todo figure out the correct formula for the line width
675 ctx.lineWidth=2;
676 }
674 ctx.strokeStyle="rgba("+parseInt(255*this._strokeColor[0])+","+parseInt(255*this._strokeColor[1])+","+parseInt(255*this._strokeColor[2])+","+alphaVal+")"; 677 ctx.strokeStyle="rgba("+parseInt(255*this._strokeColor[0])+","+parseInt(255*this._strokeColor[1])+","+parseInt(255*this._strokeColor[2])+","+alphaVal+")";
675 //linearly interpolate between the two stroke colors 678 //linearly interpolate between the two stroke colors
676 var currStrokeColor = VecUtils.vecInterpolate(4, this._strokeColor, this._secondStrokeColor, t/numTraces); 679 var currStrokeColor = VecUtils.vecInterpolate(4, this._strokeColor, this._secondStrokeColor, t/numTraces);