summaryrefslogtreecommitdiff
path: root/rtgui/common
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-01-29 10:08:27 +0000
committerbernard.xiong <[email protected]>2010-01-29 10:08:27 +0000
commitffffd2edcd561ebb7b3abb987c1c1b049fdceb0a (patch)
tree88be9937d65a19e9c2921a52e7f364495acdb3d8 /rtgui/common
parentb7e87ee78bb3f3910ce038a1b882c36e051d61b9 (diff)
add draw byte routine.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@348 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'rtgui/common')
-rw-r--r--rtgui/common/dc.c17
-rw-r--r--rtgui/common/rtgui_theme.c17
2 files changed, 30 insertions, 4 deletions
diff --git a/rtgui/common/dc.c b/rtgui/common/dc.c
index 6d2181c568..0c225ae161 100644
--- a/rtgui/common/dc.c
+++ b/rtgui/common/dc.c
@@ -226,6 +226,23 @@ void rtgui_dc_draw_text (struct rtgui_dc* dc, const rt_uint8_t* text, struct rtg
#endif
}
+void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, rt_uint8_t* data)
+{
+ int i, k;
+
+ /* draw word */
+ for (i=0; i < h; i ++)
+ {
+ for (k=0; k < 8; k++)
+ {
+ if (((data[i] >> (7-k)) & 0x01) != 0)
+ {
+ rtgui_dc_draw_point(dc, x + k, y + i);
+ }
+ }
+ }
+}
+
void rtgui_dc_set_color(struct rtgui_dc* dc, rtgui_color_t color)
{
if (dc != RT_NULL)
diff --git a/rtgui/common/rtgui_theme.c b/rtgui/common/rtgui_theme.c
index 75b084998e..36c21cbd56 100644
--- a/rtgui/common/rtgui_theme.c
+++ b/rtgui/common/rtgui_theme.c
@@ -312,7 +312,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
/* draw button */
struct rtgui_dc* dc;
struct rtgui_rect rect;
- rtgui_color_t fc;
+ rtgui_color_t bc, fc;
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(btn));
@@ -322,13 +322,14 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
rtgui_widget_get_rect(RTGUI_WIDGET(btn), &rect);
/* get foreground color */
+ bc = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn));
fc = RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn));
- /* fill button rect with background color */
- rtgui_dc_fill_rect(dc, &rect);
-
if (btn->flag & RTGUI_BUTTON_TYPE_PUSH && btn->flag & RTGUI_BUTTON_FLAG_PRESS)
{
+ /* fill button rect with background color */
+ rtgui_dc_fill_rect(dc, &rect);
+
/* draw border */
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = RTGUI_RGB(64, 64, 64);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
@@ -367,6 +368,10 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
}
else
{
+ /* fill button rect with background color */
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn)) = RTGUI_RGB(0xff, 0xff, 0xff);
+ rtgui_dc_fill_rect(dc, &rect);
+
/* draw border */
RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(0, 0, 0);
rtgui_dc_draw_rect(dc, &rect);
@@ -390,6 +395,9 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
}
else
{
+ /* fill button rect with background color */
+ rtgui_dc_fill_rect(dc, &rect);
+
/* draw border */
RTGUI_WIDGET(btn)->gc.foreground = RTGUI_RGB(255, 255, 255);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
@@ -406,6 +414,7 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
}
/* set forecolor */
+ RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(btn)) = bc;
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(btn)) = fc;
if (btn->pressed_image == RT_NULL)