//>>built
define("dojox/gfx/gradutils",["./_base","dojo/_base/lang","./matrix","dojo/_base/Color"],function(h,l,f,k){function m(a,d){if(0>=a)return d[0].color;var c=d.length;if(1<=a)return d[c-1].color;for(var b=0;b<c;++b){var e=d[b];if(e.offset>=a)return b?(c=d[b-1],k.blendColors(new k(c.color),new k(e.color),(a-c.offset)/(e.offset-c.offset))):e.color}return d[c-1].color}h=h.gradutils={};h.getColor=function(a,d){if(a){switch(a.type){case "linear":var c=f.rotate(-Math.atan2(a.y2-a.y1,a.x2-a.x1));var b=f.project(a.x2-
a.x1,a.y2-a.y1),e=f.multiplyPoint(b,d),g=f.multiplyPoint(b,a.x1,a.y1);b=f.multiplyPoint(b,a.x2,a.y2);b=f.multiplyPoint(c,b.x-g.x,b.y-g.y).x;c=f.multiplyPoint(c,e.x-g.x,e.y-g.y).x/b;break;case "radial":c=d.x-a.cx,e=d.y-a.cy,c=Math.sqrt(c*c+e*e)/a.r}return m(c,a.colors)}return new k(a||[0,0,0,0])};h.reverse=function(a){if(a)switch(a.type){case "linear":case "radial":if(a=l.delegate(a),a.colors){for(var d=a.colors,c=d.length,b=0,e,g=a.colors=Array(d.length);b<c;++b)e=d[b],g[b]={offset:1-e.offset,color:e.color};
g.sort(function(n,p){return n.offset-p.offset})}}return a};return h});