@@ -100,6 +100,32 @@ There are methods that draw arcs/circles on the canvas:
100100
101101 .. image :: images/arc.png
102102
103+ Drawing lines
104+ -------------
105+
106+ There is one command for drawing a straight line from one point to another:
107+
108+ - ``stroke_line(x1, y1, x2, y2) ``: Draw a line from ``(x1, y1) `` to ``(x2, y2) ``.
109+
110+ .. code :: Python
111+
112+ from ipycanvas import Canvas
113+
114+ canvas = Canvas(width = 200 , height = 200 )
115+
116+ canvas.stroke_style = ' blue'
117+ canvas.stroke_line(0 , 0 , 150 , 150 )
118+
119+ canvas.stroke_style = ' red'
120+ canvas.stroke_line(200 , 0 , 0 , 200 )
121+
122+ canvas.stroke_style = ' green'
123+ canvas.stroke_line(150 , 150 , 0 , 200 )
124+
125+ canvas
126+
127+ .. image :: images/lines.png
128+
103129Drawing paths
104130-------------
105131
@@ -108,7 +134,7 @@ of different width and of different color. A path can be closed. To make shapes
108134extra steps:
109135
110136- First, you create the path with ``begin_path ``
111- - Then you use drawing commands to draw into the path
137+ - Then you use drawing commands to add shapes into the path
112138- Once the path has been created, you can ``stroke `` or ``fill `` the path to render it
113139
114140Here are the functions used to perform these steps:
0 commit comments