/** * A TV simulator, drawing in only red, green and blue. * Inspired by a sequence in the film 'Zidane: a 21st Century Portrait'. * My first Processing sketch! *
  • First, CLICK in the image to get 'focus'. *
  • Move the mouse over the picture left/right to change the brightness. *
  • Click in the picture for focus, then use the R, G and B keys to toggle cells. *
  • Press 1, 2, 3, 4 to change the channel. *
  • Aaron Bell Oct06, finally published Feb08 :-O */ PImage a; float BRIGHTNESS; int MAX_BRIGHTNESS=2; // used to scale the brightness by mouse position int BRIGHTNESS_COEFF; // how much to scale the brightness float perlin_delta=0.3; // higher = more random interference float perlin_pos=0.0; int CELL_WIDTH=5; int CELL_HEIGHT=4; boolean redOn = true; boolean greenOn = true; boolean blueOn = true; boolean mouseEverMoved = false; void setup() { a = loadImage("rgbtest150.jpg"); // fix the size for a correct Processing export: size(750,452); // ...because this will be very large for most images: size(a.width * CELL_WIDTH, a.height * CELL_HEIGHT); BRIGHTNESS_COEFF=(a.width * CELL_WIDTH)/MAX_BRIGHTNESS; background(0); frameRate(8); BRIGHTNESS = 1.5; drawRgb(CELL_WIDTH, CELL_HEIGHT); } void changeChannel(String file) { a = loadImage(file); } void drawRgb(int cellWidth, int cellHeight) { for (int y=0; y