vec2mtx is an implementation of a line drawing algorithm. It takes a continuous line segment and converts it to a discrete grid of pixels.
There are many different algorithms, and I'm not sure which vec2mtx is using. However, the naïve approach you described, filling every pixel the line touches, is typically avoided as it creates lines which are very thick. See the figure below (source) for a comparison.
If you'd like to learn more, here's a good resource too: