Hello, I’m trying to create a photo filter app using controlP5 buttons.
How can I make it work?
I have tried this (thinking how I built a filter app before using the keyboard), but it doesn’t work, seems like I still don’t understand it.
boolean imgPRCS[] = new boolean [2];
PImage foto;
import controlP5.*;
ControlP5 cp5;
void setup() {
size(550, 550);
noFill();
foto= loadImage("foto.jpg");
foto.resize(width, height);
cp5 = new ControlP5(this);
ButtonBar b = cp5.addButtonBar("bar")
.setPosition(0, 0)
.setSize(550, 20)
.addItems(split("a b c d e f g h i j"," "))
;
println(b.getItem("a"));
b.changeItem("a","text","choose");
b.changeItem("b","text","upload");
b.changeItem("c","text","fliter1");
{
filter(GRAY);}
b.changeItem("d","text","fliter");
b.changeItem("e","text","fliter3");
b.changeItem("f","text","fliter4");
b.changeItem("g","text","fliter");
b.changeItem("h","text","fliter");
b.changeItem("i","text","fliter");
b.changeItem("j","text","fliter");
b.onMove(new CallbackListener(){
public void controlEvent(CallbackEvent ev) {
ButtonBar bar = (ButtonBar)ev.getController();
println("hello ",bar.hover());
}
});
}
void bar(int n) {
println("bar clicked, item-value:", n);
}
void draw() {
background(220);
image(foto, 0, 0);
}