5

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 ?

Kilon
  • 1,962
  • 3
  • 16
  • 23

1 Answers1

7

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.

Igor Stasenko
  • 1,037
  • 5
  • 8
  • 2
    as a follow up.. i do not advise you to learn how to use Athens by looking on Cairo example. Athens designed as independent framework with owh API which can use various different backends. And Cairo is just one of them which currently supported. – Igor Stasenko Oct 30 '13 at 21:49
  • 1
    Ah nice , it works now , thank you! So where I find documentation about Athens ? – Kilon Oct 30 '13 at 21:58
  • right now it is tutorial and class comments in Athens itself. – Igor Stasenko Oct 31 '13 at 20:17