imtk
diff src/progress.c @ 14:df2bc9406561
added gradients
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Tue, 19 Apr 2011 03:01:46 +0300 |
parents | 9c7987064bb0 |
children | 6893b4dca5a3 |
line diff
1.1 --- a/src/progress.c Mon Apr 18 06:15:46 2011 +0300 1.2 +++ b/src/progress.c Tue Apr 19 03:01:46 2011 +0300 1.3 @@ -1,3 +1,4 @@ 1.4 +#include <string.h> 1.5 #include "imtk.h" 1.6 #include "draw.h" 1.7 1.8 @@ -15,17 +16,24 @@ 1.9 { 1.10 int bar_size = PROGR_SIZE * pos; 1.11 float b = imtk_get_bevel_width(); 1.12 + float tcol[4], bcol[4]; 1.13 1.14 if(pos < 0.0) pos = 0.0; 1.15 if(pos > 1.0) pos = 1.0; 1.16 1.17 + memcpy(tcol, imtk_get_color(IMTK_BOTTOM_COLOR), sizeof tcol); 1.18 + memcpy(bcol, imtk_get_color(IMTK_TOP_COLOR), sizeof bcol); 1.19 + 1.20 /* through */ 1.21 - imtk_draw_rect(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, imtk_get_color(IMTK_BASE_COLOR)); 1.22 + imtk_draw_rect(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, tcol, bcol); 1.23 imtk_draw_frame(x - b, y - b, PROGR_SIZE + b * 2, PROGR_HEIGHT + b * 2, FRAME_INSET); 1.24 1.25 + /* bar */ 1.26 if(pos > 0.0) { 1.27 - /* bar */ 1.28 - imtk_draw_rect(x, y, bar_size, PROGR_HEIGHT, imtk_get_color(IMTK_BASE_COLOR)); 1.29 + memcpy(tcol, imtk_get_color(IMTK_TOP_COLOR), sizeof tcol); 1.30 + memcpy(bcol, imtk_get_color(IMTK_BOTTOM_COLOR), sizeof bcol); 1.31 + 1.32 + imtk_draw_rect(x, y, bar_size, PROGR_HEIGHT, tcol, bcol); 1.33 imtk_draw_frame(x, y, bar_size, PROGR_HEIGHT, FRAME_OUTSET); 1.34 } 1.35 }