TL;DR: always think of the upper left pixel's position as (0.5, 0.5).
The position of the center of the pixel. That pixel goes from (0,0) to (1,1) and therefore the center is (0.5,0.5).
The image area goes from the upper left corner of the upper left pixel to the lower right corner of the lower right pixel.
The centers are shifted by half of a pixel versus a grid starting at 0 and ending at N-1.
When drawing a line you need to hit the center of the pixel you want to fill.
TL;DR: always think of the upper left pixel's position as (0.5, 0.5).