提交 db064602 编写于 作者: C chaos.proton@gmail.com

merge new RTGUI in to trunk

The full log is at https://github.com/RTGUI/RTGUI/commits/merge_1 and it's difficult to merge the new tree commit by commit. I also converted all the file into unix eol so there are many fake diff. Big changes are noted in rtgui/doc/road_map.txt and rtgui/doc/attention.txt. Keep an eye on them if you want to migrate your old code.

Note that the work is still in progress and the bsp is not prepared in trunk so far.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2092 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 06d45f0c
Import('RTT_ROOT')
from building import *
common_src = Split("""
common/blit.c
common/color.c
common/region.c
common/rtgui_object.c
common/rtgui_system.c
common/rtgui_theme.c
common/rtgui_xml.c
common/dc.c
common/dc_hw.c
common/dc_buffer.c
common/dc_client.c
common/filerw.c
common/image.c
common/image_xpm.c
common/image_hdc.c
common/image_bmp.c
common/image_png.c
common/image_jpg.c
common/image_container.c
common/font.c
common/font_bmp.c
common/font_hz_file.c
common/font_hz_bmp.c
common/asc12font.c
common/asc16font.c
common/hz12font.c
common/hz16font.c
common/framebuffer_driver.c
common/pixel_driver.c
""")
server_src = Split("""
server/driver.c
server/mouse.c
server/panel.c
server/server.c
server/topwin.c
""")
widgets_src = Split("""
widgets/box.c
widgets/button.c
widgets/checkbox.c
widgets/container.c
widgets/combobox.c
widgets/iconbox.c
widgets/label.c
widgets/textview.c
widgets/listctrl.c
widgets/menu.c
widgets/progressbar.c
widgets/radiobox.c
widgets/slider.c
widgets/scrollbar.c
widgets/staticline.c
widgets/textbox.c
widgets/listbox.c
widgets/title.c
widgets/toplevel.c
widgets/notebook.c
widgets/view.c
widgets/list_view.c
widgets/about_view.c
widgets/filelist_view.c
widgets/widget.c
widgets/window.c
widgets/workbench.c
""")
# The set of source files associated with this SConscript file.
src = common_src + server_src + widgets_src
path = [RTT_ROOT + '/components/rtgui/include',
RTT_ROOT + '/components/rtgui/common',
RTT_ROOT + '/components/rtgui/server',
RTT_ROOT + '/components/rtgui/widgets']
group = DefineGroup('RTGUI', src, depend = ['RT_USING_RTGUI'], CPPPATH = path)
Return('group')
Import('RTT_ROOT')
from building import *
common_src = Split("""
common/blit.c
common/color.c
common/region.c
common/rtgui_object.c
common/rtgui_system.c
common/rtgui_theme.c
common/rtgui_xml.c
common/dc.c
common/dc_hw.c
common/dc_buffer.c
common/dc_client.c
common/filerw.c
common/image.c
common/image_xpm.c
common/image_hdc.c
common/image_bmp.c
common/image_png.c
common/image_jpg.c
common/image_container.c
common/font.c
common/font_bmp.c
common/font_hz_file.c
common/font_hz_bmp.c
common/asc12font.c
common/asc16font.c
common/hz12font.c
common/hz16font.c
common/framebuffer_driver.c
common/pixel_driver.c
""")
server_src = Split("""
server/rtgui_application.c
server/driver.c
server/mouse.c
server/server.c
server/topwin.c
""")
widgets_src = Split("""
widgets/box.c
widgets/button.c
widgets/checkbox.c
widgets/combobox.c
widgets/iconbox.c
widgets/label.c
widgets/textview.c
widgets/listctrl.c
widgets/menu.c
widgets/progressbar.c
widgets/radiobox.c
widgets/slider.c
widgets/scrollbar.c
widgets/staticline.c
widgets/textbox.c
widgets/listbox.c
widgets/title.c
widgets/toplevel.c
widgets/notebook.c
widgets/container.c
widgets/list_view.c
widgets/about_view.c
widgets/filelist_view.c
widgets/widget.c
widgets/window.c
""")
# The set of source files associated with this SConscript file.
src = common_src + server_src + widgets_src
path = [RTT_ROOT + '/components/rtgui/include',
RTT_ROOT + '/components/rtgui/common',
RTT_ROOT + '/components/rtgui/server',
RTT_ROOT + '/components/rtgui/widgets']
group = DefineGroup('RTGUI', src, depend = ['RT_USING_RTGUI'], CPPPATH = path)
Return('group')
此差异已折叠。
......@@ -21,9 +21,10 @@
#include <rtgui/driver.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
#include <rtgui/rtgui_application.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/widgets/container.h>
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/title.h>
static void rtgui_dc_client_draw_point(struct rtgui_dc* dc, int x, int y);
......@@ -48,14 +49,11 @@ struct rtgui_dc* rtgui_dc_begin_drawing(rtgui_widget_t* owner)
{
RT_ASSERT(owner != RT_NULL);
if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
rtgui_rect_is_equal(&(owner->extent), &(owner->clip.extents)) == RT_EOK)
{
/* use hardware DC */
return rtgui_dc_hw_create(owner);
}
return rtgui_dc_client_create(owner);
else
return rtgui_dc_client_create(owner);
}
void rtgui_dc_end_drawing(struct rtgui_dc* dc)
......@@ -63,7 +61,7 @@ void rtgui_dc_end_drawing(struct rtgui_dc* dc)
dc->engine->fini(dc);
}
const struct rtgui_dc_engine dc_client_engine =
const struct rtgui_dc_engine dc_client_engine =
{
rtgui_dc_client_draw_point,
rtgui_dc_client_draw_color_point,
......@@ -116,7 +114,7 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
if (RTGUI_WIDGET_IS_HIDE(widget))
{
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
break;
return RT_NULL;
}
widget = widget->parent;
......@@ -130,7 +128,7 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
if (top->drawing == 1)
{
#ifdef RTGUI_USING_MOUSE_CURSOR
#ifdef __WIN32__
#ifdef _WIN32
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
......@@ -141,15 +139,18 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
#endif
}
}
else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
else if (RTGUI_IS_APPLICATION(owner->toplevel))
{
RT_ASSERT(0);
}
else if (RTGUI_IS_WIN(owner->toplevel))
{
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef __WIN32__
#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
......@@ -161,7 +162,7 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
RTGUI_EVENT_UPDATE_BEGIN_INIT(&(eupdate));
eupdate.rect = RTGUI_WIDGET(top)->extent;
rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
#endif
}
}
......@@ -186,7 +187,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
top->drawing --;
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
#ifdef __WIN32__
#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
......@@ -206,7 +207,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
#endif
}
}
else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
else if (RTGUI_IS_APPLICATION(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
......@@ -214,7 +215,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
#ifdef __WIN32__
#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
......@@ -229,7 +230,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
eupdate.rect = owner->extent;
rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
#endif
}
}
......
......@@ -15,9 +15,11 @@
#include <rtgui/dc_hw.h>
#include <rtgui/driver.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/view.h>
#include <rtgui/rtgui_application.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/widgets/container.h>
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/workbench.h>
#include <rtgui/widgets/title.h>
static void rtgui_dc_hw_draw_point(struct rtgui_dc* dc, int x, int y);
......@@ -81,7 +83,7 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
if (RTGUI_WIDGET_IS_HIDE(widget))
{
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
break;
return RT_NULL;
}
widget = widget->parent;
......@@ -104,7 +106,7 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
if (top->drawing == 1)
{
#ifdef RTGUI_USING_MOUSE_CURSOR
#ifdef __WIN32__
#ifdef _WIN32
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
......@@ -115,7 +117,7 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
#endif
}
}
else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
else if (RTGUI_IS_APPLICATION(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
......@@ -123,7 +125,7 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
if (top->drawing == 1)
{
#ifdef __WIN32__
#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
......@@ -135,7 +137,7 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
RTGUI_EVENT_UPDATE_BEGIN_INIT(&(eupdate));
eupdate.rect = RTGUI_WIDGET(top)->extent;
rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
#endif
}
}
......@@ -162,7 +164,7 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
top->drawing --;
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
#ifdef __WIN32__
#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
......@@ -182,7 +184,7 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
#endif
}
}
else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
else if (RTGUI_IS_APPLICATION(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
......@@ -190,7 +192,7 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
#ifdef __WIN32__
#ifdef _WIN32
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
......@@ -205,7 +207,7 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
eupdate.rect = owner->extent;
rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
#endif
}
}
......
此差异已折叠。
#include <rtgui/font_freetype.h>
#ifdef RTGUI_USING_TTF
#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect);
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
struct rtgui_font_engine freetype_font_engine =
{
RT_NULL,
RT_NULL,
rtgui_freetype_font_draw_text,
rtgui_freetype_font_get_metrics
};
struct rtgui_freetype_font
{
int bold;
int italic;
FT_Face face;
FT_Library library;
};
static void gbk_to_unicode(rt_uint16_t *unicode, const unsigned char *text, int len)
{
int i;
unsigned short wch;
extern unsigned short ff_convert(unsigned short wch, int direction);
for (i = 0; i < len; )
{
if (*text < 0x80)
{
wch = *text;
*unicode = ff_convert(wch, 1);
text ++;
i ++;
}
else
{
wch = wch = *(text + 1) | (*text << 8);
*unicode = ff_convert(wch, 1);
text += 2;
i += 2;
}
unicode ++;
}
*unicode = '\0';
}
static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
{
int index = 0;
FT_Error err = 0;
rt_uint16_t *text_short, *text_ptr;
struct rtgui_freetype_font* freetype;
RT_ASSERT(font != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
RT_ASSERT(freetype != RT_NULL);
/* allocate unicode buffer */
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
if (text_short == RT_NULL) return ; /* out of memory */
/* convert gbk to unicode */
gbk_to_unicode(text_short, text, len);
text_ptr = text_short;
while (*text_ptr)
{
index = FT_Get_Char_Index(freetype->face, *text_ptr);
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT|FT_LOAD_RENDER);
if (err == 0)
{
int rows, x;
rt_uint8_t* ptr;
/* render font */
ptr = (rt_uint8_t*)freetype->face->glyph->bitmap.buffer;
for (rows = 0; rows < freetype->face->glyph->bitmap.rows; rows ++)
for (x = 0; x < freetype->face->glyph->bitmap.width; x++)
{
if (*ptr > 0)
rtgui_dc_draw_color_point(dc, rect->x1 + x, rect->y1 + rows, RTGUI_RGB(0xff - *ptr, 0xff - *ptr, 0xff - *ptr));
ptr ++;
}
}
text_ptr ++;
rect->x1 += freetype->face->glyph->bitmap.width;
}
/* release unicode buffer */
rtgui_free(text_short);
}
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
{
int index = 0, len;
FT_Error err = 0;
rt_uint16_t w = 0, h = 0;
rt_uint16_t *text_short, *text_ptr;
struct rtgui_freetype_font* freetype;
RT_ASSERT(font != RT_NULL);
RT_ASSERT(rect != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
RT_ASSERT(freetype != RT_NULL);
len = strlen(text);
memset(rect, 0, sizeof(struct rtgui_rect));
/* allocate unicode buffer */
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
if (text_short == RT_NULL) return ; /* out of memory */
/* convert gbk to unicode */
gbk_to_unicode(text_short, text, len);
text_ptr = text_short;
while (*text_ptr)
{
index = FT_Get_Char_Index(freetype->face, *text_ptr);
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT);
if (err == 0)
{
w += freetype->face->glyph->bitmap.width;
if (freetype->face->glyph->bitmap.rows > h)
{
h = freetype->face->glyph->bitmap.rows;
}
}
text_ptr ++;
}
rect->x1 = 0; rect->y1 = 0;
rect->x2 = w; rect->y2 = h;
/* release unicode buffer */
rtgui_free(text_short);
}
rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int italic, rt_size_t size)
{
FT_Error err = 0;
struct rtgui_font* font;
font = (struct rtgui_font*) rtgui_malloc (sizeof(struct rtgui_font));
if (font != RT_NULL)
{
struct rtgui_freetype_font* freetype;
freetype = (struct rtgui_freetype_font*) rtgui_malloc (sizeof(struct rtgui_freetype_font));
if (freetype == RT_NULL)
{
rt_free(font);
font = RT_NULL;
}
else
{
err = FT_Init_FreeType(&freetype->library);
if((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
{
FT_Done_FreeType(freetype->library);
rt_free(font);
font = RT_NULL;
}
else
{
err = FT_Select_Charmap(freetype->face, ft_encoding_unicode);
if(err)
{
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1 );
}
err = FT_Set_Pixel_Sizes(freetype->face, 0, size);
if (err != 0)
{
rtgui_free(font);
font = RT_NULL;
FT_Done_FreeType(freetype->library);
rtgui_free(freetype);
return RT_NULL;
}
freetype->bold = bold;
freetype->italic = italic;
rt_kprintf("fonfile:%s\n", filename);
rt_kprintf("font family_name:%s\n", freetype->face->family_name);
rt_kprintf("font style_name:%s\n", freetype->face->style_name);
/* set user data */
font->data = freetype;
font->family = rt_strdup(freetype->face->family_name);
font->height = (rt_uint16_t)size;
font->refer_count = 0;
font->engine = &freetype_font_engine;
/* add to system */
rtgui_font_system_add_font(font);
}
}
}
return font;
}
void rtgui_freetype_font_destroy(rtgui_font_t* font)
{
struct rtgui_freetype_font* freetype;
RT_ASSERT(font != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
RT_ASSERT(freetype != RT_NULL);
rtgui_font_system_remove_font(font);
FT_Done_Face (freetype->face);
FT_Done_FreeType(freetype->library);
rtgui_free(freetype);
rtgui_free(font);
}
#endif
#include <rtgui/font_freetype.h>
#ifdef RTGUI_USING_TTF
#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect);
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
struct rtgui_font_engine freetype_font_engine =
{
RT_NULL,
RT_NULL,
rtgui_freetype_font_draw_text,
rtgui_freetype_font_get_metrics
};
struct rtgui_freetype_font
{
int bold;
int italic;
FT_Face face;
FT_Library library;
};
static void gbk_to_unicode(rt_uint16_t *unicode, const unsigned char *text, int len)
{
int i;
unsigned short wch;
extern unsigned short ff_convert(unsigned short wch, int direction);
for (i = 0; i < len; )
{
if (*text < 0x80)
{
wch = *text;
*unicode = ff_convert(wch, 1);
text ++;
i ++;
}
else
{
wch = wch = *(text + 1) | (*text << 8);
*unicode = ff_convert(wch, 1);
text += 2;
i += 2;
}
unicode ++;
}
*unicode = '\0';
}
static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
{
int index = 0;
FT_Error err = 0;
rt_uint16_t *text_short, *text_ptr;
struct rtgui_freetype_font* freetype;
RT_ASSERT(font != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
RT_ASSERT(freetype != RT_NULL);
/* allocate unicode buffer */
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
if (text_short == RT_NULL) return ; /* out of memory */
/* convert gbk to unicode */
gbk_to_unicode(text_short, text, len);
text_ptr = text_short;
while (*text_ptr)
{
index = FT_Get_Char_Index(freetype->face, *text_ptr);
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT|FT_LOAD_RENDER);
if (err == 0)
{
int rows, x;
rt_uint8_t* ptr;
/* render font */
ptr = (rt_uint8_t*)freetype->face->glyph->bitmap.buffer;
for (rows = 0; rows < freetype->face->glyph->bitmap.rows; rows ++)
for (x = 0; x < freetype->face->glyph->bitmap.width; x++)
{
if (*ptr > 0)
rtgui_dc_draw_color_point(dc, rect->x1 + x, rect->y1 + rows, RTGUI_RGB(0xff - *ptr, 0xff - *ptr, 0xff - *ptr));
ptr ++;
}
}
text_ptr ++;
rect->x1 += freetype->face->glyph->bitmap.width;
}
/* release unicode buffer */
rtgui_free(text_short);
}
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
{
int index = 0, len;
FT_Error err = 0;
rt_uint16_t w = 0, h = 0;
rt_uint16_t *text_short, *text_ptr;
struct rtgui_freetype_font* freetype;
RT_ASSERT(font != RT_NULL);
RT_ASSERT(rect != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
RT_ASSERT(freetype != RT_NULL);
len = strlen(text);
memset(rect, 0, sizeof(struct rtgui_rect));
/* allocate unicode buffer */
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
if (text_short == RT_NULL) return ; /* out of memory */
/* convert gbk to unicode */
gbk_to_unicode(text_short, text, len);
text_ptr = text_short;
while (*text_ptr)
{
index = FT_Get_Char_Index(freetype->face, *text_ptr);
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT);
if (err == 0)
{
w += freetype->face->glyph->bitmap.width;
if (freetype->face->glyph->bitmap.rows > h)
{
h = freetype->face->glyph->bitmap.rows;
}
}
text_ptr ++;
}
rect->x1 = 0; rect->y1 = 0;
rect->x2 = w; rect->y2 = h;
/* release unicode buffer */
rtgui_free(text_short);
}
rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int italic, rt_size_t size)
{
FT_Error err = 0;
struct rtgui_font* font;
font = (struct rtgui_font*) rtgui_malloc (sizeof(struct rtgui_font));
if (font != RT_NULL)
{
struct rtgui_freetype_font* freetype;
freetype = (struct rtgui_freetype_font*) rtgui_malloc (sizeof(struct rtgui_freetype_font));
if (freetype == RT_NULL)
{
rt_free(font);
font = RT_NULL;
}
else
{
err = FT_Init_FreeType(&freetype->library);
if((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
{
FT_Done_FreeType(freetype->library);
rt_free(font);
font = RT_NULL;
}
else
{
err = FT_Select_Charmap(freetype->face, ft_encoding_unicode);
if(err)
{
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1 );
}
err = FT_Set_Pixel_Sizes(freetype->face, 0, size);
if (err != 0)
{
rtgui_free(font);
font = RT_NULL;
FT_Done_FreeType(freetype->library);
rtgui_free(freetype);
return RT_NULL;
}
freetype->bold = bold;
freetype->italic = italic;
rt_kprintf("fonfile:%s\n", filename);
rt_kprintf("font family_name:%s\n", freetype->face->family_name);
rt_kprintf("font style_name:%s\n", freetype->face->style_name);
/* set user data */
font->data = freetype;
font->family = rt_strdup(freetype->face->family_name);
font->height = (rt_uint16_t)size;
font->refer_count = 0;
font->engine = &freetype_font_engine;
/* add to system */
rtgui_font_system_add_font(font);
}
}
}
return font;
}
void rtgui_freetype_font_destroy(rtgui_font_t* font)
{
struct rtgui_freetype_font* freetype;
RT_ASSERT(font != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
RT_ASSERT(freetype != RT_NULL);
rtgui_font_system_remove_font(font);
FT_Done_Face (freetype->face);
FT_Done_FreeType(freetype->library);
rtgui_free(freetype);
rtgui_free(font);
}
#endif
......@@ -86,7 +86,7 @@ static void rtgui_hz_bitmap_font_draw_text (struct rtgui_font* font, struct rtgu
while (length > 0)
{
len = 0;
while (((rt_uint8_t)*(text + len)) < 0x80 && *(text + len)) len ++;
while (((rt_uint8_t)*(text + len)) < 0x80 && *(text + len) && len < length) len ++;
/* draw text with English font */
if (len > 0)
{
......@@ -97,7 +97,7 @@ static void rtgui_hz_bitmap_font_draw_text (struct rtgui_font* font, struct rtgu
}
len = 0;
while (((rt_uint8_t)*(text + len)) >= 0x80) len ++;
while (((rt_uint8_t)*(text + len)) >= 0x80 && len < length) len ++;
if (len > 0)
{
_rtgui_hz_bitmap_font_draw_text(bmp_font, dc, text, len, rect);
......
......@@ -177,7 +177,7 @@ static void rtgui_hz_file_font_draw_text(struct rtgui_font* font, struct rtgui_d
while (length > 0)
{
len = 0;
while (((rt_uint8_t)*(text + len)) < 0x80 && *(text + len)) len ++;
while (((rt_uint8_t)*(text + len)) < 0x80 && *(text + len) && len < length) len ++;
/* draw text with English font */
if (len > 0)
{
......@@ -188,7 +188,7 @@ static void rtgui_hz_file_font_draw_text(struct rtgui_font* font, struct rtgui_d
}
len = 0;
while (((rt_uint8_t)*(text + len)) >= 0x80) len ++;
while (((rt_uint8_t)*(text + len)) >= 0x80 && len < length) len ++;
if (len > 0)
{
_rtgui_hz_file_font_draw_text(hz_file_font, dc, text, len, rect);
......
#include <rtgui/rtgui_system.h>
#include <rtgui/driver.h>
#define GET_PIXEL(dst, x, y, type) \
(type *)((rt_uint8_t*)((dst)->framebuffer) + (y) * (dst)->pitch + (x) * ((dst)->bits_per_pixel/8))
static void _rgb565_set_pixel(rtgui_color_t *c, int x, int y)
{
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565(*c);
}
static void _rgb565_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
/* get pixel from color */
*c = rtgui_color_from_565(pixel);
}
static void _rgb565_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_ubase_t index;
rt_uint16_t pixel;
rt_uint16_t *pixel_ptr;
/* get pixel from color */
pixel = rtgui_color_to_565(*c);
/* get pixel pointer in framebuffer */
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
for (index = x1; index < x2; index ++)
{
*pixel_ptr = pixel;
pixel_ptr ++;
}
}
static void _rgb565_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
{
rt_uint8_t *dst;
rt_uint16_t pixel;
rt_ubase_t index;
pixel = rtgui_color_to_565(*c);
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
for (index = y1; index < y2; index ++)
{
*(rt_uint16_t*)dst = pixel;
dst += rtgui_graphic_get_device()->pitch;
}
}
static void _rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
{
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565p(*c);
}
static void _rgb565p_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
/* get pixel from color */
*c = rtgui_color_from_565p(pixel);
}
static void _rgb565p_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_ubase_t index;
rt_uint16_t pixel;
rt_uint16_t *pixel_ptr;
/* get pixel from color */
pixel = rtgui_color_to_565p(*c);
/* get pixel pointer in framebuffer */
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
for (index = x1; index < x2; index ++)
{
*pixel_ptr = pixel;
pixel_ptr ++;
}
}
static void _rgb565p_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
{
rt_uint8_t *dst;
rt_uint16_t pixel;
rt_ubase_t index;
pixel = rtgui_color_to_565p(*c);
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
for (index = y1; index < y2; index ++)
{
*(rt_uint16_t*)dst = pixel;
dst += rtgui_graphic_get_device()->pitch;
}
}
/* draw raw hline */
static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
rt_uint8_t *dst;
dst = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint8_t);
rt_memcpy(dst, pixels, (x2 - x1) * (rtgui_graphic_get_device()->bits_per_pixel/8));
}
const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops =
{
_rgb565_set_pixel,
_rgb565_get_pixel,
_rgb565_draw_hline,
_rgb565_draw_vline,
framebuffer_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops _framebuffer_rgb565p_ops =
{
_rgb565p_set_pixel,
_rgb565p_get_pixel,
_rgb565p_draw_hline,
_rgb565p_draw_vline,
framebuffer_draw_raw_hline,
};
#define FRAMEBUFFER (rtgui_graphic_get_device()->framebuffer)
#define MONO_PIXEL(framebuffer, x, y) \
((rt_uint8_t**)(framebuffer))[y/8][x]
static void _mono_set_pixel(rtgui_color_t *c, int x, int y)
{
if (*c == white)
MONO_PIXEL(FRAMEBUFFER, x, y) &= ~(1 << (y%8));
else
MONO_PIXEL(FRAMEBUFFER, x, y) |= (1 << (y%8));
}
static void _mono_get_pixel(rtgui_color_t *c, int x, int y)
{
if (MONO_PIXEL(FRAMEBUFFER, x, y) & (1 << (y%8)))
*c = black;
else
*c = white;
}
static void _mono_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_ubase_t index;
if (*c == white)
for (index = x1; index < x2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
}
else
for (index = x1; index < x2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
}
}
static void _mono_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
{
rt_ubase_t index;
if (*c == white)
for (index = y1; index < y2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, x, index) &= ~(1 << (index%8));
}
else
for (index = y1; index < y2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, x, index) |= (1 << (index%8));
}
}
/* draw raw hline */
static void _mono_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
rt_ubase_t index;
for (index = x1; index < x2; index ++)
{
if (pixels[index/8] && (1 << (index % 8)))
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
else
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
}
}
const struct rtgui_graphic_driver_ops _framebuffer_mono_ops =
{
_mono_set_pixel,
_mono_get_pixel,
_mono_draw_hline,
_mono_draw_vline,
_mono_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops *rtgui_framebuffer_get_ops(int pixel_format)
{
switch (pixel_format)
{
case RTGRAPHIC_PIXEL_FORMAT_MONO:
return &_framebuffer_mono_ops;
case RTGRAPHIC_PIXEL_FORMAT_GRAY4:
break;
case RTGRAPHIC_PIXEL_FORMAT_GRAY16:
break;
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
return &_framebuffer_rgb565_ops;
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
return &_framebuffer_rgb565p_ops;
}
return RT_NULL;
}
#include <rtgui/rtgui_system.h>
#include <rtgui/driver.h>
#define GET_PIXEL(dst, x, y, type) \
(type *)((rt_uint8_t*)((dst)->framebuffer) + (y) * (dst)->pitch + (x) * ((dst)->bits_per_pixel/8))
static void _rgb565_set_pixel(rtgui_color_t *c, int x, int y)
{
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565(*c);
}
static void _rgb565_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
/* get pixel from color */
*c = rtgui_color_from_565(pixel);
}
static void _rgb565_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_ubase_t index;
rt_uint16_t pixel;
rt_uint16_t *pixel_ptr;
/* get pixel from color */
pixel = rtgui_color_to_565(*c);
/* get pixel pointer in framebuffer */
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
for (index = x1; index < x2; index ++)
{
*pixel_ptr = pixel;
pixel_ptr ++;
}
}
static void _rgb565_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
{
rt_uint8_t *dst;
rt_uint16_t pixel;
rt_ubase_t index;
pixel = rtgui_color_to_565(*c);
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
for (index = y1; index < y2; index ++)
{
*(rt_uint16_t*)dst = pixel;
dst += rtgui_graphic_get_device()->pitch;
}
}
static void _rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
{
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565p(*c);
}
static void _rgb565p_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
/* get pixel from color */
*c = rtgui_color_from_565p(pixel);
}
static void _rgb565p_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_ubase_t index;
rt_uint16_t pixel;
rt_uint16_t *pixel_ptr;
/* get pixel from color */
pixel = rtgui_color_to_565p(*c);
/* get pixel pointer in framebuffer */
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
for (index = x1; index < x2; index ++)
{
*pixel_ptr = pixel;
pixel_ptr ++;
}
}
static void _rgb565p_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
{
rt_uint8_t *dst;
rt_uint16_t pixel;
rt_ubase_t index;
pixel = rtgui_color_to_565p(*c);
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
for (index = y1; index < y2; index ++)
{
*(rt_uint16_t*)dst = pixel;
dst += rtgui_graphic_get_device()->pitch;
}
}
/* draw raw hline */
static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
rt_uint8_t *dst;
dst = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint8_t);
rt_memcpy(dst, pixels, (x2 - x1) * (rtgui_graphic_get_device()->bits_per_pixel/8));
}
const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops =
{
_rgb565_set_pixel,
_rgb565_get_pixel,
_rgb565_draw_hline,
_rgb565_draw_vline,
framebuffer_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops _framebuffer_rgb565p_ops =
{
_rgb565p_set_pixel,
_rgb565p_get_pixel,
_rgb565p_draw_hline,
_rgb565p_draw_vline,
framebuffer_draw_raw_hline,
};
#define FRAMEBUFFER (rtgui_graphic_get_device()->framebuffer)
#define MONO_PIXEL(framebuffer, x, y) \
((rt_uint8_t**)(framebuffer))[y/8][x]
static void _mono_set_pixel(rtgui_color_t *c, int x, int y)
{
if (*c == white)
MONO_PIXEL(FRAMEBUFFER, x, y) &= ~(1 << (y%8));
else
MONO_PIXEL(FRAMEBUFFER, x, y) |= (1 << (y%8));
}
static void _mono_get_pixel(rtgui_color_t *c, int x, int y)
{
if (MONO_PIXEL(FRAMEBUFFER, x, y) & (1 << (y%8)))
*c = black;
else
*c = white;
}
static void _mono_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_ubase_t index;
if (*c == white)
for (index = x1; index < x2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
}
else
for (index = x1; index < x2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
}
}
static void _mono_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
{
rt_ubase_t index;
if (*c == white)
for (index = y1; index < y2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, x, index) &= ~(1 << (index%8));
}
else
for (index = y1; index < y2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, x, index) |= (1 << (index%8));
}
}
/* draw raw hline */
static void _mono_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
rt_ubase_t index;
for (index = x1; index < x2; index ++)
{
if (pixels[index/8] && (1 << (index % 8)))
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
else
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
}
}
const struct rtgui_graphic_driver_ops _framebuffer_mono_ops =
{
_mono_set_pixel,
_mono_get_pixel,
_mono_draw_hline,
_mono_draw_vline,
_mono_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops *rtgui_framebuffer_get_ops(int pixel_format)
{
switch (pixel_format)
{
case RTGRAPHIC_PIXEL_FORMAT_MONO:
return &_framebuffer_mono_ops;
case RTGRAPHIC_PIXEL_FORMAT_GRAY4:
break;
case RTGRAPHIC_PIXEL_FORMAT_GRAY16:
break;
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
return &_framebuffer_rgb565_ops;
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
return &_framebuffer_rgb565p_ops;
}
return RT_NULL;
}
......@@ -64,47 +64,47 @@ void rtgui_system_image_init(void)
#endif
}
static struct rtgui_image_engine* rtgui_image_get_engine(const char* type)
static struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn)
{
struct rtgui_list_node *node;
struct rtgui_image_engine *engine;
const char* ext;
ext = fn + rt_strlen(fn);
while (ext != fn)
{
if (*ext == '.') { ext ++; break; }
ext --;
}
if (ext == fn) return RT_NULL; /* no ext */
rtgui_list_foreach(node, &_rtgui_system_image_list)
{
engine = rtgui_list_entry(node, struct rtgui_image_engine, list);
if (strncasecmp(engine->name, type, strlen(engine->name)) ==0)
if (strncasecmp(engine->name, ext, strlen(engine->name)) == 0)
return engine;
}
return RT_NULL;
}
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
static struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn)
static struct rtgui_image_engine* rtgui_image_get_engine(const char* type)
{
struct rtgui_list_node *node;
struct rtgui_image_engine *engine;
const char* ext;
ext = fn + rt_strlen(fn);
while (ext != fn)
{
if (*ext == '.') { ext ++; break; }
ext --;
}
if (ext == fn) return RT_NULL; /* no ext */
rtgui_list_foreach(node, &_rtgui_system_image_list)
{
engine = rtgui_list_entry(node, struct rtgui_image_engine, list);
if (strncasecmp(engine->name, ext, strlen(engine->name)) == 0)
if (strncasecmp(engine->name, type, strlen(engine->name)) ==0)
return engine;
}
return RT_NULL;
}
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load)
{
struct rtgui_filerw* filerw;
......
此差异已折叠。
#include <rtgui/rtgui_system.h>
#include <rtgui/driver.h>
#define gfx_device (rtgui_graphic_get_device()->device)
#define gfx_device_ops rt_graphix_ops(gfx_device)
static void _pixel_rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565p(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
}
static void _pixel_rgb565_set_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
}
static void _pixel_rgb888_set_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint32_t pixel;
pixel = rtgui_color_to_888(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
}
static void _pixel_rgb565p_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
*c = rtgui_color_from_565p(pixel);
}
static void _pixel_rgb565_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
*c = rtgui_color_from_565(pixel);
}
static void _pixel_rgb888_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint32_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
*c = rtgui_color_from_888(pixel);
}
static void _pixel_rgb565p_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565p(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
}
static void _pixel_rgb565_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
}
static void _pixel_rgb888_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint32_t pixel;
pixel = rtgui_color_to_888(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
}
static void _pixel_rgb565p_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565p(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
}
static void _pixel_rgb565_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
}
static void _pixel_rgb888_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
{
rt_uint32_t pixel;
pixel = rtgui_color_to_888(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
}
static void _pixel_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
if (x2 > x1)
gfx_device_ops->blit_line((char*)pixels, x1, y, (x2 - x1));
else
gfx_device_ops->blit_line((char*)pixels, x2, y, (x1 - x2));
}
/* pixel device */
const struct rtgui_graphic_driver_ops _pixel_rgb565p_ops =
{
_pixel_rgb565p_set_pixel,
_pixel_rgb565p_get_pixel,
_pixel_rgb565p_draw_hline,
_pixel_rgb565p_draw_vline,
_pixel_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops _pixel_rgb565_ops =
{
_pixel_rgb565_set_pixel,
_pixel_rgb565_get_pixel,
_pixel_rgb565_draw_hline,
_pixel_rgb565_draw_vline,
_pixel_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops _pixel_rgb888_ops =
{
_pixel_rgb888_set_pixel,
_pixel_rgb888_get_pixel,
_pixel_rgb888_draw_hline,
_pixel_rgb888_draw_vline,
_pixel_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops *rtgui_pixel_device_get_ops(int pixel_format)
{
switch (pixel_format)
{
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
return &_pixel_rgb565_ops;
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
return &_pixel_rgb565p_ops;
case RTGRAPHIC_PIXEL_FORMAT_RGB888:
return &_pixel_rgb888_ops;
}
return RT_NULL;
}
#include <rtgui/rtgui_system.h>
#include <rtgui/driver.h>
#define gfx_device (rtgui_graphic_get_device()->device)
#define gfx_device_ops rt_graphix_ops(gfx_device)
static void _pixel_rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565p(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
}
static void _pixel_rgb565_set_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
}
static void _pixel_rgb888_set_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint32_t pixel;
pixel = rtgui_color_to_888(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
}
static void _pixel_rgb565p_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
*c = rtgui_color_from_565p(pixel);
}
static void _pixel_rgb565_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint16_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
*c = rtgui_color_from_565(pixel);
}
static void _pixel_rgb888_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint32_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
*c = rtgui_color_from_888(pixel);
}
static void _pixel_rgb565p_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565p(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
}
static void _pixel_rgb565_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
}
static void _pixel_rgb888_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
{
rt_uint32_t pixel;
pixel = rtgui_color_to_888(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
}
static void _pixel_rgb565p_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565p(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
}
static void _pixel_rgb565_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
{
rt_uint16_t pixel;
pixel = rtgui_color_to_565(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
}
static void _pixel_rgb888_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
{
rt_uint32_t pixel;
pixel = rtgui_color_to_888(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
}
static void _pixel_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
{
if (x2 > x1)
gfx_device_ops->blit_line((char*)pixels, x1, y, (x2 - x1));
else
gfx_device_ops->blit_line((char*)pixels, x2, y, (x1 - x2));
}
/* pixel device */
const struct rtgui_graphic_driver_ops _pixel_rgb565p_ops =
{
_pixel_rgb565p_set_pixel,
_pixel_rgb565p_get_pixel,
_pixel_rgb565p_draw_hline,
_pixel_rgb565p_draw_vline,
_pixel_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops _pixel_rgb565_ops =
{
_pixel_rgb565_set_pixel,
_pixel_rgb565_get_pixel,
_pixel_rgb565_draw_hline,
_pixel_rgb565_draw_vline,
_pixel_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops _pixel_rgb888_ops =
{
_pixel_rgb888_set_pixel,
_pixel_rgb888_get_pixel,
_pixel_rgb888_draw_hline,
_pixel_rgb888_draw_vline,
_pixel_draw_raw_hline,
};
const struct rtgui_graphic_driver_ops *rtgui_pixel_device_get_ops(int pixel_format)
{
switch (pixel_format)
{
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
return &_pixel_rgb565_ops;
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
return &_pixel_rgb565p_ops;
case RTGRAPHIC_PIXEL_FORMAT_RGB888:
return &_pixel_rgb888_ops;
}
return RT_NULL;
}
......@@ -17,9 +17,10 @@
static void _rtgui_object_constructor(rtgui_object_t *object)
{
if (!object) return;
if (!object)
return;
object->is_static = RT_FALSE;
object->flag = RTGUI_OBJECT_FLAG_NONE;
}
/* Destroys the object */
......@@ -28,7 +29,7 @@ static void _rtgui_object_destructor(rtgui_object_t *object)
/* nothing */
}
DEFINE_CLASS_TYPE(type, "object",
DEFINE_CLASS_TYPE(type, "object",
RT_NULL,
_rtgui_object_constructor,
_rtgui_object_destructor,
......@@ -44,9 +45,9 @@ void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *objec
}
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object)
{
const rtgui_type_t *t;
{
const rtgui_type_t *t;
t = type;
while (t)
{
......@@ -56,9 +57,9 @@ void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *objec
}
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent)
{
const rtgui_type_t *t;
{
const rtgui_type_t *t;
t = type;
while (t)
{
......@@ -115,7 +116,6 @@ rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
#endif
new_object->type = object_type;
new_object->is_static = RT_FALSE;
rtgui_type_object_construct(object_type, new_object);
......@@ -131,7 +131,8 @@ rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
*/
void rtgui_object_destroy(rtgui_object_t *object)
{
if (!object || object->is_static == RT_TRUE) return;
if (!object || object->flag & RTGUI_OBJECT_FLAG_STATIC)
return;
#ifdef RTGUI_OBJECT_TRACE
obj_info.objs_number --;
......@@ -178,3 +179,15 @@ const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object)
return object->type;
}
void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_handler_ptr handler)
{
RT_ASSERT(object != RT_NULL);
object->event_handler = handler;
}
rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event* event)
{
return RT_FALSE;
}
#include <rtgui/rtgui_xml.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_system.h>
/* Internal states that the parser can be in at any given time. */
enum {
......
1, 对同一 window 销毁两次会引起 segfault。同时,如果在创建时设置了
RTGUI_WIN_STYLE_DESTROY_ON_CLOSE,close 窗口之后不要再去销毁窗口。
2, 所有的 window 由 topwin 进行管理,用户不要在指定创建具有父窗口的子窗口之后在
把这个窗口加为父窗口的 child。这可能会导致子窗口无法显示。
3, command 事件添加了 wid 参数,用于指定此事件需要传递的目标窗口。
4, 在 widget 中添加了 on_show 和 on_hide 事件回调函数。他们会在控件显示/隐藏的
时候被调用。
5, slider 控件改为左键减小数值,右键增加数值。横向的 slider 处理左右键,纵向的
slider 处理上下键,上面的值小,下面的值大。
6, view 不再提供 show 方法。如果想单独显示控件,请用 window 包含之。
RTGUI for 1.1 路线图(排名不分先后)
1, 把 rtgui_thread 给去掉,变成 rtgui_application ,消除原来的 rtgui_thread +
mq 的模式。rtgui_application 记录当前依附的 panel,和 panel 的 extent。(Done)
1.1, rtgui_application_run 运行主事件循环(Done)
1.2, rtgui_application 作为事件的接收者_和_事件派发者。(Done)
2, workbench,window并成一个,其事件主循环并合并到rtgui_application中。
2.1, window 作为有标题栏的 workbench(Done)
2.2, 将其事件主循环移至 application 中。(Done)
2.3, 将 window 的父类 toplevel 合并进 window 中。所有直接与服务器打交道的从
window 继承。(或者将 toplevel 合并进 application 中,因为只有 application 才
会和服务器打交道。)
2.4 在创建 window 的时候需要指定 parent,如果为 RT_NULL,则此 window 为 root
窗口,parent 为当前 rtgui_application。每一个 application 必须有且只有一个根
窗口。(Done)
2.5 添加一个 FULL_PANEL 的 STYLE。指定此 STYLE 之后会自动填满整个 panel。其
与 NO_TITLE 之类的合用可以达到之前 workbench 的效果。(Deprecated)
2.6 event_loop 可以设定顶层控件,只会把事件传递给顶层控件。这样可以方便的实
现模态窗口。event_loop 靠 object 的一个标志位来判断是否要退出当前循环。(Done)
3, 将 view 合并进 container,所有容器类继承 container。[note1](Done)
4, 事件循环完成后不主动销毁控件,销毁任务交由用户完成。但是有些自动销毁是必要的
,比如 container 自动销毁其包含的控件(Done)
4.1 对于 window 的 onclose事件,保证在其回调函数中可以(但不是必须)安全销毁窗
口。这个功能不保证能够实现。(onclose 是在将要关闭窗口的时候触发的,调用它之
后 RTGUI 还要进行其他的设置和清理工作,所以不能在 onclose 里销毁窗口)(Cannot
Implement)
4.2 对 window 添加 RTGUI_WIN_STYLE_DESTROY_ON_CLOSE 。使得其在被关闭时自动销
毁。注意:对同一 window 销毁两次会引起 segfault。同时,如果在创建时设置了
RTGUI_WIN_STYLE_DESTROY_ON_CLOSE,close 窗口之后不要再去销毁窗口。
5, API 清理。更详细的文档。
6, 使 panel 退化为无窗口标题的 window,这样 server 就只记录 window 一种东西的位
置。(Done, 删除了 panel,使得整体以 window 为主)
7, 指定名称的时候不再自己拷贝一份。(我觉得 90% 的情况下名称都是静态的字符串,这
时用 strdup其实并没有必要。)(Deprecated)
8, 添加一些工业控制当中用到的波形、仪表之类的控件。
9, 在 window 中记录焦点控件,键盘事件由 window 直接投送。各个控件不记录焦点控件
。(Done)
10, 在 widget 中添加 on_show 和 on_hide 事件回调函数。(Done)
11, 添加 EVENT_WIN_MODAL_ENTER 和 EVENT_WIN_MODAL_EXIT 事件,用来通知窗口管理器
(topwin)一个窗口进入模态。窗口管理器根据这个进行相应的设置。
12, rtgui_filelist_view 不必继承自 container。
13, 添加 desktop window 支持。(Done)
概念与名词:
13.1 desktop window:最底层的桌面窗口。它会在所有窗口下面显示,并且不会被它
上面的窗口模态掉。它的子窗口是 root window。(继承关系由 RTGUI 管理,不
用用户管理)它只有在启用 RTGUI_USING_DESKTOP_WINDOW 时才有此特性。
13.2 root window:创建时父窗口为 RT_NULL 的窗口。是用户空间窗口继承树的根。
13.3 normal window:创建时父窗口不为 RT_NULL 的窗口。它始终会在父窗口之上显
示(它会 clip 父窗口)。normal windows 和 root window 组成一个窗口树。
13.4 模态:当一个 normal window 模态显示时会会模态自己所在树的同级窗口
和所有父级窗口,但不会影响别的窗口树。被模态的窗口不会接受到用户事
件(按键,触摸等)
----
[note1] 我们至少需要一种容器控件来盛放其他的控件,并且能把上层事件传递给被包含
的控件。实现这样的功能有一个就好,container 可以担当这个责任。其他需要放多个控
件的控件则可以继承/包含这个控件。然后多个容器控件轮换的,notebook 可以来做。
notebook可以是有标签和无标签的,有标签的对应一般的 tab 控件,无标签的对应 rtgui
for RTT 1.0 的 workbench+view。
#ifndef __RTGUI_BLIT_H__
#define __RTGUI_BLIT_H__
#include <rtgui/rtgui.h>
typedef void (*rtgui_blit_line_func)(rt_uint8_t* dst, rt_uint8_t* src, int line);
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
#endif
#ifndef __RTGUI_BLIT_H__
#define __RTGUI_BLIT_H__
#include <rtgui/rtgui.h>
typedef void (*rtgui_blit_line_func)(rt_uint8_t* dst, rt_uint8_t* src, int line);
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
#endif
/*
* File : color.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_COLOR_H__
#define __RTGUI_COLOR_H__
#include <rtgui/rtgui.h>
#define RTGUI_ARGB(a, r, g, b) \
((rtgui_color_t)(((rt_uint8_t)(r)|\
(((unsigned)(rt_uint8_t)(g))<<8))|\
(((unsigned long)(rt_uint8_t)(b))<<16)|\
(((unsigned long)(rt_uint8_t)(a))<<24)))
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
#define RTGUI_RGB_R(c) ((c) & 0xff)
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
extern const rtgui_color_t default_foreground;
extern const rtgui_color_t default_background;
extern const rtgui_color_t red;
extern const rtgui_color_t green;
extern const rtgui_color_t blue;
extern const rtgui_color_t black;
extern const rtgui_color_t white;
extern const rtgui_color_t high_light;
extern const rtgui_color_t dark_grey;
extern const rtgui_color_t light_grey;
/*
* RTGUI default color format
* BBBB BBBB GGGG GGGG RRRR RRRR
*/
/* convert rtgui color to BBBBBGGGGGGRRRRR */
rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c)>> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565(rt_uint16_t pixel)
{
rt_uint16_t r, g, b;
rtgui_color_t color;
r = pixel & 0x1f;
g = (pixel >> 5) & 0x3f;
b = (pixel >> 11) & 0x1f;
color = r * 8225 / 1024 + ((g * 4047 / 1024) << 8) + ((b * 8225 / 1024) << 16);
return color;
}
/* convert rtgui color to RRRRRGGGGGGBBBBB */
rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565p(rt_uint16_t pixel)
{
rt_uint8_t r, g, b;
rtgui_color_t color;
r = (pixel >> 11) & 0x1f;
g = (pixel >> 5) & 0x3f;
b = pixel & 0x1f;
color = r * 8225 / 1024 + ((g * 4047 / 1024) << 8) + ((b * 8225 / 1024) << 16);
return color;
}
/* convert rtgui color to RGB */
rt_inline rt_uint32_t rtgui_color_to_888(rtgui_color_t c)
{
rt_uint32_t pixel;
pixel = RTGUI_RGB_R(c) << 16 | RTGUI_RGB_G(c) << 8 | RTGUI_RGB_B(c);
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_888(rt_uint32_t pixel)
{
rtgui_color_t color;
color = RTGUI_RGB(((pixel >> 16) & 0xff), ((pixel >> 8) & 0xff), pixel & 0xff);
return color;
}
#endif
/*
* File : color.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_COLOR_H__
#define __RTGUI_COLOR_H__
#include <rtgui/rtgui.h>
#define RTGUI_ARGB(a, r, g, b) \
((rtgui_color_t)(((rt_uint8_t)(r)|\
(((unsigned)(rt_uint8_t)(g))<<8))|\
(((unsigned long)(rt_uint8_t)(b))<<16)|\
(((unsigned long)(rt_uint8_t)(a))<<24)))
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
#define RTGUI_RGB_R(c) ((c) & 0xff)
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
extern const rtgui_color_t default_foreground;
extern const rtgui_color_t default_background;
extern const rtgui_color_t red;
extern const rtgui_color_t green;
extern const rtgui_color_t blue;
extern const rtgui_color_t black;
extern const rtgui_color_t white;
extern const rtgui_color_t high_light;
extern const rtgui_color_t dark_grey;
extern const rtgui_color_t light_grey;
/*
* RTGUI default color format
* BBBB BBBB GGGG GGGG RRRR RRRR
*/
/* convert rtgui color to BBBBBGGGGGGRRRRR */
rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c)>> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565(rt_uint16_t pixel)
{
rt_uint16_t r, g, b;
rtgui_color_t color;
r = pixel & 0x1f;
g = (pixel >> 5) & 0x3f;
b = (pixel >> 11) & 0x1f;
color = r * 8225 / 1024 + ((g * 4047 / 1024) << 8) + ((b * 8225 / 1024) << 16);
return color;
}
/* convert rtgui color to RRRRRGGGGGGBBBBB */
rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565p(rt_uint16_t pixel)
{
rt_uint8_t r, g, b;
rtgui_color_t color;
r = (pixel >> 11) & 0x1f;
g = (pixel >> 5) & 0x3f;
b = pixel & 0x1f;
color = r * 8225 / 1024 + ((g * 4047 / 1024) << 8) + ((b * 8225 / 1024) << 16);
return color;
}
/* convert rtgui color to RGB */
rt_inline rt_uint32_t rtgui_color_to_888(rtgui_color_t c)
{
rt_uint32_t pixel;
pixel = RTGUI_RGB_R(c) << 16 | RTGUI_RGB_G(c) << 8 | RTGUI_RGB_B(c);
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_888(rt_uint32_t pixel)
{
rtgui_color_t color;
color = RTGUI_RGB(((pixel >> 16) & 0xff), ((pixel >> 8) & 0xff), pixel & 0xff);
return color;
}
#endif
此差异已折叠。
/*
* File : dc_buffer.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
* 2010-06-14 Bernard embedded hardware dc to each widget
* 2010-08-09 Bernard rename hardware dc to client dc
*/
#ifndef __RTGUI_DC_CLIENT_H__
#define __RTGUI_DC_CLIENT_H__
#include <rtgui/dc.h>
/* create a hardware dc */
struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner);
void rtgui_dc_client_init(rtgui_widget_t* owner);
#endif
/*
* File : dc_buffer.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
* 2010-06-14 Bernard embedded hardware dc to each widget
* 2010-08-09 Bernard rename hardware dc to client dc
*/
#ifndef __RTGUI_DC_CLIENT_H__
#define __RTGUI_DC_CLIENT_H__
#include <rtgui/dc.h>
/* create a hardware dc */
struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner);
void rtgui_dc_client_init(rtgui_widget_t* owner);
#endif
/*
* File : dc_buffer.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
* 2010-06-14 Bernard embedded hardware dc to each widget
*/
#ifndef __RTGUI_DC_HW_H__
#define __RTGUI_DC_HW_H__
#include <rtgui/dc.h>
/* create a hardware dc */
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner);
#endif
/*
* File : dc_buffer.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
* 2010-06-14 Bernard embedded hardware dc to each widget
*/
#ifndef __RTGUI_DC_HW_H__
#define __RTGUI_DC_HW_H__
#include <rtgui/dc.h>
/* create a hardware dc */
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner);
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册