var com=com||{};com.eqela=com.eqela||{};com.eqela.libimage=com.eqela.libimage||{};com.eqela.libimage.ImageSheet=function(){eq.api.Object.call(this);this.com_eqela_libimage_ImageSheet_sheet=null;this.com_eqela_libimage_ImageSheet_cols=-1;this.com_eqela_libimage_ImageSheet_rows=-1;this.com_eqela_libimage_ImageSheet_source_skip_x=0;this.com_eqela_libimage_ImageSheet_source_skip_y=0;this.com_eqela_libimage_ImageSheet_source_image_width=-1;this.com_eqela_libimage_ImageSheet_source_image_height=-1;this.com_eqela_libimage_ImageSheet_max_images=-1;{}};P=com.eqela.libimage.ImageSheet.prototype=(function(o){function F(){};F.prototype=o;return(new F());})(eq.api.Object.prototype);P._t={};P._t['eq.api.Object']=true;P._t['com.eqela.libimage.ImageSheet']=true;P.constructor=com.eqela.libimage.ImageSheet;P.to_images=function(resize_to_width,resize_to_height){if(this.com_eqela_libimage_ImageSheet_sheet===null){return(null);}var cols=this.com_eqela_libimage_ImageSheet_cols;var rows=this.com_eqela_libimage_ImageSheet_rows;var fwidth=this.com_eqela_libimage_ImageSheet_source_image_width;if(fwidth < 1){fwidth=~~(((this.com_eqela_libimage_ImageSheet_sheet.get_width()-this.com_eqela_libimage_ImageSheet_source_skip_x)/cols));}else {cols=~~(((this.com_eqela_libimage_ImageSheet_sheet.get_width()-this.com_eqela_libimage_ImageSheet_source_skip_x)/fwidth));}var fheight=this.com_eqela_libimage_ImageSheet_source_image_height;if(fheight < 1){fheight=~~(((this.com_eqela_libimage_ImageSheet_sheet.get_height()-this.com_eqela_libimage_ImageSheet_source_skip_y)/rows));}else {rows=~~(((this.com_eqela_libimage_ImageSheet_sheet.get_height()-this.com_eqela_libimage_ImageSheet_source_skip_y)/fheight));}var frames=eq.api.ArrayStatic.create(0);var x=0;var y=0;for(y=0;y < rows;y++){for(x=0;x < cols;x++){var img=this.com_eqela_libimage_ImageSheet_sheet.crop(x*fwidth,y*fheight,fwidth,fheight);if(resize_to_width > 0){img=img.resize(resize_to_width,resize_to_height);}frames.add(img);if((this.com_eqela_libimage_ImageSheet_max_images > 0)&&(frames.count() >= this.com_eqela_libimage_ImageSheet_max_images)){return(frames);}}}return(frames);};P.set_sheet=function(v){this.com_eqela_libimage_ImageSheet_sheet=v;return(this);};P.get_sheet=function(){return(this.com_eqela_libimage_ImageSheet_sheet);};P.set_cols=function(v){this.com_eqela_libimage_ImageSheet_cols=v;return(this);};P.get_cols=function(){return(this.com_eqela_libimage_ImageSheet_cols);};P.set_rows=function(v){this.com_eqela_libimage_ImageSheet_rows=v;return(this);};P.get_rows=function(){return(this.com_eqela_libimage_ImageSheet_rows);};P.set_source_skip_x=function(v){this.com_eqela_libimage_ImageSheet_source_skip_x=v;return(this);};P.get_source_skip_x=function(){return(this.com_eqela_libimage_ImageSheet_source_skip_x);};P.set_source_skip_y=function(v){this.com_eqela_libimage_ImageSheet_source_skip_y=v;return(this);};P.get_source_skip_y=function(){return(this.com_eqela_libimage_ImageSheet_source_skip_y);};P.set_source_image_width=function(v){this.com_eqela_libimage_ImageSheet_source_image_width=v;return(this);};P.get_source_image_width=function(){return(this.com_eqela_libimage_ImageSheet_source_image_width);};P.set_source_image_height=function(v){this.com_eqela_libimage_ImageSheet_source_image_height=v;return(this);};P.get_source_image_height=function(){return(this.com_eqela_libimage_ImageSheet_source_image_height);};P.set_max_images=function(v){this.com_eqela_libimage_ImageSheet_max_images=v;return(this);};P.get_max_images=function(){return(this.com_eqela_libimage_ImageSheet_max_images);};