Revision 335
more docs
rectangle.c | ||
---|---|---|
51 | 51 |
|
52 | 52 |
static void (rectangle_draw_hline)(int16_t x, int16_t y, int16_t l, uint32_t color){ |
53 | 53 |
if(l < 0){ rectangle_draw_hline(x+l, y, -l, color); return; } |
54 |
for(int16_t x_ = max16(0,x); x_ < min16(x+l,(int16_t)graph_get_XRes()); ++x_){
|
|
54 |
for(int16_t x_ = max_16(0,x); x_ < min_16(x+l,(int16_t)graph_get_XRes()); ++x_){
|
|
55 | 55 |
graph_set_pixel((uint16_t)x_, (uint16_t)y, color); |
56 | 56 |
} |
57 | 57 |
} |
58 | 58 |
static void (rectangle_draw_vline)(int16_t x, int16_t y, int16_t l, uint32_t color){ |
59 | 59 |
if(l < 0){ rectangle_draw_vline(x, y+l, -l, color); return; } |
60 |
for(int16_t y_ = max16(0,y); y_ < min16(y+l,(int16_t)graph_get_YRes()); ++y_){
|
|
60 |
for(int16_t y_ = max_16(0,y); y_ < min_16(y+l,(int16_t)graph_get_YRes()); ++y_){
|
|
61 | 61 |
graph_set_pixel((uint16_t)x, (uint16_t)y_, color); |
62 | 62 |
} |
63 | 63 |
} |
... | ... | |
65 | 65 |
void (rectangle_draw)(const rectangle_t *p){ |
66 | 66 |
/// fill |
67 | 67 |
if(p->fill_alpha > ALPHA_THRESHOLD) |
68 |
for(int16_t y = max16(p->y,0); y < min16(p->y+p->h, (int16_t)graph_get_YRes()); ++y)
|
|
68 |
for(int16_t y = max_16(p->y,0); y < min_16(p->y+p->h, (int16_t)graph_get_YRes()); ++y)
|
|
69 | 69 |
rectangle_draw_hline(p->x, y, (int16_t)p->w, p->fill_color); |
70 | 70 |
/// border |
71 | 71 |
int16_t step = (p->outline_width > 0 ? 1 : -1); |
Also available in: Unified diff