lib/filters.js
function generateFilter (fn) {

	/**
	 * Creates a destination image
	 *
	 * @method
	 * @param {PNGImage} image
	 * @param {object} options
	 * @param {object} [options.needsCopy=false]
	 * @return {PNGImage}
	 */
	return function (image, options) {

		if (options.needsCopy) {
			var newImage = image.constructor.createImage(image.getWidth(), image.getHeight());
			fn(image, newImage, options);
			return newImage;

		} else {
			fn(image, image, options);
			return image;
		}
	};
}
function generateFilter (fn) {

	/**
	 * Creates a destination image
	 *
	 * @method
	 * @param {PNGImage} image
	 * @param {object} options
	 * @param {object} [options.needsCopy=false]
	 * @return {PNGImage}
	 */
	return function (image, options) {

		if (options.needsCopy) {
			var newImage = image.constructor.createImage(image.getWidth(), image.getHeight());
			fn(image, newImage, options);
			return newImage;

		} else {
			fn(image, image, options);
			return image;
		}
	};
}
function generateFilter ( fn ) { /**
	 * Creates a destination image
	 *
	 * @method
	 * @param {PNGImage} image
	 * @param {object} options
	 * @param {object} [options.needsCopy=false]
	 * @return {PNGImage}
	 */ return function ( image , options ) { if ( options . needsCopy ) { var newImage = image . constructor . createImage ( image . getWidth ( ) , image . getHeight ( ) ) ; fn ( image , newImage , options ) ; return newImage ; } else { fn ( image , image , options ) ; return image ; } } ; }
Generates a filter function by doing common tasks to abstract this away from the actual filter functions

@method generateFilter
@param {function} fn
@return {Function}
@private
Generates a filter function by doing common tasks to abstract this away from the actual filter functions