如何使用 HTML Canvas 绘制圆角矩形? [英] How to draw a rounded rectangle using HTML Canvas?
本文介绍了如何使用 HTML Canvas 绘制圆角矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HTML Canvas 提供了绘制矩形的方法,fillRect()
和 strokeRect()
,但是我找不到制作带有圆角的矩形的方法.我该怎么做?
HTML Canvas provides methods for drawing rectangles, fillRect()
and strokeRect()
, but I can't find a method for making rectangles with rounded corners. How can I do that?
推荐答案
HTML5 画布不提供绘制圆角矩形的方法.
The HTML5 canvas doesn't provide a method to draw a rectangle with rounded corners.
如何使用 lineTo()代码>
和arc()代码>
方法?
How about using the lineTo()
and arc()
methods?
您还可以使用 quadraticCurveTo()
方法而不是 arc()
方法.
You can also use the quadraticCurveTo()
method instead of the arc()
method.
这篇关于如何使用 HTML Canvas 绘制圆角矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文