I'm facing an apparently known problem, in which lines in HTML canvases cannot disable antialiasing (e.g. this question mentions this can only be done for images using context.imageSmoothingEnabled= false
, but not for lines).
I wonder if there is any update on this, and if it is possible to draw a crisp (even if "pixelated") line? All I'd need is what e.g. MS Paint is able to achieve when using the plain "pencil" tool (cf. left-side stroke below), instead of a smoother "brush" type (cf. right-side stroke).
Currently, the lines in my HTML canvas look more like the "brush" type.
It is an issue, because I'm trying to set a mouse-event that gives me the exact color of the line, but with the antialiasing surrounding the actual color, it returns some undesired color(s) before the cursor reaches the center part of the line.
Could someone confirm that there is really no way to force a "pencil"-like stroke in the canvas? If so, is there maybe a simple workaround, to e.g. "cut off" the edges of the stroke?