Closed GoogleCodeExporter closed 8 years ago
here is my procedure from dogm128 lib:
void dog_DrawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t size)
{
uint8_t tmp;
uint8_t x,y;
uint8_t dx, dy;
signed char err;
uint8_t swapxy = 0;
signed char ystep;
if ( x1 > x2 ) dx = x1-x2; else dx = x2-x1;
if ( y1 > y2 ) dy = y1-y2; else dy = y2-y1;
if ( dy > dx )
{
swapxy = 1;
tmp = dx; dx =dy; dy = tmp;
tmp = x1; x1 =y1; y1 = tmp;
tmp = x2; x2 =y2; y2 = tmp;
}
if ( x1 > x2 )
{
tmp = x1; x1 =x2; x2 = tmp;
tmp = y1; y1 =y2; y2 = tmp;
}
err = dx >> 1;
if ( y2 > y1 ) ystep = 1; else ystep = -1;
y = y1;
for( x = x1; x <= x2; x++ )
{
if ( swapxy == 0 )
dog_DrawPoint(x,y,size);
else
dog_DrawPoint(y,x,size);
err -= (uint8_t)dy;
if ( err < 0 )
{
y += (uint8_t)ystep;
err += (uint8_t)dx;
}
}
}
Original comment by olikr...@gmail.com
on 25 Mar 2012 at 9:13
done
Original comment by olikr...@gmail.com
on 25 Mar 2012 at 7:22
Original issue reported on code.google.com by
olikr...@gmail.com
on 19 Mar 2012 at 5:26