pingy.js
function(fn) {
      for (var y = 0; y < this.getHeight(); y++) {
        for (var x = 0; x < this.getWidth(); x++) {

          var rgba = this.getColor(x, y);
          var out = fn.call(this, x, y, rgba);

          this.setColor(x, y, (out || rgba));
        }
      }

      return this;
    }
function(fn) {
      for (var y = 0; y < this.getHeight(); y++) {
        for (var x = 0; x < this.getWidth(); x++) {

          var rgba = this.getColor(x, y);
          var out = fn.call(this, x, y, rgba);

          this.setColor(x, y, (out || rgba));
        }
      }

      return this;
    }
Execute a function on each point in an image

The rgba object passed to the callback will be saved back to the image,
so no need to call `set_rgba` there

If the callback returns an object, it will be used as the new rgba value

@param {Function} fn - Function(x, y, rgba) to execute
@return {Pingy} self