Driver/ST7735S-0.96/graphics.c
/******************************************************************************
        Function description: draw a line [dda]
        Entry data:     x1, y1 starting coordinates
                        x2, y2 terminating coordinates
        Return value: None
******************************************************************************/
Function description: draw a line [dda]
Entry data:     x1, y1 starting coordinates
x2, y2 terminating coordinates
Return value: None
Function description : draw a line [ dda ] Entry data : x1 y1 starting coordinates x2 y2 terminating coordinates Return value : None
void LCD_DDA_Line(int x0, int y0, int x1, int y1, u32 color)
{
        int dx,dy,step;
        dx = x1 - x0;
        dy = y1 - y0;
        step = dx < dy ? dx : dy;
        if(dx > dy)     
        {
                for(step = x0; step < x1; step++)
                {
                        LCD_DrawPoint(x0+step, y0+(dy/dx), color);
                }
        }
        else            
        {
                for(step = y0; step < y1; step++)
                {
                        LCD_DrawPoint(x0+(dx/dy), y0+step, color);
                }
        }
}
void LCD_DDA_Line ( int x0 , int y0 , int x1 , int y1 , u32 color ) { int dx , dy , step ; dx = x1 - x0 ; dy = y1 - y0 ; step = dx < dy ? dx : dy ; if ( dx > dy ) { for ( step = x0 ; step < x1 ; step ++ ) { LCD_DrawPoint ( x0 + step , y0 + ( dy / dx ) , color ) ; } } else { for ( step = y0 ; step < y1 ; step ++ ) { LCD_DrawPoint ( x0 + ( dx / dy ) , y0 + step , color ) ; } } }
Function description: draw a line [dda]
Entry data:     x1, y1 starting coordinates
x2, y2 terminating coordinates
Return value: None
Function description : draw a line [ dda ] Entry data : x1 y1 starting coordinates x2 y2 terminating coordinates Return value : None
//step = x //step = y