C++ rtgui_dc_fill_rect函数代码示例

本文整理汇总了C++中rtgui_dc_fill_rect函数的典型用法代码示例。如果您正苦于以下问题:C++ rtgui_dc_fill_rect函数的具体用法?C++ rtgui_dc_fill_rect怎么用?C++ rtgui_dc_fill_rect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


C++ rtgui_dc_fill_rect函数代码示例

在下文中一共展示了rtgui_dc_fill_rect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: rtgui_combo_ondraw

void rtgui_combo_ondraw(rtgui_combo_t *cbo)
{
	rtgui_rect_t rect;
	rtgui_dc_t* dc;

	RT_ASSERT(cbo != RT_NULL);

	/* begin drawing */
	dc = rtgui_dc_begin_drawing(cbo);
	if(dc == RT_NULL)return;

	rtgui_widget_get_rect(cbo, &rect);

	rtgui_rect_inflate(&rect,-RTGUI_WIDGET_BORDER_SIZE(cbo));
	if(RTGUI_WIDGET_IS_ENABLE(cbo))
		RTGUI_DC_BC(dc) = theme.blankspace;
	else
		RTGUI_DC_BC(dc) = theme.background;
	rtgui_dc_fill_rect(dc, &rect);

	rtgui_rect_inflate(&rect,RTGUI_WIDGET_BORDER_SIZE(cbo));
	rtgui_dc_draw_border(dc, &rect,RTGUI_WIDGET_BORDER_STYLE(cbo));

	if(RC_H(rect)<RTGUI_COMBO_HEIGHT)return;

	/* draw downarrow button */
	rect.x1 = rect.x2-RTGUI_COMBO_BUTTON_WIDTH;
	RTGUI_DC_BC(dc) = theme.background;
	rtgui_dc_fill_rect(dc, &rect);

	if(cbo->style & RTGUI_COMBO_STYLE_DOWNARROW_UP)
	{
		rtgui_dc_draw_border(dc, &rect, theme.style);
		rtgui_dc_draw_byte(dc,rect.x1+(rect.x2-rect.x1-7)/2, rect.y1+(rect.y2-rect.y1-4)/2, 4, combo_down_bmp);
	}
	else if(cbo->style & RTGUI_COMBO_STYLE_DOWNARROW_DOWN)
	{
		rtgui_dc_draw_border(dc, &rect, theme.style);
		rtgui_dc_draw_byte(dc,rect.x1+(rect.x2-rect.x1-7)/2+1, rect.y1+(rect.y2-rect.y1-4)/2+1, 4, combo_down_bmp);
	}

	if(cbo->tbox != RT_NULL)
	{
		RTGUI_DC_FC(dc) = theme.foreground;
		rtgui_textbox_ondraw(cbo->tbox);
	}

	rtgui_dc_end_drawing(dc);
}
开发者ID:amsl,项目名称:RTGUI,代码行数:49,代码来源:combobox.c

示例3: 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

示例4: _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

示例5: _onidle

void _onidle(struct rtgui_object *object, rtgui_event_t *event)
{
	rtgui_color_t color;
	rtgui_rect_t rect, draw_rect;
	struct rtgui_dc *dc;

	/* 获得控件所属的DC */
	// dc = rtgui_dc_hw_create(RTGUI_WIDGET(container)); 
	dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(container));
	if (dc == RT_NULL)
		return;

	demo_view_get_logic_rect(RTGUI_CONTAINER(container), &rect);
	draw_rect.x1 = RAND(rect.x1, rect.x2);
	draw_rect.y1 = RAND(rect.y1, rect.y2);
	draw_rect.x2 = RAND(draw_rect.x1, rect.x2);
	draw_rect.y2 = RAND(draw_rect.y1, rect.y2);

	color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255);
	RTGUI_WIDGET_BACKGROUND(RTGUI_WIDGET(container)) = color;

	rtgui_dc_fill_rect(dc, &draw_rect);

	/* 绘图完成 */
	rtgui_dc_end_drawing(dc);
}
开发者ID:cahill123,项目名称:shenzhou-iv-stm32f107-rt-thread,代码行数:26,代码来源:demo_view_benchmark.c

示例6: picture_win_onpaint

rt_bool_t picture_win_onpaint(struct rtgui_object* object, struct rtgui_event* event)
{
	struct rtgui_widget *widget = RTGUI_WIDGET(object);

	if (event->type == RTGUI_EVENT_PAINT)
	{
		struct rtgui_dc* dc;
		struct rtgui_rect rect;
		struct rtgui_event_paint event;

		rt_kprintf("handle custom paint event\n");

		/* begin drawing */
		dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(widget));
		if (dc == RT_NULL)
		{
			rt_kprintf("dc init failed\n");
			return RT_FALSE;
		}

		/* get window rect */
		rtgui_widget_get_rect(RTGUI_WIDGET(widget), &rect);

		RTGUI_DC_BC(dc) = white;
		rtgui_dc_fill_rect(dc, &rect);

		rtgui_dc_end_drawing(dc);

		return RT_FALSE;
	}
	else
	{
		return rtgui_win_event_handler(object, event);
	}
}
开发者ID:EvanZheng,项目名称:RTGUI,代码行数:35,代码来源:swin_focus.c

示例7: _rtgui_notebook_ondraw

static void _rtgui_notebook_ondraw(struct rtgui_notebook *notebook)
{
	struct rtgui_dc* dc;

	dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(notebook));
	if (dc == RT_NULL) return;

	if (notebook->count == 0)
	{
		rtgui_rect_t rect;
		rtgui_widget_get_rect(RTGUI_WIDGET(notebook), &rect);
		rtgui_dc_fill_rect(dc, &rect);
	}
	else
	{
		if (notebook->current == RTGUI_NOT_FOUND)
			notebook->current = 0;

		_rtgui_notebook_draw_bar(notebook, dc);

		/* draw current tab */
		rtgui_widget_update(notebook->childs[notebook->current].widget);
	}
	rtgui_dc_end_drawing(dc);
}
开发者ID:fengye0316,项目名称:RTT_GPS_STUSB,代码行数:25,代码来源:notebook.c

示例8: rtgui_win_ondraw

static rt_bool_t rtgui_win_ondraw(struct rtgui_win* win)
{
    struct rtgui_dc* dc;
    struct rtgui_rect rect;
    struct rtgui_event_paint event;

    /* begin drawing */
    dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(win));
    if (dc == RT_NULL)
        return RT_FALSE;

    /* get window rect */
    rtgui_widget_get_rect(RTGUI_WIDGET(win), &rect);
    /* fill area */
    rtgui_dc_fill_rect(dc, &rect);

    /* paint each widget */
    RTGUI_EVENT_PAINT_INIT(&event);
    event.wid = RT_NULL;
    rtgui_container_dispatch_event(RTGUI_CONTAINER(win),
                                   (rtgui_event_t*)&event);

    rtgui_dc_end_drawing(dc);

    return RT_FALSE;
}
开发者ID:zhangjinxing,项目名称:RTGUI,代码行数:26,代码来源:window.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: _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

示例11: rtgui_combo_draw_downarrow

void rtgui_combo_draw_downarrow(rtgui_combo_t *cbo)
{
	rtgui_rect_t rect;
	rtgui_dc_t* dc;

	RT_ASSERT(cbo != RT_NULL);

	/* begin drawing */
	dc = rtgui_dc_begin_drawing(cbo);
	if(dc == RT_NULL)return;

	rtgui_widget_get_rect(cbo, &rect);

	rect.x1 = rect.x2-RTGUI_COMBO_BUTTON_WIDTH-RTGUI_WIDGET_BORDER_SIZE(cbo);
	rect.y1 += RTGUI_WIDGET_BORDER_SIZE(cbo);
	rect.x2 -= RTGUI_WIDGET_BORDER_SIZE(cbo);
	rect.y2 -= RTGUI_WIDGET_BORDER_SIZE(cbo);
	RTGUI_DC_BC(dc) = theme.background;
	rtgui_dc_fill_rect(dc, &rect);

	if(cbo->style & RTGUI_COMBO_STYLE_DOWNARROW_UP)
	{
		rtgui_dc_draw_border(dc, &rect,RTGUI_WIDGET_BORDER_STYLE(cbo));
		rtgui_dc_draw_byte(dc,rect.x1+4, rect.y1+8, 4, combo_down_bmp);
	}
	else if(cbo->style & RTGUI_COMBO_STYLE_DOWNARROW_DOWN)
	{
		rtgui_dc_draw_border(dc, &rect,RTGUI_WIDGET_BORDER_STYLE(cbo));
		rtgui_dc_draw_byte(dc,rect.x1+5, rect.y1+9, 4, combo_down_bmp);
	}

	rtgui_dc_end_drawing(dc);
}
开发者ID:amsl,项目名称:RTGUI,代码行数:33,代码来源:combobox.c

示例12: 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

示例13: _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

示例14: _onidle

void _onidle(PVOID wdt, rtgui_event_t *event)
{
	rtgui_color_t color;
	rtgui_rect_t rect, draw_rect;
	struct rtgui_dc *dc;

	/* 获得控件所属的DC */
	dc = rtgui_dc_begin_drawing(view);
	if (dc == RT_NULL) return ;

	rtgui_widget_get_rect(view, &rect);
	rtgui_rect_inflate(&rect, -5);
	rect.y1 += 35;
	draw_rect.x1 = RAND(rect.x1, rect.x2);
	draw_rect.y1 = RAND(rect.y1, rect.y2);
	draw_rect.x2 = RAND(draw_rect.x1, rect.x2);
	draw_rect.y2 = RAND(draw_rect.y1, rect.y2);

	color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255);
	RTGUI_WIDGET_BACKGROUND(view) = color;

	rtgui_dc_fill_rect(dc, &draw_rect);

	/* 绘图完成 */
	rtgui_dc_end_drawing(dc);
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:26,代码来源:demo_gui_benchmark.c

示例15: 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

本文标签属性:

示例:示例是什么意思

代码:代码零九

上一篇:PHP StoreManager::setCurrentStore方法代码示例
下一篇:贺军翔绯闻女友及贺军翔绯闻女友是谁(贺军翔绯闻女友是谁)

为您推荐