Hello i have a sketching application i created but i need to able to allow the user to save the image they created from a web browser? I tried looking at save(); saveFrame();
createOutput(); but i dont think they can be used from a web browser im stuck and in need of a savior please help. Here is the code i have already.
boolean mouseup=false;
int lineThickness;
int bColor=0;
void setup() {
size(600,625);
background(255);
eraserbut= new Button(10,460,50,50,200,"b4");
eraseCanvas= new Button(10,515,50,50,150,"Full Erase");
redbut= new Button(70, 460, 75, 75, #FF0000, "rb1");
grnbut= new Button(155, 460, 75, 75, #00FF00, "b2");
blubut= new Button(240,460,75,75,#0000FF,"b3");
oranbut= new Button(325,460,75,75,#FFBC00,"Orange");
yelbut= new Button(410,460,75,75,#FEFF00,"Yellow");
viobut= new Button(495,460,75,75,#F200FF,"Violet");
strokeSize1= new Button(80,545,15,15,100,"5");
strokeSize2= new Button(105,545,15,25,100,"10");
strokeSize3= new Button(140,545,15,35,100,"15");
strokeSize4= new Button(185,545,15,45,100,"Violet");
strokeSize5= new Button(240,545,15,55,100,"Violet");
redbut.update();
if (redbut.isClicked(mouseup)) {
bColor=1;
printMyLine("Red has been clicked"+ bColor);
}
grnbut.update();
if (grnbut.isClicked(mouseup)) {
bColor=2;
printMyLine("Green has been clicked");
}
blubut.update();
if (blubut.isClicked(mouseup)) {
bColor=3;
printMyLine("Blue has been clicked");
}
eraserbut.update();
if (eraserbut.isClicked(mouseup)) {
bColor=4;
printMyLine("eraser button has been clicked");
}
eraseCanvas.update();
if (eraseCanvas.isClicked(mouseup)) {
background(255);
printMyLine("erase has been clicked");
}
oranbut.update();
if (oranbut.isClicked(mouseup)) {
bColor=5;
printMyLine("b2 has been clicked");
}
yelbut.update();
if (yelbut.isClicked(mouseup)) {
bColor=6;
printMyLine("b2 has been clicked");
}
viobut.update();
if (viobut.isClicked(mouseup)) {
bColor=7;
printMyLine("b2 has been clicked");
}
strokeSize1.update();
if (strokeSize1.isClicked(mouseup)) {
lineThickness=1;
printMyLine("sroke 5 has been clicked");
}
strokeSize2.update();
if (strokeSize2.isClicked(mouseup)) {
lineThickness=5;
printMyLine("stroke 10 has been clicked");
}
strokeSize3.update();
if (strokeSize3.isClicked(mouseup)) {
lineThickness=10;
printMyLine("stroke 15 has been clicked");
}
strokeSize4.update();
if (strokeSize4.isClicked(mouseup)) {
lineThickness=15;
printMyLine("stroke 15 has been clicked");
}
strokeSize5.update();
if (strokeSize5.isClicked(mouseup)) {
lineThickness=20;
printMyLine("stroke 15 has been clicked");
}
/*
savbut.update();
if (savbut.isClicked(mouseup)) {
save("test.jpeg");
printMyLine("save has been clicked");
}*/
void update() {
over();
pressed();
//this is where you would change colors for the over and down states
if (pressed) {
val=100;
}
else {
val=orgVal;
}
noStroke();
fill(255);
rect(xpos-2, ypos+2, wid, hig);
fill(val);
rect(xpos,ypos,wid,hig);
}