var cinejs={};cinejs.filters={};cinejs.util={internal:{}};cinejs.util.applyConvolution=function(frame,width,height,filter,divisor,offset){var filterSize=Math.floor(filter.length/2);var i=0;var newImage=[];for(var y=0;ymax){max=green;maxChannel="green";} if(blue>max){max=blue;maxChannel="blue";} if(greencanvas.width){fcol=canvas.width-1;} sourceIndex=4*(row*canvas.width+fcol);red+=this.kernel[ki]*frame.data[sourceIndex+0];green+=this.kernel[ki]*frame.data[sourceIndex+1];blue+=this.kernel[ki]*frame.data[sourceIndex+2];++ki;} frame.data[i+0]=red;frame.data[i+1]=green;frame.data[i+2]=blue;}} for(row=0;row=canvas.height){frow=canvas.height-1;} sourceIndex=4*(frow*canvas.width+col);red+=this.kernel[ki]*frame.data[sourceIndex+0];green+=this.kernel[ki]*frame.data[sourceIndex+1];blue+=this.kernel[ki]*frame.data[sourceIndex+2];++ki;} frame.data[i+0]=red;frame.data[i+1]=green;frame.data[i+2]=blue;}}};cinejs.filters.GaussianBlur.prototype.calculateKernel=function(radius,sigma){var kernel=[];var i=0;for(i=0;i<=radius;i++){kernel.push(Math.pow((1.0/(sigma*Math.sqrt(2.0*Math.PI)))*Math.E,-(Math.pow(radius-i,2)/(2.0*sigma*sigma))));} for(i=radius-1;i>=0;i--){kernel.push(kernel[i]);} var sum=0.0;for(i=0;i