I’ve been having problems plotting points using getImageData and setImageData. Specifically, it sometimes works, but for no apparent reason, sometimes it doesn’t. For example, consider the following code :
createCanvas(“1”, 320, 450);
setFillColor(“black”);
rect(0, 0, 320, 450);
…
setStrokeColor(rgb(xcurrent * reddelta, greendelta * i, (450 - ycurrent) * bluedelta));
//Plot a point
line(xcurrent, ycurrent, xcurrent, ycurrent);
The above works. But, If I replace the above with the equivalent imageData code :
createCanvas(“1”, 320, 450);
setFillColor(“black”);
rect(0, 0, 320, 450);
var Sieveimage = getImageData(0, 0, 320, 450);
…
setRGB(Sieveimage, xcurrent, ycurrent, xcurrent * reddelta, greendelta * i, (450 - ycurrent) * bluedelta, 255);
…
putImageData(Sieveimage, 0, 0);
The above does not work – nothing ever gets displayed on the screen.
I’ve written code that works fine with imageData but for some reason it’s not working now.
Might anyone know what the problem is? Any help would be greatly appreciated.
Thanks,
jdb2
I’m teaching my nephew how to program using fractal plotting algorithms as examples.
The link to the working version of the code is here : 
Now that I have infinite zoom capability, I initially load that image from my Photobucket acount using drawImageURL(). The problem is that the only way to clear the screen after using drawImageURL() is to manually use setRGB() to set each pixel to white.