我可以关闭 HTML <canvas> 上的抗锯齿功能吗?元素? [英] Can I turn off antialiasing on an HTML <canvas> element?
本文介绍了我可以关闭 HTML <canvas> 上的抗锯齿功能吗?元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在玩<canvas>
元素、画线等.
I'm playing around with the <canvas>
element, drawing lines and such.
我注意到我的对角线是抗锯齿的.我更喜欢锯齿状的外观 - 有没有办法关闭此功能?
I've noticed that my diagonal lines are antialiased. I'd prefer the jaggy look for what I'm doing - is there any way of turning this feature off?
推荐答案
对于图像,现在有 context.imageSmoothingEnabled
= false
.
但是,没有什么可以明确控制线条绘制.您可能需要使用 getImageData<绘制自己的线条(困难的方法)/code> 和
putImageData
.
However, there's nothing that explicitly controls line drawing. You may need to draw your own lines (the hard way) using getImageData
and putImageData
.
这篇关于我可以关闭 HTML <canvas> 上的抗锯齿功能吗?元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文