4 * Copyright 1993 Bob Amstadt
7 static char Copyright
[] = "Copyright Bob Amstadt, 1993";
12 /**********************************************************************
15 void LineDDA(short nXStart
, short nYStart
, short nXEnd
, short nYEnd
,
16 FARPROC callback
, long lParam
)
20 int x_diff
= nXEnd
- nXStart
;
21 int y_diff
= nYEnd
- nYStart
;
23 if (x_diff
== 0 && y_diff
== 0)
26 if ((abs(x_diff
) < abs(y_diff
) && x_diff
!= 0) || y_diff
== 0)
28 b
= (nXStart
* y_diff
) / x_diff
- nYStart
;
30 for (x
= nXStart
; x
<= nXEnd
; x
++)
32 y
= (x
* y_diff
) / x_diff
+ b
;
33 CallLineDDAProc(callback
, x
, y
, lParam
);
38 b
= (nYStart
* x_diff
) / y_diff
- nXStart
;
40 for (y
= nYStart
; y
<= nYEnd
; y
++)
42 x
= (y
* x_diff
) / y_diff
+ b
;
43 CallLineDDAProc(callback
, x
, y
, lParam
);