i am trying to make it so that the program takes an image posterizes it a bit and then turns it all black and then all white using threshold but i am facing problems going further than just doing the threshold part so here is my code any help would be appreciated and thanks.
PImage source; // Source image
PImage destination; // Destination image
//boolean threshold=false;
void setup() {
size(800, 800);
source = loadImage("_MG_4515.jpg");
// The destination image is created as a blank image the same size as the source.
Hi all I am very new to this world of processing which i am taking at university. i am severely stuck in one of my assignments to make buttons. i cant seem make the the shapes stay once clicked on the buttons and even though i have figured out why the progrm generates both an ellipse and a rectangle i cant figure out how to make them come up individually below is my code any help would be apriciated
float x = 40;
float y = 50;
float w = 80;
float h = 60;
float x2= 400;
float y2= 50;
float w2=80;
float h2=60;
float x3=200;
float y3=50;
float h3=20;
float w3= 20;
float x4=200;
float y4=70;
float w4=20;
float h4=20;
float x5=200;
float y5= 90;
float w5=20;
float h5=20;
void setup() {
size(500, 500);
background(255);
stroke(0);
noFill();
}
void draw() {
background(255);
rect(x, y, w, h);
String s= "square";
fill(0);
text (s, x,y,w,h);
fill(255);
if (mousePressed) {
if (mouseX>x && mouseX<x+w && mouseY>y && mouseY<y+h) {
fill (50, 0, 50);
rect (300, 300, 200, 200);
}
else {
fill(0);
}
}
rect (x2, y2, w2, h2);
String s2= "circle";
fill (0, 0, 50);
text (s2,x2,y2,w2,h2);
fill(0, 50, 0);
if (mousePressed) {
if (mouseX>x2 && mouseX<x2+w && mouseY>y2 && mouseY<y2+h) {
fill(60, 0, 0);
ellipse (300, 300, 200, 200);
}
}
fill(50, 0, 0);
rect (x3, y3, w3, h3);
String s3="R";
fill(255);
text (s3,x3,y3,w3,h3);
if (mousePressed) {
if (mouseX>x3 && mouseX<x3+w && mouseY>y3 && mouseY<y3+h) {
fill(50,0,0);
ellipse (300,300,200,200);
rect (300,300,200,200);
}
}
fill(0, 50, 0);
rect(x4, y4, w4, h4);
String s4="G";
fill(255);
text (s4,x4,y4,w4,h4);
if (mousePressed) {
if (mouseX>x4 && mouseX<x4+w && mouseY>y4 && mouseY<y4+h) {
fill(0,50,0);
ellipse (300,300,200,200);
rect (300,300,200,200);
}
}
fill(0, 0, 50);
rect (x5, y5, w5, h5);
String s5="B";
fill(255);
text (s5,x5,y5,w5,h5);
if (mousePressed) {
if (mouseX>x5 && mouseX<x5+w && mouseY>y5 && mouseY<y5+h) {