Drawing a 1px thick line in canvas creates a 2px thick line

前端 未结 8 1798
抹茶落季
抹茶落季 2020-12-08 04:01

In this jsfiddle there\'s a line with a lineWidth of 1.

http://jsfiddle.net/mailrox/9bMPD/350/

e.g:

ctx.lineWidth = 1;

How

8条回答
  •  爱一瞬间的悲伤
    2020-12-08 04:24

    Or as this answer states, to get a width of 1, you need to start at a half pixel.

    ctx.moveTo(50.5,150.5);
    ctx.lineTo(150.5,150.5);
    

    http://jsfiddle.net/9bMPD/355/

提交回复
热议问题