当前位置: 首页>>代码示例>>C++>>正文


C++ rtgui_dc_begin_drawing函数代码示例

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


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

示例1: priv_page

static void priv_page(rtgui_widget_t *widget)
{
    struct rtgui_dc *dc;
    if (app_list->current_page == 0)
    {
        return;
    }
    app_list->current_page--;
    while ((app_list->current_page * 480) < app_list->listdisp_point.x)
    {

        app_list->listdisp_point.x -= 40;
        app_list->bgdisp_point.x -= 10;
        dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(widget));
        rtgui_dc_blit(app_list->bg_buffer, &app_list->bgdisp_point,
                      dc, &app_list->rect);
        rtgui_dc_blit(app_list->view_buffer, &app_list->listdisp_point,
                      dc, &app_list->view_rect);
        rtgui_dc_blit(app_list->pm_buffer, RT_NULL, dc, &app_list->pm_rect);
        rtgui_dc_end_drawing(dc);
    }
    app_list_pagemark_change(app_list);
    dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(widget));
    rtgui_dc_blit(app_list->pm_buffer, RT_NULL, dc, &app_list->pm_rect);
    rtgui_dc_end_drawing(dc);
}
开发者ID:003900107,项目名称:realboard-lpc4088,代码行数:26,代码来源:mainmenu.c

示例2: _rtgui_notebook_onmouse

static void _rtgui_notebook_onmouse(struct rtgui_notebook *notebook, struct rtgui_event_mouse* emouse)
{
	rtgui_rect_t rect;

	/* handle notebook bar */
	_rtgui_notebook_get_bar_rect(notebook, &rect);
	rtgui_widget_rect_to_device(RTGUI_WIDGET(notebook), &rect);
	if (rtgui_rect_contains_point(&rect, emouse->x, emouse->y) == RT_EOK)
	{
		int index;
		struct rtgui_dc* dc;

		if (notebook->flag == RTGUI_NOTEBOOK_BOTTOM || notebook->flag == RTGUI_NOTEBOOK_TOP)
		{
			index = (emouse->x - rect.x1) / notebook->tab_w;
			if (index < notebook->count && index != notebook->current)
			{
				/* update tab bar */
				dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(notebook));
				if (dc == RT_NULL) return;

				rtgui_notebook_set_current_by_index(notebook, index);

				_rtgui_notebook_draw_bar(notebook, dc);

				rtgui_dc_end_drawing(dc);
			}
		}
		else
		{
			index = (emouse->y - rect.y1) / notebook->tab_h;
			if (index < notebook->count && index != notebook->current)
			{
				/* update tab bar */
				dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(notebook));
				if (dc == RT_NULL) return;

				rtgui_notebook_set_current_by_index(notebook, index);
				_rtgui_notebook_draw_bar(notebook, dc);
				
				rtgui_dc_end_drawing(dc);
			}
		}
	}
	else
	{
		/* handle on page */
		if (RTGUI_OBJECT(notebook->childs[notebook->current].widget)->event_handler != RT_NULL)
			RTGUI_OBJECT(notebook->childs[notebook->current].widget)->event_handler(
					RTGUI_OBJECT(notebook->childs[notebook->current].widget),
					&(emouse->parent));
	}
}
开发者ID:fengye0316,项目名称:RTT_GPS_STUSB,代码行数:53,代码来源:notebook.c

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

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

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

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

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

示例8: _rtgui_plot_draw_curve

static void _rtgui_plot_draw_curve(struct rtgui_plot *plot, struct rtgui_event *event)
{
    int i;
    struct rtgui_dc *dc;

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

    if (RTGUI_MV_VIEW(plot)->model_number == 1)
    {
        _rtgui_plot_curve_onpaint(dc, plot,
                                  RTGUI_PLOT_CURVE(RTGUI_MV_VIEW(plot)->model),
                                  0, RTGUI_MV_MODEL(RTGUI_MV_VIEW(plot)->model)->length);
    }
    else
    {
        void **curve_array = (void **)RTGUI_MV_VIEW(plot)->model;
        for (i = 0; i < RTGUI_MV_VIEW(plot)->model_number; i++)
        {
            _rtgui_plot_curve_onpaint(dc, plot,
                                      RTGUI_PLOT_CURVE(curve_array[i]),
                                      0, RTGUI_MV_MODEL(curve_array[i])->length);
        }
    }

    rtgui_dc_end_drawing(dc);
}
开发者ID:BernardXiong,项目名称:realtouch,代码行数:28,代码来源:plot.c

示例9: rtgui_textbox_draw_caret

/* draw caret */
static void rtgui_textbox_draw_caret(rtgui_textbox_t *box, rt_uint16_t position)
{
	int x, y;
	rtgui_color_t color;
	rtgui_rect_t rect;
	int ofs = 0;
	struct rtgui_dc *dc;

	RT_ASSERT(box != RT_NULL);
	if (box->caret == RT_NULL)
		return;

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

	rect = box->caret_rect;

	for (x = rect.x1; x < rect.x2; x++)
	{
		for (y = rect.y1; y < rect.y2; y++)
		{
			color = *(box->caret + ofs);
			ofs++;
			if (box->flag & RTGUI_TEXTBOX_CARET_SHOW)
			{
				color = ~color;
			}
			rtgui_dc_draw_color_point(dc, x, y, color);
		}
	}

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

示例10: rtgui_edit_draw_caret

/* draw caret */
static void rtgui_edit_draw_caret(struct rtgui_edit *edit)
{
	int x,y;
	rtgui_color_t color;
	rtgui_rect_t rect;
	int ofs=0;
	struct rtgui_dc *dc;

	RT_ASSERT(edit != RT_NULL);
	if(edit->caret == RT_NULL) return;
	
	rect = edit->caret_rect;
	dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(edit));
	if(dc == RT_NULL)return;

	for(x=rect.x1; x<rect.x2; x++)
	{
		for(y=rect.y1; y<rect.y2; y++)
		{
			color = *(edit->caret + ofs);
			ofs++;
			if(edit->flag & RTGUI_EDIT_CARET)
			{
				color = ~color;
				rtgui_dc_draw_color_point(dc, x,y, color);
			}
			else
			{
				rtgui_dc_draw_color_point(dc, x,y, color);
			}
		}
	}

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

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

示例12: dc_buffer_event_handler

/*
 * view的事件处理函数
 */
static rt_bool_t dc_buffer_event_handler(PVOID wdt, rtgui_event_t *event)
{

	/* 仅对PAINT事件进行处理 */
	if (event->type == RTGUI_EVENT_PAINT) {
		struct rtgui_dc* dc;
		rtgui_rect_t rect;

		/*
		 * 因为用的是demo view,上面本身有一部分控件,所以在绘图时先要让demo view
		 * 先绘图
		 */
		rtgui_view_event_handler(wdt, event);

		/* 获得控件所属的DC */
		dc = rtgui_dc_begin_drawing(wdt);
		/* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
		if (dc == RT_NULL)
			return RT_FALSE;
		rtgui_widget_get_rect(wdt, &rect);
		rect.x1 += 10;
		rect.y1 += 40;
		rtgui_dc_blit(dc_buffer, NULL, dc, &rect);

		/* 绘图完成 */
		rtgui_dc_end_drawing(dc);
	} else {
		/* 其他事件,调用默认的事件处理函数 */
		return rtgui_view_event_handler(wdt, event);
	}

	return RT_FALSE;
}
开发者ID:malooei,项目名称:yeejoin-workspace,代码行数:36,代码来源:demo_gui_dc_buffer.c

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

示例14: animation_event_handler

static rt_bool_t animation_event_handler(rtgui_widget_t* widget, rtgui_event_t *event)
{
	if (event->type == RTGUI_EVENT_PAINT)
	{
		struct rtgui_dc* dc;
		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 RT_FALSE;

        /* 获得demo view允许绘图的区域 */
        demo_view_get_logic_rect(RTGUI_VIEW(widget), &rect);

		/* 绘图 */
		rect = text_rect;
		rtgui_rect_inflate(&rect, +1);
		rtgui_dc_blit(dc_buffer, NULL, dc, &rect);

		/* 绘图完成 */
		rtgui_dc_end_drawing(dc);
	}
	else
	{
		/* 调用默认的事件处理函数 */
		return rtgui_view_event_handler(widget, event);
	}

	return RT_FALSE;
}
开发者ID:CollinsLiu,项目名称:rt-thread-pc,代码行数:34,代码来源:demo_view_buffer_animation.c

示例15: demo_view_event_handler

/* 演示视图的事件处理函数 */
static rt_bool_t demo_view_event_handler(rtgui_widget_t* widget, rtgui_event_t *event)
{
	rt_bool_t result;

	/* 先调用默认的事件处理函数(这里只关心PAINT事件,但演示视图还有本身的一些控件) */
	result = rtgui_view_event_handler(widget, event);

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

		/* 获得控件所属的DC */
		dc = rtgui_dc_begin_drawing(widget);
		if (dc == RT_NULL)
			/* 如果不能正常获得DC,返回(如果控件或父控件是隐藏状态,DC是获取不成功的) */
			return RT_FALSE;

		/* 获得demo view允许绘图的区域 */
		demo_view_get_rect(RTGUI_VIEW(widget), &rect);

		/* 获得图像显示区域 */
		rect.x1 += 5; rect.x2 -= 5;
		rect.y1 += 30;

		if (image != RT_NULL)
			rtgui_image_blit(image, dc, &rect);

		/* 绘图完成 */
		rtgui_dc_end_drawing(dc);
	}

	return result;
}
开发者ID:aspirefhaha,项目名称:ad7606_stm32107,代码行数:35,代码来源:demo_view_image.c


注:本文中的rtgui_dc_begin_drawing函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。