// Jcrop static functions $.extend(Jcrop,{ component: { }, filter: { }, stage: { }, registerComponent: function(name,component){ Jcrop.component[name] = component; }, registerFilter: function(name,filter){ Jcrop.filter[name] = filter; }, registerStageType: function(name,stage){ Jcrop.stage[name] = stage; }, // attach: function(element,opt){{{ attach: function(element,opt){ var obj = new $.Jcrop(element,opt); return obj; }, // }}} // imgCopy: function(imgel){{{ imgCopy: function(imgel){ var img = new Image; img.src = imgel.src; return img; }, // }}} // imageClone: function(imgel){{{ imageClone: function(imgel){ return $.Jcrop.supportsCanvas? Jcrop.canvasClone(imgel): Jcrop.imgCopy(imgel); }, // }}} // canvasClone: function(imgel){{{ canvasClone: function(imgel){ var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d'); $(canvas).width(imgel.width).height(imgel.height), canvas.width = imgel.naturalWidth; canvas.height = imgel.naturalHeight; ctx.drawImage(imgel,0,0,imgel.naturalWidth,imgel.naturalHeight); return canvas; }, // }}} // propagate: function(plist,config,obj){{{ propagate: function(plist,config,obj){ for(var i=0,l=plist.length;i ratio) return [ h * ratio, h ]; else return [ w, w / ratio ]; }, // }}} // stageConstructor: function(el,options,callback){{{ stageConstructor: function(el,options,callback){ // Get a priority-ordered list of available stages var stages = []; $.each(Jcrop.stage,function(i,e){ stages.push(e); }); stages.sort(function(a,b){ return a.priority - b.priority; }); // Find the first one that supports this element for(var i=0,l=stages.length;i