/// Danny Rozin ITP 2012 // The next line is needed if running in JavaScript Mode with Processing.js /* @pjs preload="http://www.usd314.k12.ks.us/5and6/five/Rachel/BW-kitten.jpg"; */ PImage ourImage; void setup(){ size(640,480); ourImage= loadImage("http://www.usd314.k12.ks.us/5and6/five/Rachel/BW-kitten.jpg"); ourImage.resize(width, height); } void draw(){ ourImage.loadPixels(); loadPixels(); for (int x=0;x< ourImage.width; x++) { for (int y=0;y< ourImage.height; y++) { int thisPixel= (x+ y*ourImage.width); color ColorFromImage= ourImage.pixels[thisPixel]; float pixelR= red(ColorFromImage); float pixelG= green(ColorFromImage); float pixelB= blue(ColorFromImage); pixelR+=mouseX; pixelG+=mouseX; pixelB+=mouseX; color newColor= color(pixelR,pixelG,pixelB); pixels[thisPixel]= newColor; } } updatePixels(); }