如何在HTML画布上绘制圆角矩形? [英] How to draw a rounded Rectangle on HTML Canvas?

查看:161
本文介绍了如何在HTML画布上绘制圆角矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现只有可以填充矩形,但没有圆角一个,我该怎么办呢?

解决方案

Canvas不提供绘制圆角矩形的方法。



如何使用 lineTo() code> arc()方法?



或者,也可以使用 quadraticCurveTo c $ c>方法 arc()方法。



http://www.html5.jp/canvas/ref/method/sample/quadraticCurveTo2.html p>

I found that there are only can fill rectangle, but no rounded corner one, how can I do that?

解决方案

Canvas doesn't provide a method which draw a rounded corner rectangle.

How about using lineTo() and arc() methods ?

Or, You can also use quadraticCurveTo() method instead arc() method.

http://www.html5.jp/canvas/ref/method/sample/quadraticCurveTo2.html

这篇关于如何在HTML画布上绘制圆角矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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