added demo_view_instrument_panel.c, and added rtgui_dc_fill_round_rect test for demo_view_dc.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@921 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
richard.lion.heart.gl 2010-09-20 09:08:48 +00:00
parent af76e75ed9
commit d918c69567
5 changed files with 23 additions and 6 deletions

View File

@ -3,6 +3,7 @@ Import('projects')
src = Split("""
demo_view_dc_buffer.c
demo_view_instrument_panel.c
demo_fnview.c
demo_listview.c
demo_listview_icon.c

View File

@ -104,7 +104,7 @@ rtgui_view_t *demo_view_animation(rtgui_workbench_t* workbench)
rtgui_widget_set_event_handler(RTGUI_WIDGET(view), animation_event_handler);
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(view)), "飞线乱飞", &text_rect);
rtgui_rect_moveto(&text_rect, 0, 45);
/* 启动定时器以触发动画 */
timer = rtgui_timer_create(2, RT_TIMER_FLAG_PERIODIC, timeout, (void*)view);
rtgui_timer_start(timer);

View File

@ -73,7 +73,22 @@ rt_bool_t dc_event_handler(rtgui_widget_t* widget, rtgui_event_t *event)
/* 填充一个圆形 */
RTGUI_DC_FC(dc) = green;
rtgui_dc_fill_circle(dc, rect.x1 + 30, rect.y1 + 10, 10);
/* 画一个圆角矩形 */
rect.x1 = 150;
rect.y1 = 180;
rect.x2 = 210;
rect.y2 = 260;
RTGUI_DC_FC(dc) = RTGUI_RGB(25, 70, 150);
rtgui_dc_draw_round_rect(dc, &rect, 10);
rect.x1 = 160;
rect.y1 = 190;
rect.x2 = 200;
rect.y2 = 250;
RTGUI_DC_FC(dc) = RTGUI_RGB(170, 7, 80);
rtgui_dc_fill_round_rect(dc, &rect, 7);
/* 画一个圆弧 */
RTGUI_DC_FC(dc) = RTGUI_RGB(250, 120, 120);
rtgui_dc_draw_arc(dc, rect.x1 + 120, rect.y1 + 60, 30, 0, 120);
@ -135,7 +150,7 @@ rt_bool_t dc_event_handler(rtgui_widget_t* widget, rtgui_event_t *event)
rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_EXTRA);
rect.x1 += 20;
rect.x2 += 20 + 50;
rtgui_dc_draw_text(dc, "extra", &rect);
rtgui_dc_draw_text(dc, "额外", &rect);
rect.x1 -= 20;
rect.x2 -= 20 + 50;
rect.y1 += 20;

View File

@ -31,8 +31,8 @@ rt_bool_t instrument_panel_event_handler(rtgui_widget_t* widget, rtgui_event_t *
rtgui_rect_t rect;
const int vx[] = {85, 85, 105, 105};
const int vy[] = {60, 100, 100, 60};
const int arrowx[] = {x0+75, x0+75, x0+85};
const int arrowy[] = {y0-5, y0+5, y0};
const int arrowx[] = {120+75, 120+75, 120+85};
const int arrowy[] = {170-5, 170+5, 170};
/*
* demo viewdemo view
@ -85,7 +85,7 @@ rt_bool_t instrument_panel_event_handler(rtgui_widget_t* widget, rtgui_event_t *
rect.y1 = y;
rect.x2 = rect.x1 + 12 * 3;
rect.y2 = rect.y1 + 12;
sprintf(ac, "%d", 10 * i);
rt_sprintf(ac, "%d", 10 * i);
rtgui_dc_draw_text(dc, ac, &rect);
}
else
@ -99,7 +99,7 @@ rt_bool_t instrument_panel_event_handler(rtgui_widget_t* widget, rtgui_event_t *
rect.y1 = y;
rect.x2 = rect.x1 + 12 * 3;
rect.y2 = rect.y1 + 12;
sprintf(ac, "%d", 10 * i);
rt_sprintf(ac, "%d", 10 * i);
rtgui_dc_draw_text(dc, ac, &rect);
}

View File

@ -65,6 +65,7 @@ static void workbench_entry(void* parameter)
demo_view_dc_buffer(workbench);
demo_view_animation(workbench);
demo_view_buffer_animation(workbench);
demo_view_instrument_panel(workbench);
demo_view_window(workbench);
demo_view_label(workbench);
demo_view_button(workbench);