Hi, not very good at Processing as you'll tell from my code.
I'm trying to create a colour corrector in which you change the RGB values by clicking a plus or minus button.
I however can't figure out how to define or connect my mouse clicks to the right buttons. Let alone make those buttons change it's respective RGB value of the image.
- PImage Mushrooms;
- PImage Mushrooms2;
- void setup() {
- Mushrooms = loadImage ("Mushrooms.jpg");
- int dimension = (Mushrooms.width*Mushrooms.height);
- Mushrooms2 = createImage(Mushrooms.width,Mushrooms.height,RGB);
- size(Mushrooms.width*2,Mushrooms.height);
- Mushrooms.loadPixels();
- Mushrooms2.loadPixels();
- for (int i=0; i < dimension; i+=1) {
- Mushrooms2.pixels[i] = color( red(Mushrooms.pixels[i]), green(Mushrooms.pixels[i]), blue(Mushrooms.pixels[i]));
- }
- image(Mushrooms,0,0);
- image(Mushrooms2,1024,0);
- }
- void draw() {
- rectMode(CENTER);
- //Red
- fill(255,0,0);
- rect(Mushrooms.width/4,700,50,50);
- rect(Mushrooms.width/4,640,50,50);
- //Plus
- fill(0,0,0);
- rect(Mushrooms.width/4,640,30,8);
- rect(Mushrooms.width/4,640,8,30);
- //Minus
- rect(Mushrooms.width/4,700,30,8);
- //Green
- fill(0,255,0);
- rect(Mushrooms.width/2,700,50,50);
- rect(Mushrooms.width/2,640,50,50);
- //Plus
- fill(0,0,0);
- rect(Mushrooms.width/2,640,30,8);
- rect(Mushrooms.width/2,640,8,30);
- //Minus
- rect(Mushrooms.width/2,700,30,8);
- //Blue
- fill(0,0,255);
- rect(Mushrooms.width/1.30,700,50,50);
- rect(Mushrooms.width/1.30,640,50,50);
- //Plus
- fill(0,0,0);
- rect(Mushrooms.width/1.3,640,30,8);
- rect(Mushrooms.width/1.3,640,8,30);
- //Minus
- rect(Mushrooms.width/1.3,700,30,8);
- //Reset Button
- //Rectangle
- fill(255,255,0);
- rect(1536,675,100,100);
- //Circle
- fill(0,0,0);
- ellipse(1536,675,75,75);
- //Text
- fill(255,255,255);
- textMode(CENTER);
- text("RESET",1518,680);
- }
Mushrooms2 is the image I want to have the RGB values changed and Mushrooms I want to keep as a base, with the original information.
any help would be greatly appreciated.
Akash
1