Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Canvas Paths
-
I have been experimenting with the canvas module a lot, but as of yet there is one thing that still doesn't make sense : path.
I understand the concept (you make a custom shape into the "memory" of the program and then print it), but the syntax doesn't make sense to me. For example, "canvas.add_curve" has six inputs. The first four are "control points", which I imagine are two points on the curve (just a guess). The last two are a (x,y) co-ord. But where are these co-ords ending up (as in, where is the line in relation to the co-ord)?
Lastly, I take it you have to close the figure in path before you can draw it.
Thanks,
Cubbarooney -
Maybe an example will help:
https://gist.github.com/omz/5087533
This shows how a curve is drawn, with some additional lines that hopefully make it a bit clearer how the two control points shape the curve.
Those are <a href="http://en.wikipedia.org/wiki/Bézier_curve">Bézier curves</a> that are also used by most vector graphics apps, like Illustrator.
-
Regarding your second question: You don't have to close a path to draw it, but when you're drawing lines and curves, you should have a move_to call after begin_path to define where the line starts. You'll see this in the example too. To see the effect of the close_path function, add canvas.close_path() just before the draw_path call.
-
Thank you omz!
Makes sense now :)
Cubbarooney