Avoiding lines between adjecent svg rectangles

two hardware vertical pixels per software exposed pixel

No that’s wrong.

When you specify a coordinate like “81” in an SVG, that coordinate falls on the imaginary line between pixel 80 and 81. If your line has width “1”, then the renderer will attempt to draw that by placing 50% of the colour on the 80 pixel and 50% on the 81 pixel. This is anti-aliasing. If you want the one pixel line to not be anti-aliased like that, give it coordinate 81.5. That way the whole line will fall within pixel 81.

However if your line had width 2 (or any other even width) you should not use 81.5 but stay with 81. Because it will render 50% (ie. 1) in pixel 80 and 50% (1) in pixel 81. Resulting in no anti-aliasing effect.

enter image description here

This applies for both horizontal and vertical lines. And applies whether you are on an LCD or old CRT.

Does this explanation make sense now?

Leave a Comment