Project

General

Profile

Revision 109

rectangle implemented

View differences:

graphics.c
123 123
}
124 124

  
125 125
int (vg_draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color){
126
    int r;
127
    for (int i = 0; i < len; i++)
128
        if ((r = set_pixel(x + i, y, color))) return r;
126 129

  
130
    return SUCCESS;
131

  
127 132
    //uint8_t color8 = color;
128
    for(uint32_t i = 0; i < 256; ++i){
129
        set_pixel(x+i,y,i);
130
    }/*
131
    set_pixel(x,y,0);
132
    set_pixel(x+1,y,1);
133
    set_pixel(x+2,y,2);
134
    */
133
    //set_pixel(x,y,color);
134
    //set_pixel(x+1,y,color);
135
    //set_pixel(x+2,y,color);
135 136
    //*(p++) = color8;
136 137
    //*(p++) = color8;
137 138
    //*(p++) = color8;
......
145 146
        *((uint8_t*)(video_mem)+y*1024+x+len) = color8;
146 147
    }
147 148
    */
148
    return 0;
149 149
}
150

  
151
int (vg_draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color)	{
152
    int r;
153
    for (int i = 0; i < height; i++)
154
        if ((r = vg_draw_hline(x, y + i, width, color))) return r;
155

  
156
    return SUCCESS;
157
}

Also available in: Unified diff