Bresenham's Line Drawing Algorithm
clear frame buffer
for each line:
X = from X; Y = fromY;
dx = 2*(toX-fromX); dy = 2*(toY - fromY);
tmp = 0;
while(1) {
framebuffer[X][Y] = 1;
if (x = = toX) break;
x = x + 1;
tmp = tmp + dy;
if (tmp >= dx/2) {
y++;
tmp = tmp - dx;
}
}