codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
void inc_line(int x1, int y1, int x2, int y2, int color){ int dx, dy, incE, incNE, d, x, y; dx = x2 - x1; dy = y2 - y1; d = 2 * dy - dx; /* Valor inicial de d */ incE = 2 * dy; /* Incremento de E */ incNE = 2 * (dy - dx); /* Incremento de NE */ x = x1; y = y1; write_pixel(x, y, color); while (x < x2){ if (d <= 0) { /* Escolhe E */ d = d + incE; x = x + 1; }else{ /* Escolhe NE */ d = d + incNE; x = x + 1; y = y + 1; }/* end if */ write_pixel(x, y, color); }/* end while */ }/* end inc_line */
Private
[
?
]
Run code
Submit