如何使用.slib文件中的ARC坐标在QT中绘制ARC?
我试图通过阅读.slib
file。 但是,我从.slib
文件中读取arc
相关的坐标时遇到了问题。
我不明白如何使用这些坐标并绘制弧线?
.slib文件中的弧的格式令人困惑。
.slib
arc
的格式和line
line (66 * SCALE, 80 * SCALE, 0 * SCALE, 80 * SCALE);
line (94 * SCALE, 70 * SCALE, 62 * SCALE, 70 * SCALE);
.
.
arc (145 * SCALE, 100 * SCALE, 94 * SCALE, 70 * SCALE,94.9268 * SCALE,126.774 * SCALE);
arc (94 * SCALE, 130 * SCALE, 145 * SCALE, 100 * SCALE,94.9268 * SCALE, 73.2256 * SCALE);
arc (61 * SCALE, 130 * SCALE, 61 * SCALE, 70 * SCALE,8.75 * SCALE, 100 * SCALE);
1st行说,从O(145,100)绘制弧线F(94,70)
第二行说,从L(94,130)到O(145,100)
绘制弧线 第三行说,从k(62,30)绘制弧线到e(62,70),
我试图通过使用第1个4坐标来绘制弧线(但不知道如何使用剩余的2个坐标?)
QPainterPath path; // arc from L ---> F
path.moveTo(94,70);
QRect bound1 (44,70,102,60);
path.arcTo(bound1,90,-180);
QPainterPath path1; // arc from K ---> E
path1.moveTo(62,70);
QRect bound2 (42,70,40,60);
path1.arcTo(bound2,90,-180);
我得到了以下输出:
但是,
输入线或门没有附加到 第一弧
我只使用前四个坐标。如何使用剩余的2个坐标绘制弧?
那么如何使用.slib
的所有给定的坐标绘制arc
?
注意:比例在文件开始时定义。
I am trying to generate various gate symbols
( AND,NOT,XNOR,MUX etc) by reading .slib
file.
But I faced a problem while reading an arc
related co-ordinate from .slib
file.
I am not understanding how to use those co-ordinates and draw an arc ?
The format of an arc in .slib file is confusing.
.slib
format for an arc
and for line
line (66 * SCALE, 80 * SCALE, 0 * SCALE, 80 * SCALE);
line (94 * SCALE, 70 * SCALE, 62 * SCALE, 70 * SCALE);
.
.
arc (145 * SCALE, 100 * SCALE, 94 * SCALE, 70 * SCALE,94.9268 * SCALE,126.774 * SCALE);
arc (94 * SCALE, 130 * SCALE, 145 * SCALE, 100 * SCALE,94.9268 * SCALE, 73.2256 * SCALE);
arc (61 * SCALE, 130 * SCALE, 61 * SCALE, 70 * SCALE,8.75 * SCALE, 100 * SCALE);
1st line says draw an arc from O (145,100) to F(94,70)
2nd line says draw an arc from L(94,130) to O(145,100)
3rd line says draw an arc from K(62,30) to E(62,70)
I tried to draw an arc by using 1st 4 co-ordinates from line ( but do not know how to use remaining 2 co-ordinates ? )
QPainterPath path; // arc from L ---> F
path.moveTo(94,70);
QRect bound1 (44,70,102,60);
path.arcTo(bound1,90,-180);
QPainterPath path1; // arc from K ---> E
path1.moveTo(62,70);
QRect bound2 (42,70,40,60);
path1.arcTo(bound2,90,-180);
And I got following output :
But,
Input lines to OR gate are not attached to
1st arc.
I am using only first four co-ordinates. How to use remaining 2 co-ordinates to draw an arc ?
So how to use all given co-ordinates from.slib
to draw an arc
?
Note : SCALE is defined at the start of the file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来前两个坐标对是虚构圆上的两个点,第三对是该圆圈的中心。这些共同描述了一个圆弧部分。为此,我们可以使用
arcto
,我们构造了qRectf
界限圆,即用给定的中心和侧面2*RADIUS
。因此,以下内容应该工作:
It looks like the first two coordinate pairs are two points on an imaginary circle and the third pair is the center of that circle. Together, those describe a circle arc section. For this to work with
arcTo
, we construct aQRectF
bounding the circle, ie with the given center and side2*radius
.Thus, the following ought to work: