Help! Can't solve errors in code

edited November 2017 in Questions about Code

boolean PicLoaded = false;

boolean Grayscale = false;

boolean Effect1 = false;

boolean Effect2 = false;

boolean Effect3 = false;

int picWidth = 0;

int picHeight = 0;

PImage img;

float rando;

int choices = 6;

int colorChoice = 1;

fill(#EA0202); //Effect on means a red lighted button

else

fill(255);

rect(660, 200, 130, 40, 10);

fill(55);

text("Grayscale", 680, 225);

if (Effect1)

fill(#EA0202); //Effect on means a red lighted button

else

fill(255);

rect(660, 250, 130, 40, 10);

fill(55);

text("Color Static", 680, 275);

if (Effect2)

fill(#EA0202); //Effect on means a red lighted button

else

fill(255);

rect(660, 300, 130, 40, 10);

fill(55);

text("-----", 680, 325);

if (Effect3)

fill(#EA0202); //Effect on means a red lighted button

else

fill(255);

rect(660, 350, 130, 40, 10);

fill(55);

text("Reverse", 680, 375);

rando = random(choices);

r = red(pixels[i]);

g = green(pixels[i]);

b = blue(pixels[i]);

if (int(rando) == 1) {

pixels[i] = color(b, r, g); //Sets pixels to a rearranged RGB structure } else if (int(rando) == 2) {

pixels[i] = color(g, b, r); //Sets pixels to a rearranged RGB structure } else if (int(rando) == 3) {

pixels[i] = color(g, r, b); //Sets pixels to a rearranged RGB structure } else if (int(rando) == 4) {

pixels[i] = color(b, g, r); //Sets pixels to a rearranged RGB structure } else if (int(rando) == 5) {

pixels[i] = color(r, b, g); //Sets pixels to a rearranged RGB structure } else if (int(rando) == 6) {

pixels[i] = color(r, g, b); //Sets pixels to a RGB structure }

if (keyPressed) /* Gets rid of either one of the RGB pixels and sets it to 0 based on keypress */ {

if (key == '1') {

choices = 1;

}

if (key == '2') {

choices = 2;

}

if (key == '3') {

choices = 3;

}

if (key == '4') {

choices = 4;

}

if (key == '5') {

choices = 5;

}

if (key == '6') {

choices = 6;

}

}

i = i + 1;

if (i % width >= picWidth) {

i = i + width - picWidth;

}

updatePixels();

redraw();

{

if (Effect2) {

loadPixels();

int i = picStart;

int j = 0;

while (i < picEnd) {

float r, g, b;

r = red(pixels[i]);

g = green(pixels[i]);

b = blue(pixels[i]);

pixels[i] = color(r, g, b);

if (j <= 255 && colorChoice == 1) {

pixels[i] = color(j, g, b);

} else if (j <= 255 && colorChoice == 2) {

pixels[i] = color(r, j, b);

} else if (j <= 255 && colorChoice == 3) {

pixels[i] = color(r, g, j);

} else {

j = 0;

if (colorChoice == 3) {

colorChoice = 1;

} else {

colorChoice = colorChoice + 1;

}

}

j = j + 1;

i = i + 1;

if (i % width >= picWidth) {

i = i + width - picWidth;

}

println(colorChoice + " " + j);

}

}}

Answers

  • Three things:

    DON'T SHOUT

    edit your post, highlight the code and press ctrl-o to format.

    Tell us more about what you expect the code to do and what is doing instead. If there are errors shown on the console then tell us the errors.

Sign In or Register to comment.