, " " " ". , NX NY .
int x0[NY], x1[NY]; initially full of -1.
, .
x, y . y ( , y + 0,5), x . x0 [y] -1, x0, x1.
Also keep track of the lowest and highest y values.
When you're done, just iterate over y and on each y, iterate over x between x0 and x1, i.e. for (ix = x0[iy]; ix < x1[iy]; ix++)(or vice versa).
It is important to understand that pixels are not points where x and y are integers. Rather, pixels are small squares between grid lines. This will prevent edge issues.
source
share