本文整理汇总了C++中rtgui_dc_draw_text函数的典型用法代码示例。如果您正苦于以下问题:C++ rtgui_dc_draw_text函数的具体用法?C++ rtgui_dc_draw_text怎么用?C++ rtgui_dc_draw_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtgui_dc_draw_text函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rtgui_theme_draw_iconbox
void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox)
{
struct rtgui_dc* dc;
struct rtgui_rect rect;
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(iconbox));
if (dc == RT_NULL) return;
/* get widget rect */
rtgui_widget_get_rect(RTGUI_WIDGET(iconbox), &rect);
/* draw icon */
rtgui_image_blit(iconbox->image, dc, &rect);
/* draw text */
if (iconbox->text_position == RTGUI_ICONBOX_TEXT_BELOW && iconbox->text != RT_NULL)
{
rect.y1 = iconbox->image->h + RTGUI_WIDGET_DEFAULT_MARGIN;
rtgui_dc_draw_text(dc, iconbox->text, &rect);
}
else if (iconbox->text_position == RTGUI_ICONBOX_TEXT_RIGHT && iconbox->text != RT_NULL)
{
rect.x1 = iconbox->image->w + RTGUI_WIDGET_DEFAULT_MARGIN;
rtgui_dc_draw_text(dc, iconbox->text, &rect);
}
/* end drawing */
rtgui_dc_end_drawing(dc);
}
开发者ID:18337129968,项目名称:-android-source-code,代码行数:30,代码来源:rtgui_theme.c
示例2: rtgui_textbox_ondraw
void rtgui_textbox_ondraw(rtgui_textbox_t *box)
{
/* draw button */
rtgui_rect_t rect;
struct rtgui_dc *dc;
rtgui_color_t fc;
RT_ASSERT(box != RT_NULL);
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(box));
if (dc == RT_NULL)
return;
/* get widget rect */
rtgui_widget_get_rect(RTGUI_WIDGET(box), &rect);
fc = RTGUI_WIDGET_FOREGROUND(box);
rtgui_rect_inflate(&rect, -1);
/* fill widget rect with white color */
RTGUI_WIDGET_BACKGROUND(box) = white;
rtgui_dc_fill_rect(dc, &rect);
rtgui_rect_inflate(&rect, 1);
/* draw border */
RTGUI_WIDGET_FOREGROUND(box) = RTGUI_RGB(123, 158, 189);
rtgui_dc_draw_rect(dc, &rect);
/* draw text */
RTGUI_WIDGET_FOREGROUND(box) = fc;
if (box->text != RT_NULL)
{
rect.x1 += RTGUI_WIDGET_DEFAULT_MARGIN;
/* draw single text */
if (box->flag & RTGUI_TEXTBOX_MASK)
{
/* draw mask char */
rt_size_t len = rt_strlen(box->text);
if (len > 0)
{
char *text_mask = rtgui_malloc(len + 1);
rt_memset(text_mask, box->mask_char, len + 1);
text_mask[len] = 0;
rtgui_dc_draw_text(dc, text_mask+box->first_pos, &rect);
rtgui_free(text_mask);
}
}
else
{
rtgui_dc_draw_text(dc, box->text+box->first_pos, &rect);
}
}
rtgui_dc_end_drawing(dc);
}
开发者ID:grilledcheesesandwich,项目名称:rtt-2457,代码行数:56,代码来源:textbox.c
示例3: tetris_refreshmap
void tetris_refreshmap(struct rtgui_dc *dc) //刷新地图
{
rt_uint8_t i, j;
rt_uint8_t buf[5];
rtgui_rect_t rect = {XOFFSET, YOFFSET, XOFFSET + 240, YOFFSET + 400};
RTGUI_DC_FC(dc) = RTGUI_RGB(0x55, 0x55, 0x55);
rtgui_dc_fill_rect_forecolor(dc, &rect);
rect.x1 -= 10;
rect.x2 += 150;
rect.y1 -= 10;
rect.y2 += 10;
RTGUI_DC_FC(dc) = RTGUI_RGB(0x00, 0x00, 0xff);
rtgui_dc_draw_rect(dc, &rect);
rect.x1 += 290;
rect.x2 -= 30;
rect.y1 += 40;
rect.y2 -= 360;
RTGUI_DC_FC(dc) = RTGUI_RGB(0x00, 0x00, 0x00);
rtgui_dc_draw_text(dc, "下一个", &rect);
rect.y1 += 130;
rect.y2 += 130;
rtgui_dc_draw_text(dc, "总得分", &rect);
rect.y1 += 80;
rect.y2 += 80;
rtgui_dc_draw_text(dc, "LEVEL", &rect);
RTGUI_DC_FC(dc) = RTGUI_RGB(0xff, 0x00, 0x00);
rect.x1 += 20;
rect.x2 += 20;
rect.y1 -= 60;
rect.y2 -= 60;
rt_sprintf(buf, "%d", score);
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_text(dc, buf, &rect);
rect.y1 += 80;
rect.y2 += 80;
rt_sprintf(buf, "%d", level);
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_text(dc, buf, &rect);
for (i = 0; i < 25; i++)
{
for (j = 0; j < 15; j++)
{
if (tetris_map[j][i] != 0)
{
tetris_drawbox(dc, j, i, tetris_colors[tetris_map[j][i]]);
}
}
}
}
开发者ID:rookiecalf,项目名称:realtouch-stm32f4,代码行数:51,代码来源:tetris_ui.c
示例4: _rtgui_menu_item_ondraw
static void _rtgui_menu_item_ondraw(struct rtgui_listctrl *list,
struct rtgui_dc* dc,
rtgui_rect_t* rect,
rt_uint16_t index)
{
rtgui_rect_t item_rect;
struct rtgui_menu_item* item;
item_rect = *rect;
item_rect.x1 += 5;
/* re-fill item */
if (list->current_item == index)
{
rtgui_color_t bc;
bc = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(list));
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(list)) = blue;
rtgui_dc_fill_rect(dc, rect);
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(list)) = bc;
}
/* get menu item */
item = (rtgui_menu_item_t*)list->items;
item = &item[index];
if (item->type == RTGUI_ITEM_SUBMENU)
{
rtgui_rect_t r = {0, 0, 8, 8};
rtgui_dc_draw_text(dc, item->label, &item_rect);
item_rect.x1 = item_rect.x2 - 16; item_rect.x2 -= 8;
rtgui_rect_moveto_align(&item_rect, &r, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, r.x1, r.y1, 8, right_arrow);
}
else if (item->type == RTGUI_ITEM_SEPARATOR)
{
rtgui_dc_draw_horizontal_line(dc, item_rect.x1, item_rect.x2, (item_rect.y2 + item_rect.y1)/2);
}
else if (item->type == RTGUI_ITEM_CHECK)
{
/* not support right now */
}
else
{
/* normal menu item */
rtgui_dc_draw_text(dc, item->label, &item_rect);
if (item->image != RT_NULL)
rtgui_image_blit(item->image, dc, &item_rect);
}
}
开发者ID:cahill123,项目名称:shenzhou-iv-stm32f107-rt-thread,代码行数:50,代码来源:menu.c
示例5: _draw_default
void _draw_default(struct rtgui_object *object, rtgui_event_t* event)
{
struct rtgui_widget *widget = RTGUI_WIDGET(object);
struct rtgui_dc* dc;
rtgui_rect_t rect;
/* 因为用的是demo container,上面本身有一部分控件,所以在绘图时先要让demo container先绘图 */
rtgui_container_event_handler(object, event);
/* 获得控件所属的DC */
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
return;
/* 获得demo container允许绘图的区域 */
demo_view_get_logic_rect(RTGUI_CONTAINER(widget), &rect);
/* 擦除所有 */
RTGUI_WIDGET_BACKGROUND(widget) = default_background;
rtgui_dc_fill_rect(dc, &rect);
/* 显示提示 */
rtgui_dc_draw_text(dc, "按任意键开始/停止测试...", &rect);
/* 绘图完成 */
rtgui_dc_end_drawing(dc);
}
开发者ID:cahill123,项目名称:shenzhou-iv-stm32f107-rt-thread,代码行数:27,代码来源:demo_view_benchmark.c
示例6: _draw_default
void _draw_default(PVOID wdt, rtgui_event_t* event)
{
struct rtgui_dc* dc;
rtgui_widget_t* widget = (rtgui_widget_t*)wdt;
rtgui_rect_t rect;
/* 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view先绘图 */
rtgui_view_event_handler(widget, event);
/* 获得控件所属的DC */
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL) /* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
return ;
/* 获得demo view允许绘图的区域 */
rtgui_widget_get_rect(widget, &rect);
rtgui_rect_inflate(&rect, -5);
rect.y1 += 35;
/* 擦除所有 */
RTGUI_WIDGET_BACKGROUND(widget) = default_background;
rtgui_dc_fill_rect(dc, &rect);
/* 显示提示 */
rtgui_dc_draw_text(dc, "按鼠标键开始/停止测试...", &rect);
/* 绘图完成 */
rtgui_dc_end_drawing(dc);
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:29,代码来源:demo_gui_benchmark.c
示例7: _draw_textview
static void _draw_textview(rtgui_textview_t *textview)
{
struct rtgui_dc* dc;
struct rtgui_rect rect, font_rect;
char* line;
rt_ubase_t line_index, item_height;
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(textview)), "W", &font_rect);
item_height = rtgui_rect_height(font_rect) + 3;
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(textview));
if (dc == RT_NULL) return ;
/* fill rect */
rtgui_widget_get_rect(RTGUI_WIDGET(textview), &rect);
rtgui_dc_fill_rect(dc, &rect);
rect.x1 += 3;
rect.x2 -= 3;
for (line_index = textview->line_current;
(line_index < textview->line_current + textview->line_page_count) &&
(line_index < textview->line_count);
line_index ++)
{
line = (char* )_get_line_text(textview, line_index);
rtgui_dc_draw_text(dc, line, &rect);
rect.y1 += item_height;
}
rtgui_dc_end_drawing(dc);
}
开发者ID:Paolo-Maffei,项目名称:rt-thread-stm32f4discovery,代码行数:33,代码来源:textview.c
示例8: demo_view
rtgui_view_t *demo_view_buffer_animation(rtgui_workbench_t* workbench)
{
rtgui_view_t *view;
view = demo_view(workbench, "DC 缓冲区动画");
if (view != RT_NULL)
rtgui_widget_set_event_handler(RTGUI_WIDGET(view), animation_event_handler);
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(RTGUI_WIDGET(view)), "缓冲动画", &text_rect);
if (dc_buffer == RT_NULL)
{
rtgui_rect_t rect;
rect.x1 = 0; rect.x2 = rtgui_rect_width(text_rect) + 2;
rect.y1 = 0; rect.y2 = rtgui_rect_height(text_rect) + 2;
/* 创建 DC Buffer,长 50,宽 50 */
dc_buffer = rtgui_dc_buffer_create(rtgui_rect_width(rect), rtgui_rect_height(rect));
RTGUI_DC_FC(dc_buffer) = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(view));
rtgui_dc_fill_rect(dc_buffer, &rect);
RTGUI_DC_FC(dc_buffer) = black;
rect.x1 = 1; rect.y1 = 1;
rtgui_dc_draw_text(dc_buffer, "缓冲动画", &rect);
}
/* 启动定时器以触发动画 */
timer = rtgui_timer_create(1, RT_TIMER_FLAG_PERIODIC, timeout, (void*)view);
rtgui_timer_start(timer);
return view;
}
开发者ID:CollinsLiu,项目名称:rt-thread-pc,代码行数:31,代码来源:demo_view_buffer_animation.c
示例9: view_event_handler
static rt_bool_t view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event)
{
if (event->type == RTGUI_EVENT_PAINT)
{
struct rtgui_dc* dc;
struct rtgui_rect rect;
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL) return RT_FALSE;
rtgui_widget_get_rect(widget, &rect);
rtgui_dc_fill_rect(dc, &rect);
if (background != RT_NULL)
rtgui_image_blit(background, dc, &rect);
rtgui_dc_draw_text(dc, "Radio Today", &rect);
rtgui_dc_end_drawing(dc);
return RT_FALSE;
}
return rtgui_view_event_handler(widget, event);
}
开发者ID:18337129968,项目名称:-android-source-code,代码行数:25,代码来源:today.c
示例10: _rtgui_listctrl_item_draw
void _rtgui_listctrl_item_draw(struct rtgui_listctrl *list,
struct rtgui_dc *dc,
rtgui_rect_t *rect,
rt_uint16_t index)
{
char age_str[8];
rtgui_rect_t item_rect;
struct list_item *items, *item;
item_rect = *rect;
item_rect.x1 += 5;
items = (struct list_item *)list->items;
item = &items[index];
/* draw text */
rtgui_dc_draw_text(dc, item->name, &item_rect);
item_rect.x1 += 60;
rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
item_rect.x1 += 5;
rtgui_dc_draw_text(dc, item->gender, &item_rect);
item_rect.x1 += 60;
rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
item_rect.x1 += 5;
rt_snprintf(age_str, sizeof(age_str), "%d", item->age);
rtgui_dc_draw_text(dc, age_str, &item_rect);
item_rect.x1 += 40;
rtgui_dc_draw_vline(dc, item_rect.x1, item_rect.y1, item_rect.y2);
item_rect.x1 += 5;
/* draw image */
if (item->image != RT_NULL)
{
rtgui_rect_t image_rect;
image_rect.x1 = 0;
image_rect.y1 = 0;
image_rect.x2 = item->image->w;
image_rect.y2 = item->image->h;
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_image_blit(item->image, dc, &image_rect);
}
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:45,代码来源:demo_view_listctrl.c
示例11: rtgui_listbox_ondraw
void rtgui_listbox_ondraw(struct rtgui_listbox* box)
{
struct rtgui_rect rect, item_rect;
struct rtgui_dc* dc;
rt_uint16_t page_index, index;
const struct rtgui_listbox_item* item;
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(box));
if (dc == RT_NULL) return;
rtgui_widget_get_rect(RTGUI_WIDGET(box), &rect);
rtgui_dc_fill_rect(dc, &rect);
rect.x2 -= 1; rect.y2 -= 1;
/* draw focused border */
if (RTGUI_WIDGET_IS_FOCUSED(RTGUI_WIDGET(box)))
rtgui_dc_draw_focus_rect(dc, &rect);
/* get item base rect */
item_rect = rect;
item_rect.x1 += 1; item_rect.x2 -= 1;
item_rect.y1 += 2;
item_rect.y2 = item_rect.y1 + (2 + rtgui_theme_get_selected_height());
/* get current page */
page_index = (box->current_item / box->page_items) * box->page_items;
for (index = 0; index < box->page_items; index ++)
{
if (page_index + index >= box->items_count) break;
item = &(box->items[page_index + index]);
if (page_index + index == box->current_item)
{
rtgui_theme_draw_selected(dc, &item_rect);
}
item_rect.x1 += LIST_MARGIN;
if (item->image != RT_NULL)
{
rtgui_image_blit(item->image, dc, &item_rect);
item_rect.x1 += item->image->w + 2;
}
/* draw text */
rtgui_dc_draw_text(dc, item->name, &item_rect);
if (item->image != RT_NULL)
item_rect.x1 -= (item->image->w + 2);
item_rect.x1 -= LIST_MARGIN;
/* move to next item position */
item_rect.y1 += (rtgui_theme_get_selected_height() + 2);
item_rect.y2 += (rtgui_theme_get_selected_height() + 2);
}
rtgui_dc_end_drawing(dc);
}
开发者ID:18337129968,项目名称:-android-source-code,代码行数:56,代码来源:listbox.c
示例12: rtgui_list_view_onicondraw
static void rtgui_list_view_onicondraw(struct rtgui_list_view *view, struct rtgui_dc *dc)
{
struct rtgui_rect rect, item_rect, drawing_rect;
rt_ubase_t c, r, item_index; /* col and row index */
rt_ubase_t item_width, item_height;
rtgui_image_t *image;
if (view->items_count == 0) return;
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
item_index = (view->current_item / view->page_items) * view->page_items;
item_width = (rtgui_rect_width(rect) - 2 * LIST_MARGIN) / view->col_items;
item_height = (rtgui_rect_height(rect) - 4) / view->row_items;
image = view->items[0].image;
for (r = 0; r < view->row_items; r ++)
{
for (c = 0; c < view->col_items; c ++)
{
if (item_index < view->items_count)
{
item_rect.y1 = rect.y1 + LIST_MARGIN + r * item_height;
item_rect.x1 = rect.x1 + LIST_MARGIN + c * item_width;
item_rect.x2 = item_rect.x1 + item_width;
item_rect.y2 = item_rect.y1 + item_height;
if (item_index == view->current_item)
{
rtgui_theme_draw_selected(dc, &item_rect);
}
drawing_rect.x1 = drawing_rect.y1 = 0;
drawing_rect.x2 = image->w;
drawing_rect.y2 = image->h;
rtgui_rect_moveto_align(&item_rect, &drawing_rect, RTGUI_ALIGN_CENTER_HORIZONTAL);
drawing_rect.y1 += 5;
drawing_rect.y2 += 5;
rtgui_image_blit(view->items[item_index].image, dc, &drawing_rect);
item_rect.y1 = drawing_rect.y2 + LIST_MARGIN;
item_rect.x1 += 3;
item_rect.x2 -= 3;
rtgui_font_get_metrics(RTGUI_WIDGET_FONT(view), view->items[item_index].name,
&drawing_rect);
rtgui_rect_moveto_align(&item_rect, &drawing_rect, RTGUI_ALIGN_CENTER_HORIZONTAL);
rtgui_dc_draw_text(dc, view->items[item_index].name, &drawing_rect);
item_index ++;
}
else break;
}
}
}
开发者ID:idCache,项目名称:rt-thread,代码行数:54,代码来源:list_view.c
示例13: rtgui_list_view_onlistdraw
static void rtgui_list_view_onlistdraw(struct rtgui_list_view *view, struct rtgui_dc *dc)
{
rt_ubase_t index, page_index;
rtgui_rect_t rect, item_rect, image_rect;
const struct rtgui_list_item *item;
rtgui_widget_get_rect(RTGUI_WIDGET(view), &rect);
/* get item base rect */
item_rect = rect;
item_rect.y1 += 2;
item_rect.y2 = item_rect.y1 + (2 + rtgui_theme_get_selected_height());
/* get current page */
page_index = (view->current_item / view->page_items) * view->page_items;
for (index = 0; index < view->page_items; index ++)
{
if (page_index + index >= view->items_count) break;
item = &(view->items[page_index + index]);
if (page_index + index == view->current_item)
{
rtgui_theme_draw_selected(dc, &item_rect);
}
item_rect.x1 += LIST_MARGIN;
if (item->image != RT_NULL)
{
/* blit on center */
image_rect.x1 = 0;
image_rect.y1 = 0;
image_rect.x2 = item->image->w;
image_rect.y2 = item->image->h;
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_image_blit(item->image, dc, &image_rect);
item_rect.x1 += item->image->w + 2;
}
/* draw text */
rtgui_dc_draw_text(dc, item->name, &item_rect);
if (item->image != RT_NULL)
item_rect.x1 -= (item->image->w + 2);
item_rect.x1 -= LIST_MARGIN;
/* move to next item position */
item_rect.y1 += (rtgui_theme_get_selected_height() + 2);
item_rect.y2 += (rtgui_theme_get_selected_height() + 2);
}
}
开发者ID:idCache,项目名称:rt-thread,代码行数:51,代码来源:list_view.c
示例14: draw_form_head
static int draw_form_head(struct rtgui_form *form, const struct rtgui_font *font,
struct rtgui_dc* dc, struct rtgui_rect *rect, struct rtgui_rect *row_rect, char *buf)
{
struct rtgui_rect form_rect;
char *pch1;
const char *pch2;
int i, j, len;
#if 0
form_debug(("func:%s, (%d,%d), (%d,%d),bytes:%d, h:%d, r:%d\n", __FUNCTION__,
rect->x1, rect->y1, rect->x2, rect->y2, form->bytes_of_row, font->height, form->row_cnt_of_fbody));
#endif
form_rect.x1 = 0;
form_rect.y1 = 0;
form_rect.x2 = (form->bytes_of_row + GAG_BETWEEN_COL*form->head_item_cnt) * 8;
form_rect.y2 = (font->height + GAG_BETWEEN_ROW) * (form->row_cnt_of_fbody + 1);
rtgui_rect_moveto_align(rect, &form_rect, RTGUI_ALIGN_CENTER_HORIZONTAL);
form_rect.y1 += GAG_BEFORE_FORM_HEAD;
form_rect.y2 += GAG_BEFORE_FORM_HEAD;
if (0xffff == form->form_rect.x1) {
form->form_rect = form_rect;
}
j = form->head_item_cnt;
pch1 = buf;
for (i=0; i<j; ++i) {
pch2 = form->head_name[i];
while ('\0' != *pch2)
*pch1++ = *pch2++;
/* 用空格填充列间隔 */
len = GAG_BETWEEN_COL;
while (len--)
*pch1++ = ' ';
}
*--pch1 = '\0';
row_rect->x1 = form_rect.x1;
row_rect->y1 = form_rect.y1;
row_rect->x2 = form_rect.x2;
row_rect->y2 = form_rect.y1 + font->height;
#if 0
form_debug(("func:%s, (%d,%d), (%d,%d),hic:%d, len:%d, buf:%s\n", __FUNCTION__,
row_rect->x1, row_rect->y1, row_rect->x2,row_rect->y2,j,pch1 -buf, buf));
#endif
rtgui_dc_draw_text(dc, buf, row_rect);
rtgui_dc_draw_horizontal_line(dc, row_rect->x1, row_rect->x2, row_rect->y2+1);
return SUCC;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:50,代码来源:form.c
示例15: rtgui_combobox_ondraw
static void rtgui_combobox_ondraw(struct rtgui_combobox* box)
{
/* draw button */
rtgui_color_t bc;
struct rtgui_dc* dc;
struct rtgui_rect rect, r;
/* begin drawing */
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(box));
if (dc == RT_NULL) return;
bc = RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(box));
/* get widget rect */
rtgui_widget_get_rect(RTGUI_WIDGET(box), &rect);
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(box)) = white;
/* fill widget rect with background color */
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_rect(dc, &rect);
/* draw current item */
if (box->current_item < box->items_count)
{
rect.x1 += 5;
rtgui_dc_draw_text(dc, box->items[box->current_item].name, &rect);
}
/* restore background color */
RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(box)) = bc;
/* draw pull down button */
rect.x1 = rect.x2 - RTGUI_COMBOBOX_BUTTON_WIDTH;
rtgui_rect_inflate(&rect, -1);
rtgui_dc_fill_rect(dc, &rect);
if (box->pd_pressed == RT_TRUE) rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_SUNKEN);
else rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_RAISE);
r.x1 = 0;
r.y1 = 0;
r.x2 = 8;
r.y2 = 4;
rtgui_rect_moveto_align(&rect, &r, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, r.x1, r.y1, 4, down_arrow);
/* end drawing */
rtgui_dc_end_drawing(dc);
return;
}
开发者ID:cahill123,项目名称:shenzhou-iv-stm32f107-rt-thread,代码行数:49,代码来源:combobox.c
示例16: rtgui_form_ondraw
void rtgui_form_ondraw(struct rtgui_form *form)
{
struct rtgui_dc* dc;
struct rtgui_rect rect, row_rect;
const struct rtgui_font *font;
char *buf;
char *pch1;
int i, j;
if (NULL == form) {
form_debug(("fun:%s(), param error!\n", __FUNCTION__));
return;
}
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(form));
if (dc == RT_NULL) return;
buf = rt_malloc(form->bytes_of_row);
if (NULL == buf) {
form_debug(("fun:%s(), line:%d:%d malloc fail!\n", __FUNCTION__, __LINE__, form->bytes_of_row));
rtgui_dc_end_drawing(dc);
return;
}
rtgui_widget_get_rect(RTGUI_WIDGET(form), &rect);
rtgui_dc_fill_rect(dc, &rect);
font = RTGUI_DC_FONT(dc);
if (font == RT_NULL)
font = rtgui_font_default();
draw_form_head(form, font, dc, &rect, &row_rect, buf);
j = form->row_cnt_of_fbody;
pch1 = form->fbody;
for (i=0; i<j; ++i) {
row_rect.y1 += font->height + GAG_BETWEEN_ROW;
row_rect.y2 += font->height + GAG_BETWEEN_ROW;
rtgui_dc_draw_text(dc, pch1, &row_rect);
form_debug(("fun:%s(), %dth line:%s!\n", __FUNCTION__, i, pch1));
pch1 += form->bytes_of_row;
}
rtgui_dc_end_drawing(dc);
rt_free(buf);
return;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:49,代码来源:form.c
示例17: picture_view_event_handler
static rt_bool_t picture_view_event_handler(rtgui_object_t *object, rtgui_event_t *event)
{
if (event->type == RTGUI_EVENT_PAINT)
{
struct rtgui_dc* dc;
struct rtgui_rect rect;
struct rtgui_image* image = RT_NULL;
char fn[32];
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(object));
if (dc == RT_NULL) return RT_FALSE;
rtgui_widget_get_rect(RTGUI_WIDGET(object), &rect);
/* open image */
rt_snprintf(fn, sizeof(fn), "%s/%s", PICTURE_DIR, current_fn);
rt_kprintf("pic fn: %s\n", fn);
if (strstr(fn, ".hdc") != RT_NULL ||
strstr(fn, ".HDC") != RT_NULL)
{
image = rtgui_image_create_from_file("hdc",
fn, RT_FALSE);
}
else if (strstr(fn, ".bmp") != RT_NULL ||
strstr(fn, ".BMP") != RT_NULL)
{
image = rtgui_image_create_from_file("bmp",
fn, RT_FALSE);
}
if (image != RT_NULL)
{
/* blit image */
rtgui_image_blit(image, dc, &rect);
/* destroy image */
rtgui_image_destroy(image);
}
else
{
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_text(dc, "没有文件被打开", &rect);
}
rtgui_dc_end_drawing(dc);
return RT_FALSE;
}
return rtgui_container_event_handler(object, event);
}
开发者ID:bloom5,项目名称:realtouch-stm32f4,代码行数:48,代码来源:picture.c
示例18: info_timer_timeout
static void info_timer_timeout(rtgui_timer_t* timer, void* parameter)
{
struct rtgui_dc* dc;
rtgui_color_t saved;
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(home_view));
if (dc == RT_NULL) return ;
saved = RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(home_view));
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(home_view)) = RTGUI_RGB(206, 231, 255);
rtgui_dc_draw_hline(dc, 14, 14 + (tinfo.position * 212) / tinfo.duration, 75);
if ((player_mode == PLAYER_PLAY_RADIO) && ((tinfo.position * 212 + 14)/tinfo.duration) < 226)
{
tinfo.position = net_buf_get_usage();
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(home_view)) = RTGUI_RGB(82, 199, 16);
rtgui_dc_draw_hline(dc, 14 + (tinfo.position * 212) / tinfo.duration, 226, 75);
}
RTGUI_WIDGET_FOREGROUND(RTGUI_WIDGET(home_view)) = saved;
if (player_mode == PLAYER_PLAY_FILE)
{
rtgui_color_t saved;
rtgui_rect_t rect;
char line[32];
play_time++;
rt_snprintf(line, sizeof(line), "%3d:%02d", play_time / 60, play_time % 60);
rect.x1 = 172;
rect.y1 = 48;
rect.x2 = 220;
rect.y2 = rect.y1 + 16;
saved = RTGUI_DC_BC(dc);
RTGUI_DC_BC(dc) = RTGUI_RGB(0, 125, 198);
rtgui_dc_fill_rect(dc, &rect);
rtgui_dc_draw_text(dc, line, &rect);
RTGUI_DC_BC(dc) = saved;
}
rtgui_dc_end_drawing(dc);
}
开发者ID:eyyhappy,项目名称:network-radio,代码行数:45,代码来源:player_ui.c
示例19: drawing_update_state_info
void drawing_update_state_info(struct rtgui_widget* widget)
{
char* line;
struct rtgui_dc* dc;
struct rtgui_rect rect;
line = rtgui_malloc(256);
if (line == RT_NULL) return ;
dc = rtgui_dc_begin_drawing(widget);
if (dc == RT_NULL)
{
rt_free(line);
return;
}
rtgui_widget_get_rect(widget, &rect);
/* fill background */
rtgui_dc_fill_rect(dc, &rect);
rect.y2 = rect.y1 + 18;
switch(update_radio_list_state)
{
case UPDATE_RAIDO_LIST_PROC:
sprintf(line, "正在更新电台列表......");
break ;
case UPDATE_RADIO_LIST_CONNECT_FAILED:
sprintf(line, "更新电台列表失败,请返回");
break;
case UPDATE_RADIO_LIST_SUCCEED:
sprintf(line, "更新电台列表成功,请返回");
break;
}
rtgui_dc_draw_text(dc, line, &rect);
rtgui_dc_end_drawing(dc);
rtgui_free(line);
}
开发者ID:eyyhappy,项目名称:network-radio,代码行数:43,代码来源:radio_list_update.c
示例20: _app_info_draw
static void _app_info_draw(struct rtgui_listctrl *list, struct rtgui_dc* dc, rtgui_rect_t* rect, rt_uint16_t index)
{
struct rtgui_image *image;
rtgui_rect_t item_rect, image_rect;
struct rtgui_application_item *item, *items;
item_rect = *rect;
item_rect.x1 += 5;
/* draw item */
items = (struct rtgui_application_item*)list->items;
item = &items[index];
/* draw image */
if (item->app->icon != RT_NULL) image = item->app->icon;
else image = app_default_icon;
if (image != RT_NULL)
{
image_rect.x1 = image_rect.y1 = 0;
image_rect.x2 = app_default_icon->w;
image_rect.y2 = app_default_icon->h;
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_image_blit(image, dc, &image_rect);
}
item_rect.x1 += app_default_icon->w + RTGUI_WIDGET_DEFAULT_MARGIN;
/* draw text */
rtgui_dc_draw_text(dc, (const char*)item->app->name, &item_rect); item_rect.x1 += 60;
if (list->current_item == index)
{
/* draw close button */
image_rect.x1 = image_rect.y1 = 0;
image_rect.x2 = app_close->w;
image_rect.y2 = app_close->h;
item_rect.x1 = item_rect.x2 - 50;
rtgui_rect_moveto_align(&item_rect, &image_rect, RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_image_blit(app_close, dc, &image_rect);
}
}
开发者ID:amsl,项目名称:RTGUI,代码行数:43,代码来源:apps_list.c
注:本文中的rtgui_dc_draw_text函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论