简体   繁体   中英

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/

In the above link I cant find any equivalent for 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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