lib/conversion.js
function (idx, funcName) {

		var colors = 0,
			colorCounter = 0,
			fn,
			width = this._image.width,
			height = this._image.height,
			dim = width * height,
			spaceOnRight,
			spaceOnLeft,
			spaceOnTop,
			spaceOnBottom;

		funcName = funcName || "getLuminosityAtIndex";

		fn = function (idx) {
			colors += this[funcName](idx);
			colorCounter++;
		}.bind(this);

		spaceOnRight = (idx % width < width - 1);
		spaceOnLeft = (idx % width > 0);
		spaceOnTop = (idx >= width);
		spaceOnBottom = (idx <= dim - width);

		if (spaceOnTop) {
			if (spaceOnLeft) {
				fn(idx - this._image.width - 1);
			}
			fn(idx - this._image.width);
			if (spaceOnRight) {
				fn(idx - this._image.width + 1);
			}
		}

		if (spaceOnLeft) {
			fn(idx - 1);
		}
		fn(idx);
		if (spaceOnRight) {
			fn(idx + 1);
		}

		if (spaceOnBottom) {
			if (spaceOnLeft) {
				fn(idx + this._image.width - 1);
			}
			fn(idx + this._image.width);
			if (spaceOnRight) {
				fn(idx + this._image.width + 1);
			}
		}

		return Math.floor(colors / colorCounter);
	}
function (idx, funcName) {

		var colors = 0,
			colorCounter = 0,
			fn,
			width = this._image.width,
			height = this._image.height,
			dim = width * height,
			spaceOnRight,
			spaceOnLeft,
			spaceOnTop,
			spaceOnBottom;

		funcName = funcName || "getLuminosityAtIndex";

		fn = function (idx) {
			colors += this[funcName](idx);
			colorCounter++;
		}.bind(this);

		spaceOnRight = (idx % width < width - 1);
		spaceOnLeft = (idx % width > 0);
		spaceOnTop = (idx >= width);
		spaceOnBottom = (idx <= dim - width);

		if (spaceOnTop) {
			if (spaceOnLeft) {
				fn(idx - this._image.width - 1);
			}
			fn(idx - this._image.width);
			if (spaceOnRight) {
				fn(idx - this._image.width + 1);
			}
		}

		if (spaceOnLeft) {
			fn(idx - 1);
		}
		fn(idx);
		if (spaceOnRight) {
			fn(idx + 1);
		}

		if (spaceOnBottom) {
			if (spaceOnLeft) {
				fn(idx + this._image.width - 1);
			}
			fn(idx + this._image.width);
			if (spaceOnRight) {
				fn(idx + this._image.width + 1);
			}
		}

		return Math.floor(colors / colorCounter);
	}
function ( idx , funcName ) { var colors = 0 , colorCounter = 0 , fn , width = this . _image . width , height = this . _image . height , dim = width * height , spaceOnRight , spaceOnLeft , spaceOnTop , spaceOnBottom ; funcName = funcName || "getLuminosityAtIndex" ; fn = function ( idx ) { colors += this [ funcName ] ( idx ) ; colorCounter ++ ; } . bind ( this ) ; spaceOnRight = ( idx % width < width - 1 ) ; spaceOnLeft = ( idx % width > 0 ) ; spaceOnTop = ( idx >= width ) ; spaceOnBottom = ( idx <= dim - width ) ; if ( spaceOnTop ) { if ( spaceOnLeft ) { fn ( idx - this . _image . width - 1 ) ; } fn ( idx - this . _image . width ) ; if ( spaceOnRight ) { fn ( idx - this . _image . width + 1 ) ; } } if ( spaceOnLeft ) { fn ( idx - 1 ) ; } fn ( idx ) ; if ( spaceOnRight ) { fn ( idx + 1 ) ; } if ( spaceOnBottom ) { if ( spaceOnLeft ) { fn ( idx + this . _image . width - 1 ) ; } fn ( idx + this . _image . width ) ; if ( spaceOnRight ) { fn ( idx + this . _image . width + 1 ) ; } } return Math . floor ( colors / colorCounter ) ; }
Gets the blurred value of a pixel with a gray-scale function

@method getBlurPixelAtIndex
@param {int} idx Index
@param {string} [funcName] Gray-scale function
@return {int}
Gets the blurred value of a pixel with a gray - scale function