# A basic vectorial 2D canvas that can output SVG
#
# See Part 4.
module canvas
# A basic canvas
class Canvas
# All the drawing elements
var items = new Array[Line]
# Add a line in the canvas
fun add_line(x1,y1,x2,y2: Float) do items.add new Line(x1,y1,x2,y2)
# Return a full SVG for the canvas
fun to_svg: String do
var res = """
"
return res
end
end
# A line on a canvas
class Line
# x coordinate of the first point
var x1: Float
# y coordinate of the first point
var y1: Float
# x coordinate of the second point
var x2: Float
# y coordinate of the second point
var y2: Float
# The `line` SVG element
fun to_svg: String do
return """"""
end
end