椭圆与圆
Canvas canvas = Canvas.createIfSupported();
canvas.setWidth("200px");
canvas.setHeight("200px");
RootPanel.get().add(canvas);
Context2d context = canvas.getContext2d();
context.setStrokeStyle("black");
context.arc(50, 50, 20, 0, Math.PI*2);
context.stroke();
为什么我这里有椭圆而不是圆形?
Canvas canvas = Canvas.createIfSupported();
canvas.setWidth("200px");
canvas.setHeight("200px");
RootPanel.get().add(canvas);
Context2d context = canvas.getContext2d();
context.setStrokeStyle("black");
context.arc(50, 50, 20, 0, Math.PI*2);
context.stroke();
Why I have ellipse instead of circle here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还必须设置坐标空间,以使其与画布的纵横比相匹配。因此您可以添加以下几行:
You'll also have to set the coordinate space, to make it match the aspect ratio of your canvas. So you can add the following lines: