我可以关闭HTML< canvas>元件? [英] Can I turn off antialiasing on an HTML <canvas> element?

查看:122
本文介绍了我可以关闭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

For images there's now context.imageSmoothingEnabled= false.

然而,没有什么明确控制线条画。您可能需要使用<$ c $来绘制自己的线条(难的方式) c> getImageData 和 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&lt; canvas&gt;元件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆