This line:
if(screenImg.pixels[i] != color(255, 0, 0));//if not red
seems not to be working since i always get this in console:
debug: changed 10000 values
I have been trying stuff for at least a hour now but i can't seem to get it fixed.
What is wrong?
if(screenImg.pixels[i] != color(255, 0, 0));//if not red
seems not to be working since i always get this in console:
debug: changed 10000 values
I have been trying stuff for at least a hour now but i can't seem to get it fixed.
What is wrong?
- PImage screenImg;
int[] heightValues;
void setup() {
size(100, 100);
noLoop();
heightValues = new int[width * height];
}
void draw() {
background(255, 0, 0);
fill(0);
ellipse(50, 50, 50, 50);
addValues(20);
}
void addValues(int theValueToAdd) {
int c = 0;//debug count
loadPixels();
screenImg = get(0, 0, width, height);
screenImg.loadPixels();
println(screenImg.pixels[5000]);
println(color(255, 0, 0));
for(int i = 0; i < screenImg.pixels.length; i++) {
if(screenImg.pixels[i] != color(255, 0, 0));//if not red
heightValues[i] = theValueToAdd;
c++;
}
println("debug: changed "+ c +" values");
}
1

