diff options
Diffstat (limited to 'js/lib/geom')
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index d5d9a893..27d12f03 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js | |||
@@ -704,7 +704,7 @@ var BrushStroke = function GLBrushStroke() { | |||
704 | ctx.lineCap = "round"; | 704 | ctx.lineCap = "round"; |
705 | ctx.lineJoin="round"; | 705 | ctx.lineJoin="round"; |
706 | var minStrokeWidth = (this._strokeHardness*this._strokeWidth)/100; //the hardness is the percentage of the stroke width that's fully opaque | 706 | var minStrokeWidth = (this._strokeHardness*this._strokeWidth)/100; //the hardness is the percentage of the stroke width that's fully opaque |
707 | var numlayers = 1 + (this._strokeWidth-minStrokeWidth)/2; | 707 | var numlayers = 1 + Math.ceil((this._strokeWidth-minStrokeWidth)*0.5); |
708 | var alphaVal = 1.0/(numlayers); //this way the alpha at the first path will be 1 | 708 | var alphaVal = 1.0/(numlayers); //this way the alpha at the first path will be 1 |
709 | ctx.strokeStyle="rgba("+parseInt(255*this._strokeColor[0])+","+parseInt(255*this._strokeColor[1])+","+parseInt(255*this._strokeColor[2])+","+alphaVal+")"; | 709 | ctx.strokeStyle="rgba("+parseInt(255*this._strokeColor[0])+","+parseInt(255*this._strokeColor[1])+","+parseInt(255*this._strokeColor[2])+","+alphaVal+")"; |
710 | for (var l=0;l<numlayers;l++){ | 710 | for (var l=0;l<numlayers;l++){ |
@@ -732,6 +732,16 @@ var BrushStroke = function GLBrushStroke() { | |||
732 | ctx.lineTo(p[0],p[1]); | 732 | ctx.lineTo(p[0],p[1]); |
733 | } | 733 | } |
734 | ctx.lineWidth=2*l+minStrokeWidth; | 734 | ctx.lineWidth=2*l+minStrokeWidth; |
735 | |||
736 | |||
737 | //experiments with shadows | ||
738 | /* | ||
739 | ctx.shadowOffsetX = 10; | ||
740 | ctx.shadowOffsetY = 10; | ||
741 | ctx.shadowBlur = 10; | ||
742 | ctx.shadowColor = //"rgb("+parseInt(255*this._strokeColor[0])+","+parseInt(255*this._strokeColor[1])+","+parseInt(255*this._strokeColor[2])+")"; | ||
743 | "#FF6666"; //or use rgb(red, green, blue) | ||
744 | */ | ||
735 | ctx.stroke(); | 745 | ctx.stroke(); |
736 | }//for every layer l | 746 | }//for every layer l |
737 | } //if there is no calligraphic stroke | 747 | } //if there is no calligraphic stroke |