aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-19 01:03:59 -0700
committerArmen Kesablyan2012-06-19 01:03:59 -0700
commit2e13a73e4ee980a6f73f6ff48b2a195eb209a7db (patch)
treed352f5e769eae0e1b7b76ccbeafa9b174b1a9918 /assets
parent244e608645778746d1a3b5aa0d4c0868f7c5c272 (diff)
parentc59eb371559a3061ce53223e249ca97daace5968 (diff)
downloadninja-2e13a73e4ee980a6f73f6ff48b2a195eb209a7db.tar.gz
Merge branch 'refs/heads/master' into binding
Conflicts: js/components/layout/tools-list.reel/tools-list.html js/components/layout/tools-properties.reel/tools-properties.html js/document/document-html.js js/document/templates/app/main.js js/panels/Panel.reel/Panel.js node_modules/montage/ui/native-control.js Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js44
1 files changed, 41 insertions, 3 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index fe5f839c..6268f0bb 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -1969,7 +1969,8 @@ NinjaCvsRt.RuntimeSubPath = Object.create(NinjaCvsRt.RuntimeGeomObj, {
1969 if (ipColor.gradientMode){ 1969 if (ipColor.gradientMode){
1970 var position, gradient, cs, inset; //vars used in gradient calculations 1970 var position, gradient, cs, inset; //vars used in gradient calculations
1971 inset = Math.ceil( lw ) - 0.5; 1971 inset = Math.ceil( lw ) - 0.5;
1972 1972 inset=0;
1973
1973 if(ipColor.gradientMode === "radial") { 1974 if(ipColor.gradientMode === "radial") {
1974 var ww = w - 2*lw, hh = h - 2*lw; 1975 var ww = w - 2*lw, hh = h - 2*lw;
1975 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2); 1976 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2);
@@ -2107,7 +2108,40 @@ NinjaCvsRt.RuntimeBrushStroke = Object.create(NinjaCvsRt.RuntimeGeomObj, {
2107 } 2108 }
2108 this._LocalPoints = newPoints.slice(0); 2109 this._LocalPoints = newPoints.slice(0);
2109 } 2110 }
2110 } 2111
2112 // *** compute the bounding box *********
2113 var BBoxMin = [Infinity, Infinity, Infinity];
2114 var BBoxMax = [-Infinity, -Infinity, -Infinity];
2115 if (numPoints === 0) {
2116 BBoxMin = [0, 0, 0];
2117 BBoxMax = [0, 0, 0];
2118 } else {
2119 for (var i=0;i<numPoints;i++){
2120 var pt = this._LocalPoints[i];
2121 for (var d = 0; d < 3; d++) {
2122 if (BBoxMin[d] > pt[d]) {
2123 BBoxMin[d] = pt[d];
2124 }
2125 if (BBoxMax[d] < pt[d]) {
2126 BBoxMax[d] = pt[d];
2127 }
2128 }//for every dimension d from 0 to 2
2129 }
2130 }
2131
2132 //increase the bbox given the stroke width and the angle (in case of calligraphic brush)
2133 var bboxPadding = this._strokeWidth*0.5;
2134 for (var d = 0; d < 3; d++) {
2135 BBoxMin[d]-= bboxPadding;
2136 BBoxMax[d]+= bboxPadding;
2137 }//for every dimension d from 0 to 2
2138
2139 //******* update the local coords so that the bbox min is at the origin ******
2140 for (var i=0;i<numPoints;i++) {
2141 this._LocalPoints[i][0]-= BBoxMin[0];
2142 this._LocalPoints[i][1]-= BBoxMin[1];
2143 }
2144 }//if we need to do smoothing
2111 } 2145 }
2112 }, 2146 },
2113 2147
@@ -2148,6 +2182,7 @@ NinjaCvsRt.RuntimeBrushStroke = Object.create(NinjaCvsRt.RuntimeGeomObj, {
2148 if (ipColor.gradientMode){ 2182 if (ipColor.gradientMode){
2149 var position, gradient, cs, inset; //vars used in gradient calculations 2183 var position, gradient, cs, inset; //vars used in gradient calculations
2150 inset = Math.ceil( lw ) - 0.5; 2184 inset = Math.ceil( lw ) - 0.5;
2185 inset=0;
2151 2186
2152 if(ipColor.gradientMode === "radial") { 2187 if(ipColor.gradientMode === "radial") {
2153 var ww = w - 2*lw, hh = h - 2*lw; 2188 var ww = w - 2*lw, hh = h - 2*lw;
@@ -2231,7 +2266,10 @@ NinjaCvsRt.RuntimeBrushStroke = Object.create(NinjaCvsRt.RuntimeGeomObj, {
2231 var disp = [brushStamp[t][0], brushStamp[t][1]]; 2266 var disp = [brushStamp[t][0], brushStamp[t][1]];
2232 var alphaVal = 1.0; 2267 var alphaVal = 1.0;
2233 var distFromOpaqueRegion = Math.abs(t-halfNumTraces) - opaqueRegionHalfWidth; 2268 var distFromOpaqueRegion = Math.abs(t-halfNumTraces) - opaqueRegionHalfWidth;
2234 if (distFromOpaqueRegion>0) { 2269 if (numTraces === 1){
2270 distFromOpaqueRegion = 0;
2271 }
2272 else if (distFromOpaqueRegion>0) {
2235 var transparencyFactor = distFromOpaqueRegion/maxTransparentRegionHalfWidth; 2273 var transparencyFactor = distFromOpaqueRegion/maxTransparentRegionHalfWidth;
2236 alphaVal = 1.0 - transparencyFactor;//(transparencyFactor*transparencyFactor);//the square term produces nonlinearly varying alpha values 2274 alphaVal = 1.0 - transparencyFactor;//(transparencyFactor*transparencyFactor);//the square term produces nonlinearly varying alpha values
2237 alphaVal *= 0.5; //factor that accounts for lineWidth == 2 2275 alphaVal *= 0.5; //factor that accounts for lineWidth == 2