Nez.Textures.GaussianBlur.processPoint C# (CSharp) Method

processPoint() static private method

static private processPoint ( double matrix, int x, int y, double kernel, int direction ) : double
matrix double
x int
y int
kernel double
direction int
return double
		static double processPoint( double[,] matrix, int x, int y, double[,] kernel, int direction )
		{
			double res = 0;
			var half = kernel.GetLength( 0 ) / 2;
			for( var i = 0; i < kernel.GetLength( 0 ); i++ )
			{
				var cox = direction == 0 ? x + i - half : x;
				var coy = direction == 1 ? y + i - half : y;
				if( cox >= 0 && cox < matrix.GetLength( 0 ) && coy >= 0 && coy < matrix.GetLength( 1 ) )
					res += matrix[cox, coy] * kernel[i, 0];
			}
			return res;
		}