in tapestry-framework/src/js/dojo-0.4.3-custom-4.1.6/src/gfx/vml.js [53:283]
dojo.lang.extend(dojo.gfx.Shape,{setFill:function(_7){
if(!_7){
this.fillStyle=null;
this.rawNode.filled=false;
return this;
}
if(typeof (_7)=="object"&&"type" in _7){
switch(_7.type){
case "linear":
var f=dojo.gfx.makeParameters(dojo.gfx.defaultLinearGradient,_7);
this.fillStyle=f;
var s="";
for(var i=0;i<f.colors.length;++i){
f.colors[i].color=dojo.gfx.normalizeColor(f.colors[i].color);
s+=f.colors[i].offset.toFixed(8)+" "+f.colors[i].color.toHex()+";";
}
var fo=this.rawNode.fill;
fo.colors.value=s;
fo.method="sigma";
fo.type="gradient";
fo.angle=(dojo.math.radToDeg(Math.atan2(f.x2-f.x1,f.y2-f.y1))+180)%360;
fo.on=true;
break;
case "radial":
var f=dojo.gfx.makeParameters(dojo.gfx.defaultRadialGradient,_7);
this.fillStyle=f;
var w=parseFloat(this.rawNode.style.width);
var h=parseFloat(this.rawNode.style.height);
var c=isNaN(w)?1:2*f.r/w;
var i=f.colors.length-1;
f.colors[i].color=dojo.gfx.normalizeColor(f.colors[i].color);
var s="0 "+f.colors[i].color.toHex();
for(;i>=0;--i){
f.colors[i].color=dojo.gfx.normalizeColor(f.colors[i].color);
s+=(1-c*f.colors[i].offset).toFixed(8)+" "+f.colors[i].color.toHex()+";";
}
var fo=this.rawNode.fill;
fo.colors.value=s;
fo.method="sigma";
fo.type="gradientradial";
if(isNaN(w)||isNaN(h)){
fo.focusposition="0.5 0.5";
}else{
fo.focusposition=(f.cx/w).toFixed(8)+" "+(f.cy/h).toFixed(8);
}
fo.focussize="0 0";
fo.on=true;
break;
case "pattern":
var f=dojo.gfx.makeParameters(dojo.gfx.defaultPattern,_7);
this.fillStyle=f;
var fo=this.rawNode.fill;
fo.type="tile";
fo.src=f.src;
if(f.width&&f.height){
fo.size.x=dojo.gfx.vml.px2pt(f.width);
fo.size.y=dojo.gfx.vml.px2pt(f.height);
}
fo.alignShape=false;
fo.position.x=0;
fo.position.y=0;
fo.origin.x=f.width?f.x/f.width:0;
fo.origin.y=f.height?f.y/f.height:0;
fo.on=true;
break;
}
this.rawNode.fill.opacity=1;
return this;
}
this.fillStyle=dojo.gfx.normalizeColor(_7);
this.rawNode.fillcolor=this.fillStyle.toHex();
this.rawNode.fill.opacity=this.fillStyle.a;
this.rawNode.filled=true;
return this;
},setStroke:function(_f){
if(!_f){
this.strokeStyle=null;
this.rawNode.stroked=false;
return this;
}
this.strokeStyle=dojo.gfx.makeParameters(dojo.gfx.defaultStroke,_f);
this.strokeStyle.color=dojo.gfx.normalizeColor(this.strokeStyle.color);
var s=this.strokeStyle;
this.rawNode.stroked=true;
this.rawNode.strokecolor=s.color.toCss();
this.rawNode.strokeweight=s.width+"px";
if(this.rawNode.stroke){
this.rawNode.stroke.opacity=s.color.a;
this.rawNode.stroke.endcap=this._translate(this._capMap,s.cap);
if(typeof (s.join)=="number"){
this.rawNode.stroke.joinstyle="miter";
this.rawNode.stroke.miterlimit=s.join;
}else{
this.rawNode.stroke.joinstyle=s.join;
}
}
return this;
},_capMap:{butt:"flat"},_capMapReversed:{flat:"butt"},_translate:function(_11,_12){
return (_12 in _11)?_11[_12]:_12;
},_applyTransform:function(){
var _13=this._getRealMatrix();
if(!_13){
return this;
}
var _14=this.rawNode.skew;
if(typeof (_14)=="undefined"){
for(var i=0;i<this.rawNode.childNodes.length;++i){
if(this.rawNode.childNodes[i].tagName=="skew"){
_14=this.rawNode.childNodes[i];
break;
}
}
}
if(_14){
_14.on=false;
var mt=_13.xx.toFixed(8)+" "+_13.xy.toFixed(8)+" "+_13.yx.toFixed(8)+" "+_13.yy.toFixed(8)+" 0 0";
var _17=Math.floor(_13.dx).toFixed()+"px "+Math.floor(_13.dy).toFixed()+"px";
var l=parseFloat(this.rawNode.style.left);
var t=parseFloat(this.rawNode.style.top);
var w=parseFloat(this.rawNode.style.width);
var h=parseFloat(this.rawNode.style.height);
if(isNaN(l)){
l=0;
}
if(isNaN(t)){
t=0;
}
if(isNaN(w)){
w=1;
}
if(isNaN(h)){
h=1;
}
var _1c=(-l/w-0.5).toFixed(8)+" "+(-t/h-0.5).toFixed(8);
_14.matrix=mt;
_14.origin=_1c;
_14.offset=_17;
_14.on=true;
}
return this;
},setRawNode:function(_1d){
_1d.stroked=false;
_1d.filled=false;
this.rawNode=_1d;
},attachFill:function(_1e){
var _1f=null;
var fo=_1e.fill;
if(_1e){
if(fo.on&&fo.type=="gradient"){
var _1f=dojo.lang.shallowCopy(dojo.gfx.defaultLinearGradient,true);
var rad=dojo.math.degToRad(fo.angle);
_1f.x2=Math.cos(rad);
_1f.y2=Math.sin(rad);
_1f.colors=[];
var _22=fo.colors.value.split(";");
for(var i=0;i<_22.length;++i){
var t=_22[i].match(/\S+/g);
if(!t||t.length!=2){
continue;
}
_1f.colors.push({offset:dojo.gfx.vml._parseFloat(t[0]),color:new dojo.gfx.color.Color(t[1])});
}
}else{
if(fo.on&&fo.type=="gradientradial"){
var _1f=dojo.lang.shallowCopy(dojo.gfx.defaultRadialGradient,true);
var w=parseFloat(_1e.style.width);
var h=parseFloat(_1e.style.height);
_1f.cx=isNaN(w)?0:fo.focusposition.x*w;
_1f.cy=isNaN(h)?0:fo.focusposition.y*h;
_1f.r=isNaN(w)?1:w/2;
_1f.colors=[];
var _22=fo.colors.value.split(";");
for(var i=_22.length-1;i>=0;--i){
var t=_22[i].match(/\S+/g);
if(!t||t.length!=2){
continue;
}
_1f.colors.push({offset:dojo.gfx.vml._parseFloat(t[0]),color:new dojo.gfx.color.Color(t[1])});
}
}else{
if(fo.on&&fo.type=="tile"){
var _1f=dojo.lang.shallowCopy(dojo.gfx.defaultPattern,true);
_1f.width=dojo.gfx.vml.pt2px(fo.size.x);
_1f.height=dojo.gfx.vml.pt2px(fo.size.y);
_1f.x=fo.origin.x*_1f.width;
_1f.y=fo.origin.y*_1f.height;
_1f.src=fo.src;
}else{
if(fo.on&&_1e.fillcolor){
_1f=new dojo.gfx.color.Color(_1e.fillcolor+"");
_1f.a=fo.opacity;
}
}
}
}
}
return _1f;
},attachStroke:function(_27){
var _28=dojo.lang.shallowCopy(dojo.gfx.defaultStroke,true);
if(_27&&_27.stroked){
_28.color=new dojo.gfx.color.Color(_27.strokecolor.value);
dojo.debug("We are expecting an .75pt here, instead of strokeweight = "+_27.strokeweight);
_28.width=dojo.gfx.vml.normalizedLength(_27.strokeweight+"");
_28.color.a=_27.stroke.opacity;
_28.cap=this._translate(this._capMapReversed,_27.stroke.endcap);
_28.join=_27.stroke.joinstyle=="miter"?_27.stroke.miterlimit:_27.stroke.joinstyle;
}else{
return null;
}
return _28;
},attachTransform:function(_29){
var _2a={};
if(_29){
var s=_29.skew;
_2a.xx=s.matrix.xtox;
_2a.xy=s.matrix.ytox;
_2a.yx=s.matrix.xtoy;
_2a.yy=s.matrix.ytoy;
_2a.dx=dojo.gfx.vml.pt2px(s.offset.x);
_2a.dy=dojo.gfx.vml.pt2px(s.offset.y);
}
return dojo.gfx.matrix.normalize(_2a);
},attach:function(_2c){
if(_2c){
this.rawNode=_2c;
this.shape=this.attachShape(_2c);
this.fillStyle=this.attachFill(_2c);
this.strokeStyle=this.attachStroke(_2c);
this.matrix=this.attachTransform(_2c);
}
}});