Executes the given side effecting function on each pixel.

@param fn a function that accepts 3 parameters - the x,y coordinate and the pixel at that coordinate
330845
public void foreach(PixelFunction fn) {
        Arrays.stream(points()).forEach(p -> fn.apply(p.x, p.y, pixel(p)));
    }
837450
function fc(fn, autorun, dimensions) {
  document.body.style.margin = "0px";
  document.body.style.padding = "0px";

  var canvas = document.createElement('canvas');
  document.body.appendChild(canvas);
  canvas.style.position = 'absolute';
  canvas.style.left = '0px';
  canvas.style.top = '0px';

  var ctx;
  dimensions = dimensions || 2;

  if (dimensions === 2) {
    ctx = patchGetContext(canvas.getContext('2d'))
  } else if (dimensions === 3) {
    ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
  }

  if (!ctx) {
    return;
  }

  var last = performanceNow(), request;

  function requestFrame() {
    if (request === null) {
      request = requestAnimationFrame(tick);
    }
  }

  function tick() {
    request = null;
    var time = performanceNow();
    var delta = time-last;
    last = time;

    ctx.reset();

    dimensions === 2 && ctx.save();

    fn && fn.call(ctx, delta);

    dimensions === 2 && ctx.restore();
    if (autorun) {
      requestFrame();
    }
  }

  if (dimensions === 2) {
    ctx.reset = function fc_reset() {
      canvas.width = 0;
      canvas.width = window.innerWidth;
      canvas.height = window.innerHeight;
    };

    ctx.clear = function fc_clear(color) {
      var orig = ctx.fillStyle;
      ctx.fillStyle = color || "#223";
      ctx.fillRect(0, 0, canvas.width, canvas.height);
      ctx.fillStyle = orig;
    };
  } else {
    ctx.reset = function fc_reset() {
      if (canvas.width !== window.innerWidth) {
        canvas.width = window.innerWidth;
      }

      if (canvas.height !== window.innerHeight) {
        canvas.height = window.innerHeight;
      }
    }
  }

  setTimeout(tick, 0);

  ctx.dirty = function fc_dirty() {
    last = performanceNow();
    requestFrame();
  };

  ctx.stop = function fc_stop() {
    autorun = false;
    request && cancelAnimationFrame(request);
    request = null;
  };

  ctx.start = function fc_start() {
    autorun = true;
    requestFrame();
  };

  (window.attachEvent || window.addEventListener)('resize', ctx.dirty);

  // resize to fullscreen immediately
  ctx.reset();

  ctx.canvas = canvas;
  return ctx;
}
512905
static boolean functionCallHasSideEffects(
      Node callNode, @Nullable AbstractCompiler compiler) {
    checkState(callNode.isCall() || callNode.isTaggedTemplateLit(), callNode);

    if (callNode.isNoSideEffectsCall()) {
      return false;
    }

    if (callNode.isOnlyModifiesArgumentsCall()
        && allArgsUnescapedLocal(callNode)) {
      return false;
    }

    Node callee = callNode.getFirstChild();

    // Built-in functions with no side effects.
    if (callee.isName()) {
      String name = callee.getString();
      if (BUILTIN_FUNCTIONS_WITHOUT_SIDEEFFECTS.contains(name)) {
        return false;
      }
    } else if (callee.isGetProp()) {
      if (callNode.hasOneChild()
          && OBJECT_METHODS_WITHOUT_SIDEEFFECTS.contains(callee.getLastChild().getString())) {
        return false;
      }

      if (callNode.isOnlyModifiesThisCall()
          && evaluatesToLocalValue(callee.getFirstChild())) {
        return false;
      }

      // Many common Math functions have no side-effects.
      // TODO(nicksantos): This is a terrible terrible hack, until
      // I create a definitionProvider that understands namespacing.
      if (callee.getFirstChild().isName() && callee.isQualifiedName()
          && callee.getFirstChild().getString().equals("Math")) {
        switch(callee.getLastChild().getString()) {
          case "abs":
          case "acos":
          case "acosh":
          case "asin":
          case "asinh":
          case "atan":
          case "atanh":
          case "atan2":
          case "cbrt":
          case "ceil":
          case "cos":
          case "cosh":
          case "exp":
          case "expm1":
          case "floor":
          case "hypot":
          case "log":
          case "log10":
          case "log1p":
          case "log2":
          case "max":
          case "min":
          case "pow":
          case "round":
          case "sign":
          case "sin":
          case "sinh":
          case "sqrt":
          case "tan":
          case "tanh":
          case "trunc":
            return false;
          case "random":
            return !callNode.hasOneChild(); // no parameters
          default:
            // Unknown Math.* function, so fall out of this switch statement.
        }
      }

      if (compiler != null && !compiler.hasRegExpGlobalReferences()) {
        if (callee.getFirstChild().isRegExp()
            && REGEXP_METHODS.contains(callee.getLastChild().getString())) {
          return false;
        } else if (isTypedAsString(callee.getFirstChild(), compiler)) {
          // Unlike regexs, string methods don't need to be hosted on a string literal
          // to avoid leaking mutating global state changes, it is just necessary that
          // the regex object can't be referenced.
          String method = callee.getLastChild().getString();
          Node param = callee.getNext();
          if (param != null) {
            if (param.isString()) {
              if (STRING_REGEXP_METHODS.contains(method)) {
                return false;
              }
            } else if (param.isRegExp()) {
              if ("replace".equals(method)) {
                // Assume anything but a string constant has side-effects
                return !param.getNext().isString();
              } else if (STRING_REGEXP_METHODS.contains(method)) {
                return false;
              }
            }
          }
        }
      }
    }

    return true;
  }
251930
def set_pixel(framebuf, x, y, color):
        """"""
        index = (y >> 3) * framebuf.stride + x
        offset = y & 0x07
        framebuf.buf[index] = (framebuf.buf[index] & ~(0x01 << offset)) | ((color != 0) << offset)
678322
public void addFunction(IFunction function, Color color) {
        if ((function != null) && (!functions.contains(function))) {
            functions.add(function);
            colors.add(color);
        } else
            colors.set(functions.indexOf(function), color);
    }
316737
@Override
	public void set(int x, int y, int value) {
		if (!isInBounds(x, y))
			throw new ImageAccessException("Requested pixel is out of bounds: "+x+" "+y);

		data[getIndex(x, y)] = (byte) value;
	}
117083
final public void Function() throws ParseException {
 /*@bgen(jjtree) Function */
    AstFunction jjtn000 = new AstFunction(JJTFUNCTION);
    boolean jjtc000 = true;
    jjtree.openNodeScope(jjtn000);Token t0 = null;
    Token t1 = null;
    try {
      t0 = jj_consume_token(IDENTIFIER);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case COLON:
        jj_consume_token(COLON);
        t1 = jj_consume_token(IDENTIFIER);
        break;
      default:
        jj_la1[48] = jj_gen;
        ;
      }
        if (t1 != null) {
            jjtn000.setPrefix(t0.image);
            jjtn000.setLocalName(t1.image);
        } else {
            jjtn000.setLocalName(t0.image);
        }
      label_19:
      while (true) {
        MethodParameters();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case LPAREN:
          ;
          break;
        default:
          jj_la1[49] = jj_gen;
          break label_19;
        }
      }
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte000;}
      }
      if (jjte000 instanceof ParseException) {
        {if (true) throw (ParseException)jjte000;}
      }
      {if (true) throw (Error)jjte000;}
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
577182
public void update(VectorFunction function) {
        VectorIterator it = iterator();

        while (it.hasNext()) {
            double x = it.next();
            int i = it.index();
            it.set(function.evaluate(i, x));
        }
    }
637856
public void mapInPlace(Function<Double, Double> fn) {
    for (int i = 0; i < pointers.length; i++) {
      if (pointers[i] == null) continue;

      if (copyOnWrite[i]) {
        copyOnWrite[i] = false;
        pointers[i] = pointers[i].clone();
      }

      if (sparse[i]) {
        for (int j = 0; j < pointers[i].length / 2; j++) {
          pointers[i][(j * 2) + 1] = fn.apply(pointers[i][(j * 2) + 1]);
        }
      } else {
        for (int j = 0; j < pointers[i].length; j++) {
          pointers[i][j] = fn.apply(pointers[i][j]);
        }
      }
    }
  }
1019624
function fsWrite(fd, buffer, position, callback) {
  var offset = 0,
      length = buffer.length;

  function writeChunk() {
    fs.write(fd, buffer, offset, length - offset, position, function (err, bytesWritten) {
      if (err) { callback(err); return; }
      offset += bytesWritten;
      if (offset < length) {
        writeChunk();
        return;
      }
      callback();
    });
  }
  writeChunk();
}
120972
function applyToPixel(pixel, effect, result) {
  vec4TransformMat4Transposed(result, pixel, effect.colorMatrix);
  vec4.add(result, result, effect.colorOffset);
}
1248098
@Pure
	public static <P1, P2, P3, RESULT> Function2<P2, P3, RESULT> curry(final Function3<? super P1, ? super P2, ? super P3, ? extends RESULT> function,
			final P1 argument) {
		if (function == null)
			throw new NullPointerException("function");
		return new Function2<P2, P3, RESULT>() {
			@Override
			public RESULT apply(P2 p2, P3 p3) {
				return function.apply(argument, p2, p3);
			}
		};
	}
1047214
public static GenericColorChannelTransformation fromFunction(Function<Double, Double> fn){
		Objects.requireNonNull(fn);
		return fromFunctions(fn, fn, fn, fn);
	}
130116
function( fn ){
      var pass = this._private.pass.shift();

      return this.random().pass( pass ).run( fn );
    }
697713
public void drawFlash(float x,float y,float width,float height, Color col) {
		if (frames.size() == 0) {
			return;
		}
		
		if (autoUpdate) {
			long now = getTime();
			long delta = now - lastUpdate;
			if (firstUpdate) {
				delta = 0;
				firstUpdate = false;
			}
			lastUpdate = now;
			nextFrame(delta);
		}
		
		Frame frame = (Frame) frames.get(currentFrame);
		frame.image.drawFlash(x,y,width,height,col);
	}
1342980
public void elemApply(Lambda.FnIntDoubleToDouble fn) {
        for (int c=0; c<this.values.length; c++) {
            this.values[c] = fn.call(c, this.values[c]);
        }
    }
576421
function (x0, y0, x1, y1, color, c)
    {
        PixelArt.put(x, y, color, c)
        var dx = x1 - x0;
        var dy = y1 - y0;
        var adx = Math.abs(dx);
        var ady = Math.abs(dy);
        var eps = 0;
        var sx = dx > 0 ? 1 : -1;
        var sy = dy > 0 ? 1 : -1;
        if (adx > ady)
        {
            for (var x = x0, y = y0; sx < 0 ? x >= x1 : x <= x1; x += sx)
            {
                PixelArt.put(x, y)
                eps += ady;
                if ((eps << 1) >= adx)
                {
                    y += sy;
                    eps -= adx;
                }
            }
        } else
        {
            for (var x = x0, y = y0; sy < 0 ? y >= y1 : y <= y1; y += sy)
            {
                PixelArt.put(x, y)
                eps += adx;
                if ((eps << 1) >= ady)
                {
                    x += sx;
                    eps -= ady;
                }
            }
        }
    }