Switch to edit mode.
Name(s): draw_line1: {picture, x1, y1, x2, y2} = args
2: if (x2 - x1 > y2 - y1)
3: for x in [x1..x2]
4: y = y1 + $mu:round(tofloat((x - x1) * (y2 - y1)) / tofloat(x2 - x1))
5: picture = this:plot_pixel(picture, x, y, "*")
6: endfor
7: else
8: for y in [y1..y2]
9: x = x1 + $mu:round(tofloat((y - y1) * (x2 - x1)) / tofloat(y2 - y1))
10: picture = this:plot_pixel(picture, x, y, "*")
11: endfor
12: endif
13: return picture