Functions / addImageDataFilter
addImageDataFilter(filterName, parameters)
addImageDataFilter(string filterName, object parameters)

Method for imageData filters creation and correction. You must define name of filter to create or edit. Second argument is object with parameters: fn - function of filter, matrix - some object and type - if type is defined, matrix object will added to the existing matrix under type name.
addImageDataFilter(string filterName, object parameters)
return: jCanvaScript
Example of new filter creation.
Code
<script type="text/javascript">
	function onload_1(idCanvas)
	{
		var img=new Image();
		img.src="/data/images/pic.png";
		img.onload=function(){
		jc.start(idCanvas);
		jc.image(img,100,100,100,100);
		jc.start(idCanvas);
		jc.addImageDataFilter('myFilter_1',
		{fn:
		function(width,height,matrix,type){
			var pixel,n=matrix[type],i,j;
			for(i=0;i<width;i++)
			for(j=0;j<height;j++)
			{
				pixel=this.getPixel(i,j);
				pixel[0]/=n;
				this.setPixel(i,j,pixel);
			}
		},
		matrix:[1.3,2,0.02]});
		jc.imageData(100,100)
			.getData(100,100,100,100)
			.filter('myFilter_1',1)
			.putData(20,20)
			.clone()
			.filter('myFilter_1',2)
			.putData(160,20);
		jc.start(idCanvas);
		}
	}
</script>
<canvas id="canvas_1" width="250px" height="265px"></canvas>
View