i've been trying to run the following code using processing.js however it just gets me a grey window. I think it's because its not accessing correctly to the image pixels[].
PImage img;
void setup() { // this is run once.
size(600, 400);
img=loadImage("http://c.tadst.com/gfx/600x400/int-mountain-day.jpg?1");
}
void draw() { // this is run repeatedly.
int dimension = (img.width*img.height);
img.loadPixels();
for (int i=0; i < dimension; i+=2) {
img.pixels[i] = color(0, 0, 0);
}
img.updatePixels();
image(img, 0, 0);
}
the code is running here http://sketchpad.cc/sp/pad/view/ro.TExeW6NhoU8/rev.163