半圆怎么画
我正在用 Java 开发一个小型应用程序。我正在使用 Java2D 库来绘制一些图形对象。现在我想绘制一些类似半圆的形状,或者简单地说我需要绘制这个 (
形状和这个 )
形状。我没有找到任何绘制半圆的函数,但我猜想 Arc2D.Double(...);
对我有用,所以我尝试了它,但我不明白我需要传递给它的构造函数哪些参数。所以我最终得到了一种奇怪的形状:(
有人可以详细解释这些参数或参考一些好的链接吗?
I am developing a small application in Java. I am using Java2D Library for drawing some graphical objects. Now i want to draw some semi-circle like shape or in simple words i need to draw this (
shape and this )
shape. I didn't find any function for drawing semi-circle, but i guess that Arc2D.Double(. . .);
will work for me, so i tried it but i didn't understand what params i need to pass to its constructor. So i end up with the strange kind of shape :(
Could some one explains these params in detail or refer to some good link.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
绘制
(
而对于
)
参数解释如下:Arc2D.Double
我这里使用的方法是:Arc2D.Double(double, double, double, double, double, double, int)
这个链接也可以提供帮助。
To draw
(
And for
)
The parameters are explained here: Arc2D.Double
The method I have used here is: Arc2D.Double(double, double, double, double, double, double, int)
This link can also help.
你需要使用
http://download.oracle.com /javase/6/docs/api/java/awt/geom/Arc2D.Double.html。
x,y
- 位置 (x,y),w, h
- 大小,start,extent
- 角度范围(您需要 |extent - start| = 180)You need use
http://download.oracle.com/javase/6/docs/api/java/awt/geom/Arc2D.Double.html.
x,y
- location (x,y),w, h
- size ,start, extent
- angular extents (you need |extent - start| = 180)