摘要 |
A fast line drawing method. First, the coordinates of two end points are received and a current point is assigned to one of the end points. The differences of x and y coordinates (DELTAx and DELTAy) and the sum of error E are computed, the integer part of DELTAx over DELTAy is denoted as Q. The current point is checked to determine whether it has reached the end point. If not and the value of E is negative, a point at the current point is drawn. The y-coordinate of the current point and E are updated by (Y+1) and (E-2DELTAx) respectively if E is non-negative, a span of pixels from (X,Y) to (X+Q-1,Y) are drawn if the coordinate of last of Q points is less than the end point. Otherwise, a span of pixels from (X,Y) to (x2,Y) are drawn.
|