I'm trying to copy image contents into a canvas, pixel by pixel and I want that to be visualized while it's happening. However, the canvas just stays blank while the process is undergoing and then when it's finished, the cloned image is displayed in full. Is there any way for the canvas to be "refreshed" or "reloaded" after every pixel change?
Here is part of the code I'm using:
for (var x = 0; x < w; x++) {
for (var y = 0; y < h; y++) {
ctx2.putImageData(ctx1.getImageData(x,y,1,1),x,y);
}
}
...where ctx1 is the context object of the original and ctx2 - context object of the clone. I'm interested in this only for visualization purposes. I'm aware it's probably not quite efficient.