1 #include <kandinsky/line.h> 2 #include <kandinsky/pixel.h> 29 KDPoint p, alwaysTranslate, conditionalTranslate;
32 if (deltaX >= deltaY) {
34 scanLength = right.
x - left.
x;
35 error = right.
x - left.
x;
38 alwaysTranslate = KDPointMake(1,0);
39 conditionalTranslate = KDPointMake(0, (right.
y >= left.
y ? 1 : -1));
42 scanLength = bottom.
y - top.
y;
43 error = bottom.
y - top.
y;
46 alwaysTranslate = KDPointMake(0,1);
47 conditionalTranslate = KDPointMake((bottom.
x >= top.
x ? 1 : -1), 0);
51 while (scanCounter++ < scanLength) {
53 p = KDPointTranslate(p, alwaysTranslate);
54 error = error - minusError;
56 p = KDPointTranslate(p, conditionalTranslate);
57 error = error + plusError;
void KDDrawLine(KDPoint p1, KDPoint p2, KDColor c)