//Anders Joura //10/27/09 //This program takes a particularly ferocious Aztec painting and, when the //mouse is clicked, puts an ellipse at the point clicked, creates a //Bezier-based shape radiating from the disco-ball like object in the //center of the painting to the point clicked, and scatters around several //ellipses besides. All pixels that fall within these shapes turn //(appropriately enough for the Aztecs) various shades of blood red. The //picture can be put back to normal by pressing the "a" key. The program is //best experienced clicking in a wide circle around the disco ball. PImage img; void setup() { size(1433,691); background(0); colorMode(HSB,360,100,100); noStroke(); smooth(); img = loadImage("AZTEC.png"); image(img,0,0); } void draw() { } void mousePressed() { int h, b, j, i, currentIndex = mouseX-1 + (mouseY-1)*img.width; color currentPixelColor; img.loadPixels(); for (h=0,b=0,j = 0; j<3; j++) { for (i = 0; i<3; i++) { h += hue(img.pixels[currentIndex+i]); b += brightness(img.pixels[currentIndex+i]); } } fill(color(h*70,constrain(b*9+20,0,100), 100,70)); ellipse(mouseX, mouseY, random(10, 80), random(10, 80)); ellipse((mouseX*random(0.3, 0.7)), (mouseY*random(0.2, 0.8)), random(30,20), random(10,40)); ellipse((mouseX*random(0.7, 0.8)), (mouseY*random(0.2, 0.9)), random(10,50), random(10,25)); ellipse(mouseX*(random(3,6)), (mouseY*random(2,5)), random(20,30), random(20,40)); ellipse(mouseX*(random(1,7)), (mouseY*random(4,5)), random(20,30), random(20,40)); bezier(mouseX, mouseY, random(400,800), random(400,800), random(600,1000), random(600,1000), 735, 210); } void keyPressed() { if (key=='a') { image(img, 0, 0); } }