add draw byte routine.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@348 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
b7e87ee78b
commit
ffffd2edcd
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -107,6 +107,7 @@ void rtgui_dc_draw_rect (struct rtgui_dc* dc, struct rtgui_rect* rect);
|
|||
void rtgui_dc_draw_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect);
|
||||
|
||||
void rtgui_dc_draw_text (struct rtgui_dc* dc, const rt_uint8_t* text, struct rtgui_rect* rect);
|
||||
void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, rt_uint8_t* data);
|
||||
|
||||
void rtgui_dc_draw_border(struct rtgui_dc* dc, rtgui_rect_t* rect, int flag);
|
||||
void rtgui_dc_draw_horizontal_line(struct rtgui_dc* dc, int x1, int x2, int y);
|
||||
|
|
Loading…
Reference in New Issue