text: /**
   * hilojs 2.0.0 for amd
   * Copyright 2016 alibaba.com
   * Licensed under the MIT License
   */
  define("hilo/view/Graphics",["hilo/core/Hilo","hilo/core/Class","hilo/view/View","hilo/view/CacheMixin"],function(t,e,i,l){var n=function(){var a=document.createElement("canvas"),r=a.getContext&&a.getContext("2d");return e.create({Extends:i,Mixes:l,constructor:function(e){e=e||{},this.id=this.id||e.id||t.getUid("Graphics"),n.superclass.constructor.call(this,e),this._actions=[]},lineWidth:1,lineAlpha:1,lineCap:null,lineJoin:null,miterLimit:10,hasStroke:!1,strokeStyle:"0",hasFill:!1,fillStyle:"0",fillAlpha:0,lineStyle:function(t,e,i,l,n,a){var r=this,o=r._addAction;return o.call(r,["lineWidth",r.lineWidth=t||1]),o.call(r,["strokeStyle",r.strokeStyle=e||"0"]),o.call(r,["lineAlpha",r.lineAlpha=i||1]),void 0!=l&&o.call(r,["lineCap",r.lineCap=l]),void 0!=n&&o.call(r,["lineJoin",r.lineJoin=n]),void 0!=a&&o.call(r,["miterLimit",r.miterLimit=a]),r.hasStroke=!0,r},setLineDash:function(t){return this._addAction(["setLineDash",t])},beginFill:function(t,e){var i=this,l=i._addAction;return l.call(i,["fillStyle",i.fillStyle=t]),l.call(i,["fillAlpha",i.fillAlpha=e||1]),i.hasFill=!0,i},endFill:function(){var t=this,e=t._addAction;return t.hasStroke&&e.call(t,["stroke"]),t.hasFill&&e.call(t,["fill"]),t.setCacheDirty(!0),t},beginLinearGradientFill:function(t,e,i,l,n,a){for(var o=this,c=r.createLinearGradient(t,e,i,l),s=0,h=n.length;s<h;s++)c.addColorStop(a[s],n[s]);return o.hasFill=!0,o._addAction(["fillStyle",o.fillStyle=c])},beginRadialGradientFill:function(t,e,i,l,n,a,o,c){for(var s=this,h=r.createRadialGradient(t,e,i,l,n,a),u=0,d=o.length;u<d;u++)h.addColorStop(c[u],o[u]);return s.hasFill=!0,s._addAction(["fillStyle",s.fillStyle=h])},beginBitmapFill:function(t,e){var i=this,l=r.createPattern(t,e||"");return i.hasFill=!0,i._addAction(["fillStyle",i.fillStyle=l])},beginPath:function(){return this._addAction(["beginPath"])},closePath:function(){return this._addAction(["closePath"])},moveTo:function(t,e){return this._addAction(["moveTo",t,e])},lineTo:function(t,e){return this._addAction(["lineTo",t,e])},quadraticCurveTo:function(t,e,i,l){return this._addAction(["quadraticCurveTo",t,e,i,l])},bezierCurveTo:function(t,e,i,l,n,a){return this._addAction(["bezierCurveTo",t,e,i,l,n,a])},drawRect:function(t,e,i,l){return this._addAction(["rect",t,e,i,l])},drawRoundRectComplex:function(t,e,i,l,n,a,r,o){var c=this,s=c._addAction;return s.call(c,["moveTo",t+n,e]),s.call(c,["lineTo",t+i-a,e]),s.call(c,["arc",t+i-a,e+a,a,-Math.PI/2,0,!1]),s.call(c,["lineTo",t+i,e+l-r]),s.call(c,["arc",t+i-r,e+l-r,r,0,Math.PI/2,!1]),s.call(c,["lineTo",t+o,e+l]),s.call(c,["arc",t+o,e+l-o,o,Math.PI/2,Math.PI,!1]),s.call(c,["lineTo",t,e+n]),s.call(c,["arc",t+n,e+n,n,Math.PI,3*Math.PI/2,!1]),c},drawRoundRect:function(t,e,i,l,n){return this.drawRoundRectComplex(t,e,i,l,n,n,n,n)},drawCircle:function(t,e,i){return this._addAction(["arc",t+i,e+i,i,0,2*Math.PI,0])},drawEllipse:function(t,e,i,l){var n=this;if(i==l)return n.drawCircle(t,e,i);var a=n._addAction,r=i/2,o=l/2,c=.5522847498307933,s=c*r,h=c*o;return t+=r,e+=o,a.call(n,["moveTo",t+r,e]),a.call(n,["bezierCurveTo",t+r,e-h,t+s,e-o,t,e-o]),a.call(n,["bezierCurveTo",t-s,e-o,t-r,e-h,t-r,e]),a.call(n,["bezierCurveTo",t-r,e+h,t-s,e+o,t,e+o]),a.call(n,["bezierCurveTo",t+s,e+o,t+r,e+h,t+r,e]),n},drawSVGPath:function(t){var e=this,i=e._addAction,l=t.replace(/,/g," ").replace(/-/g," -").split(/(?=[a-zA-Z])/);i.call(e,["beginPath"]);for(var n,a={x:0,y:0},r={x:0,y:0},o=0,c=l.length;o<c;o++){var s=l[o];if(s.length){var h=s[0],u=h.toUpperCase(),d=this._getSVGParams(s),f=u!==h;switch(u){case"M":f&&this._convertToAbsolute(a,d),i.call(e,["moveTo",d[0],d[1]]),this._setCurrentPoint(a,d[0],d[1]);break;case"L":f&&this._convertToAbsolute(a,d),i.call(e,["lineTo",d[0],d[1]]),this._setCurrentPoint(a,d[0],d[1]);break;case"H":f&&(d[0]+=a.x),i.call(e,["lineTo",d[0],a.y]),a.x=d[0];break;case"V":f&&(d[0]+=a.y),i.call(e,["lineTo",a.x,d[0]]),a.y=d[0];break;case"Z":i.call(e,["closePath"]);break;case"C":f&&this._convertToAbsolute(a,d),i.call(e,["bezierCurveTo",d[0],d[1],d[2],d[3],d[4],d[5]]),r.x=d[2],r.y=d[3],this._setCurrentPoint(a,d[4],d[5]);break;case"S":f&&this._convertToAbsolute(a,d),v="C"===n||"S"===n?this._getReflectionPoint(a,r):a,i.call(e,["bezierCurveTo",v.x,v.y,d[0],d[1],d[2],d[3]]),r.x=d[0],r.y=d[1],this._setCurrentPoint(a,d[2],d[3]);break;case"Q":f&&this._convertToAbsolute(a,d),i.call(e,["quadraticCurveTo",d[0],d[1],d[2],d[3]]),r.x=d[0],r.y=d[1],this._setCurrentPoint(a,d[2],d[3]);break;case"T":f&&this._convertToAbsolute(a,d);var v;v="Q"===n||"T"===n?this._getReflectionPoint(a,r):a,i.call(e,["quadraticCurveTo",v.x,v.y,d[0],d[1]]),r=v,this._setCurrentPoint(a,d[0],d[1])}n=u}}return e},_getSVGParams:function(t){var e=t.substring(1).replace(/[\s]+$|^[\s]+/g,"").split(/[\s]+/);0==e[0].length&&e.shift();for(var i=0,l=e.length;i<l;i++)e[i]=parseFloat(e[i]);return e},_convertToAbsolute:function(t,e){for(var i=0,l=e.length;i<l;i++)i%2===0?e[i]+=t.x:e[i]+=t.y},_setCurrentPoint:function(t,e,i){t.x=e,t.y=i},_getReflectionPoint:function(t,e){return{x:2*t.x-e.x,y:2*t.y-e.y}},_draw:function(t){var e,i=this,l=i._actions,n=l.length;for(t.beginPath(),e=0;e<n;e++){var a=l[e],r=a[0],o=a.length>1?a.slice(1):null;"function"==typeof t[r]?t[r].apply(t,o):t[r]=a[1]}},render:function(t,e){var i=this;"canvas"===t.renderType?i._draw(t.context):(i.cache(),t.draw(i))},clear:function(){var t=this;return t._actions.length=0,t.lineWidth=1,t.lineAlpha=1,t.lineCap=null,t.lineJoin=null,t.miterLimit=10,t.hasStroke=!1,t.strokeStyle="0",t.hasFill=!1,t.fillStyle="0",t.fillAlpha=1,t.setCacheDirty(!0),t},_addAction:function(t){var e=this;return e._actions.push(t),e}})}();return n});