Even now I am convinced that there is a bug in the predefined "canvas.drawline". After that discussion here I tested it last night under various conditions again. It is not relevant whether one reflects a 0-indexed or 1-indexed canvas. It is obviously 0-indexed as explained in the book. This you can proove: Draw a line with "x1" = 1 then you see a gap at the beginning which can on the other hand be closed in case of "x1" = 0.
But the problem is how to define the coordinates "x1" and "x2". In my opinion it should "x1" be the first pixel of a line with "x2" representing the last pixel. But if you draw a line from e. g. cells 10 to 15 (x1, x2) then you get a line of only 5 pixels where it actually should be 6! pixels (cells 10, 11, 12, 13, 14, 15), so lacking the last pixel.
For the moment I've solved that problem by putting in as "x2": x1 + the wanted width, in the example 10 + 6 (16) and it works, but it is in fact beyond 15. It is strange because normally in any graphic function x1/x2 is expected to represent the first/last pixel. It cost me much time to explore the adequate use of the function which does not follow, to my opinion, the "normal" logic.
Another proof is: draw a line (x1=0; x2 = 15). Draw another line, this time using the canvas.drawPoint-function using a loop from 0 to 15. Then you see that the latter one creates a line of 16 pixels (see app) while the "drawLine"-function only creates a line of 15 pixels (see the gap of one pixel to the blue vertical line).
If you want to draw a diagonal line from cell (0,0) to cell (10,10) you must plug in: drawLine ((0,0)(11,11)). That cannot be expected intuitively!
Was it really this way the "drawLine"-function should work while having implemented it?