//>>built
define("dojox/drawing/stencil/Image",["dojo","../util/oo","./_Base","../manager/_registry"],function(c,d,h,k){d=d.declare(h,function(a){},{type:"dojox.drawing.stencil.Image",anchorType:"group",baseRender:!0,dataToPoints:function(a){a=a||this.data;return this.points=[{x:a.x,y:a.y},{x:a.x+a.width,y:a.y},{x:a.x+a.width,y:a.y+a.height},{x:a.x,y:a.y+a.height}]},pointsToData:function(a){a=a||this.points;var b=a[0];a=a[2];return this.data={x:b.x,y:b.y,width:a.x-b.x,height:a.y-b.y,src:this.src||this.data.src}},
_createHilite:function(){this.remove(this.hit);this.hit=this.container.createRect(this.data).setStroke(this.style.current).setFill(this.style.current.fill);this._setNodeAtts(this.hit)},_create:function(a,b,e){this.remove(this[a]);e=this.container.getParent();this[a]=e.createImage(b);this.container.add(this[a]);this._setNodeAtts(this[a])},render:function(a){"auto"==this.data.width||isNaN(this.data.width)?this.getImageSize(!0):(this.onBeforeRender(this),this.renderHit&&this._createHilite(),this._create("shape",
this.data,this.style.current))},getImageSize:function(a){if(!this._gettingSize){this._gettingSize=!0;var b=c.create("img",{src:this.data.src},c.body()),e=c.connect(b,"error",this,function(){c.disconnect(f);c.disconnect(e)}),f=c.connect(b,"load",this,function(){var g=c.marginBox(b);this.setData({x:this.data.x,y:this.data.y,src:this.data.src,width:g.w,height:g.h});c.disconnect(f);c.destroy(b);a&&this.render(!0)})}}});c.setObject("dojox.drawing.stencil.Image",d);k.register({name:"dojox.drawing.stencil.Image"},
"stencil");return d});