Let's say I have a canvas and I want to change the color of a SINGLE pixel on that canvas, and have that new pixel appear on screen as the new color. I was thinking of changing the image data and re-rendering the entire canvas using the new image data, but perhaps it's faster to simply render a 1x1 pixel rectangle over that spot? Or maybe draw a line with equal starting and ending points?
My use case is layering many canvases on top of each other. I will be changing single pixels on these canvases extremely frequently (sometimes thousands of times per second) and I want perfectly smooth performance. I'm deciding between using off screen canvases, images, or simply rendering shapes on top of them. Each has their pros and cons convenience-wise, but what's the absolute most efficient way?
If I chose to render shapes on them, I would still modify their image data, I would simply save myself having to re-render that entire canvas/image. No matter what I'll need to keep track of pixel data (for cases where I need to do a full re-render of the screen), but I'm just wondering which means of rendering is the fastest. Perhaps the changing of the image data alone is enough to slow it down significantly? I'm not sure. Any input is greatly appreciated, even if it's not an answer.