简体   繁体   English

如何与雅典创建线路?

[英]How to create lines with Athens?

I have no clue how to create lines with Athens. 我不知道如何用雅典创造线条。 I took a look at Cairo docs but I cant see how Athens is related to Cairo. 我看了一下开罗的文件,但我看不出雅典与开罗的关系。

http://zetcode.com/gfx/cairo/basicdrawing/ http://zetcode.com/gfx/cairo/basicdrawing/

In the above link I cant find any equivalent for cairo_set_line_width(cr, 1); 在上面的链接中我找不到cairo_set_line_width(cr,1)的任何等价物; I tried to look inside Athens but is nowhere to be found. 我试图在雅典内部寻找,但无处可寻。 Overall I find the Athens architecture quite confusing though Cairo looks simple. 总的来说,虽然开罗看起来很简单但我觉得雅典建筑很混乱。 Any idea how to makes this work ? 知道如何使这项工作吗?

There is no separate canvas commands which represents 'draw a single line' action in Athens. 在雅典没有单独的画布命令代表“画一条线”动作。 Instead one must generate path representing the line: 相反,必须生成代表该行的路径:

surface drawDuring: [:canvas | | linePath |
linePath := canvas createPath: [:builder |
  builder 
     absolute;
     moveTo: lineStartPoint;
     lineTo: lineEndPoint
 ].

stroke := canvas setStrokePaint: Color red.
stroke width: 10.

canvas drawShape: linePath.
].

You can look at Athens-Tutorial, where various aspects of path creation, using of stroke paints and filling shapes explained in examples. 您可以查看雅典教程,其中路径创建的各个方面,使用笔画颜料和填充形状在示例中进行了解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM