//Created by Robert Wise //Submitted for Processing Assignment 10.27.09 int h = 2, dimension; PImage img; void setup() { //Make size smaller than image so centering doesn't show past edges. size(480,480); background(0); colorMode(HSB,360,100,100); //Set color mode to HSB and set increments for hue, saturation and brightness noStroke(); img = loadImage("sun.jpg"); //Setting img variable value dimension = img.height * img.width; image(img,0,0); //load background sun image frameRate(10000); } //Keeps the motor running void draw() { } //Re-centers image where mouse is pressed, resets when one of the called keys is pressed. void mousePressed() { if (mousePressed == true ){ image(img, mouseX-256, mouseY-256); } } void keyPressed() { if (key == 'h') { img.loadPixels(); //increments hue 30 degrees // % makes sure hue never grows beyond 360 for (int i=0; i < dimension; i++) { img.pixels[i] = color((hue(img.pixels[i])+30)%360, saturation(img.pixels[i]), brightness(img.pixels[i])); } img.updatePixels(); image(img, 0, 0); } if (key == 's') { img.loadPixels(); //increments saturation 20 degrees // % makes sure Saturation never grows beyond 100 for (int i=0; i < dimension; i++) { img.pixels[i] = color((hue(img.pixels[i])), (saturation(img.pixels[i]+20)%100), brightness(img.pixels[i])); } } if (key == 'b') { img.loadPixels(); //increments brightness 60 degrees // % makes sure brightness never grows beyond 100 for (int i=0; i < dimension; i++) { img.pixels[i] = color((hue(img.pixels[i])), (saturation(img.pixels[i])), brightness(img.pixels[i]-1)%100); } } img.updatePixels(); image(img, 0, 0); }