I played with the canvas element and found that when I try to draw NxN homogeneous solid cells next to each other, in some configurations of width and height there are blurred white lines between them.
For example, this canvas should look black, but it contains some kind of grid, which, I assume, is the result of erroneous anti-aliasing in the browser.

Suffice it to say that this error appears only in some configurations, but I would like to get rid of it forever. Is there any way around this? Have you had problems with smoothing in the canvas?
I made this script that demonstrates the problem and allows you to play with canvas sizes and number of cells. It also contains code that I use to draw cells so you can check it out and tell me that I'm doing something wrong.
var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvasWidth, canvasHeight); for (var i = 0; i < numberOfCells; ++i) { for (var j = 0; j < numberOfCells; ++j) { ctx.fillStyle = '#000'; ctx.fillRect(j * cellWidth, i * cellHeight, cellWidth, cellHeight); } }
Thanks in advance,
Peter.
source share