Straight line is the most basic element of graphics, and it is of great significance to study fast algorithm of line generating. On the basis of Bresenham algorithm, this paper considers and takes full advantage of the relativity between adjacent pixels in the line, and can generate all the pixels in a pixel line every time. The new algorithm based on pixel line can guarantee the line precision to be the same as Bresenham algorithm, and improve the speed of line generation significantly, the smaller the angle between the line and x or y axis is, the greater algorithm efficiency will be improved. The algorithm is suitable for hardware implementation, and is of great significance.