Paint Program
in
Contributed Library Questions
•
1 year ago
So for my first real project in processing, I decided to go simple, and make paint. I have already finished and moved on, but there are still some things I would like to work out. The main thing I want to add is an "eyedropper" tool. I've tried many different codes that work in my mind, but I just can't seem to get it to run properly. I've already tried storing the color to a variable. I'm using controlP5 for the color picker.
- import controlP5.*;
- ControlP5 slider;
- int r = 255;
- int g = 255;
- int b = 255;
- float s = 50;
- float br=0;
- float bg=0;
- float bb=0;
- void setup()
- {
- size(screen.width,screen.height);
- smooth();
- frameRate(500);
- background(br,bg,bb);
- strokeWeight(50);
- stroke(255,0,0);
- cursor(CROSS);
- slider=new ControlP5(this);
- slider.addSlider("r",0,255,10,10,255,30);
- slider.addSlider("g",0,255,10,50,255,30);
- slider.addSlider("b",0,255,10,90,255,30);
- slider.addSlider("s",0,100,10,130,255,30);
- slider.addSlider("br",0,255,10,610,255,30);
- slider.addSlider("bg",0,255,10,650,255,30);
- slider.addSlider("bb",0,255,10,690,255,30);
- }
- void draw()
- {
- noStroke();
- fill(0);
- rect(0,0,350,height);
- fill(r,g,b);
- ellipse(100,300,s,s);
- fill(br,bg,bb);
- ellipse(100,500,50,50);
- stroke(r,g,b);
- strokeWeight(s);
- if (mousePressed == true&&mouseX>350)
- {
- line(mouseX,mouseY,pmouseX,pmouseY);
- }
- }
- void keyPressed()
- {
- if(keyCode==' ')
- {
- background(br,bg,bb);
- }
- }
1