提交 8a8f904e 编写于 作者: wuyangyong's avatar wuyangyong

Merge branch 'master' into aozima

Conflicts:
	bsp/stm32f107/project.uvproj
......@@ -337,7 +337,7 @@
#define LCD_USING_DEVICE_NAME RT_USART1_NAME
#define LCD_DEVICE_NAME "lcd"
/* using RTGUI support */
#define RT_USING_RTGUI
// #define RT_USING_RTGUI
/* name length of RTGUI object */
#define RTGUI_NAME_MAX (16)
......
......@@ -178,7 +178,7 @@
// </section>
// <section name="RT_USING_RTGUI" description="RT-Thread/GUI" default="true" >
#define RT_USING_RTGUI
// #define RT_USING_RTGUI
// <integer name="RTGUI_NAME_MAX" description="the name size of RT-Thread/GUI widget/objects" default="12" />
#define RTGUI_NAME_MAX 12
// <bool name="RTGUI_USING_SMALL_SIZE" description="use small size in RT-Thread/GUI" default="true" />
......
......@@ -186,7 +186,7 @@
// </section>
// <section name="RT_USING_RTGUI" description="RTGUI, a graphic user interface" default="true" >
#define RT_USING_RTGUI
// #define RT_USING_RTGUI
// <integer name="RTGUI_NAME_MAX" description="Maximal size of RTGUI object name length" default="16" />
#define RTGUI_NAME_MAX 16
// <bool name="RTGUI_USING_FONT16" description="Support 16 weight font" default="true" />
......
common/font_cmp_hz*.c
doc/doxygened/
此差异已折叠。
import os
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/rtgui_app.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
common/rtgui_mv_model.c
""")
server_src = Split("""
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/notebook.c
widgets/container.c
widgets/list_view.c
widgets/filelist_view.c
widgets/widget.c
widgets/window.c
widgets/panel.c
widgets/groupbox.c
widgets/edit.c
widgets/mv_view.c
widgets/plot.c
widgets/plot_curve.c
widgets/digtube.c
widgets/digfont.c
""")
if GetDepend('RTGUI_USING_FONT_COMPACT'):
import stract_cjk
common_src.append('common/font_cmp_hz16.c')
common_src.append('common/font_cmp_hz12.c')
RegisterPreBuildingAction(stract_cjk.gen_cmp_font_file)
# The set of source files associated with this SConscript file.
src = common_src + server_src + widgets_src
cwd = GetCurrentDir()
dirs = ['include', 'common', 'server', 'widgets']
path = [os.path.join(cwd, i) for i in dirs]
group = DefineGroup('RTGUI', src, depend = ['RT_USING_RTGUI'], CPPPATH = path)
Return('group')
/*
* File : asc12font.c
* 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
*/
#include <rtgui/font.h>
const rt_uint8_t asc12_font[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00,/*"!",1*/
0x00,0x28,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*""",2*/
0x00,0x00,0x28,0x28,0xFC,0x28,0x50,0xFC,0x50,0x50,0x00,0x00,/*"#",3*/
0x00,0x20,0x78,0xA8,0xA0,0x60,0x30,0x28,0xA8,0xF0,0x20,0x00,/*"$",4*/
0x00,0x00,0x48,0xA8,0xB0,0x50,0x28,0x34,0x54,0x48,0x00,0x00,/*"%",5*/
0x00,0x00,0x20,0x50,0x50,0x78,0xA8,0xA8,0x90,0x6C,0x00,0x00,/*"&",6*/
0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"'",7*/
0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x00,/*"(",8*/
0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00,/*")",9*/
0x00,0x00,0x00,0x20,0xA8,0x70,0x70,0xA8,0x20,0x00,0x00,0x00,/*"*",10*/
0x00,0x00,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x00,0x00,0x00,/*"+",11*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,/*",",12*/
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,/*"-",13*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,/*".",14*/
0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00,/*"/",15*/
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00,/*"0",16*/
0x00,0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,/*"1",17*/
0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xF8,0x00,0x00,/*"2",18*/
0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,0x00,0x00,/*"3",19*/
0x00,0x00,0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,0x00,0x00,/*"4",20*/
0x00,0x00,0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,0x00,0x00,/*"5",21*/
0x00,0x00,0x70,0x90,0x80,0xF0,0x88,0x88,0x88,0x70,0x00,0x00,/*"6",22*/
0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,0x00,0x00,/*"7",23*/
0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00,/*"8",24*/
0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x48,0x70,0x00,0x00,/*"9",25*/
0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20,0x00,0x00,/*":",26*/
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x00,/*";",27*/
0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00,/*"<",28*/
0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,/*"=",29*/
0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,/*">",30*/
0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00,/*"?",31*/
0x00,0x00,0x70,0x88,0x98,0xA8,0xA8,0xB8,0x80,0x78,0x00,0x00,/*"@",32*/
0x00,0x00,0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xCC,0x00,0x00,/*"A",33*/
0x00,0x00,0xF0,0x48,0x48,0x70,0x48,0x48,0x48,0xF0,0x00,0x00,/*"B",34*/
0x00,0x00,0x78,0x88,0x80,0x80,0x80,0x80,0x88,0x70,0x00,0x00,/*"C",35*/
0x00,0x00,0xF0,0x48,0x48,0x48,0x48,0x48,0x48,0xF0,0x00,0x00,/*"D",36*/
0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x48,0xF8,0x00,0x00,/*"E",37*/
0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x40,0xE0,0x00,0x00,/*"F",38*/
0x00,0x00,0x38,0x48,0x80,0x80,0x9C,0x88,0x48,0x30,0x00,0x00,/*"G",39*/
0x00,0x00,0xCC,0x48,0x48,0x78,0x48,0x48,0x48,0xCC,0x00,0x00,/*"H",40*/
0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00,/*"I",41*/
0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xE0,0x00,/*"J",42*/
0x00,0x00,0xEC,0x48,0x50,0x60,0x50,0x50,0x48,0xEC,0x00,0x00,/*"K",43*/
0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x44,0xFC,0x00,0x00,/*"L",44*/
0x00,0x00,0xD8,0xD8,0xD8,0xD8,0xA8,0xA8,0xA8,0xA8,0x00,0x00,/*"M",45*/
0x00,0x00,0xDC,0x48,0x68,0x68,0x58,0x58,0x48,0xE8,0x00,0x00,/*"N",46*/
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00,/*"O",47*/
0x00,0x00,0xF0,0x48,0x48,0x70,0x40,0x40,0x40,0xE0,0x00,0x00,/*"P",48*/
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0xE8,0x98,0x70,0x18,0x00,/*"Q",49*/
0x00,0x00,0xF0,0x48,0x48,0x70,0x50,0x48,0x48,0xEC,0x00,0x00,/*"R",50*/
0x00,0x00,0x78,0x88,0x80,0x60,0x10,0x08,0x88,0xF0,0x00,0x00,/*"S",51*/
0x00,0x00,0xF8,0xA8,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,/*"T",52*/
0x00,0x00,0xCC,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00,0x00,/*"U",53*/
0x00,0x00,0xCC,0x48,0x48,0x50,0x50,0x30,0x20,0x20,0x00,0x00,/*"V",54*/
0x00,0x00,0xA8,0xA8,0xA8,0x70,0x50,0x50,0x50,0x50,0x00,0x00,/*"W",55*/
0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x50,0x50,0xD8,0x00,0x00,/*"X",56*/
0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x20,0x20,0x70,0x00,0x00,/*"Y",57*/
0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x40,0x48,0xF8,0x00,0x00,/*"Z",58*/
0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00,/*"[",59*/
0x00,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x00,0x00,/*"\",60*/
0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00,/*"]",61*/
0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"^",62*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,/*"_",63*/
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"`",64*/
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x38,0x48,0x3C,0x00,0x00,/*"a",65*/
0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00,/*"b",66*/
0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x40,0x40,0x38,0x00,0x00,/*"c",67*/
0x00,0x00,0x18,0x08,0x08,0x38,0x48,0x48,0x48,0x3C,0x00,0x00,/*"d",68*/
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00,/*"e",69*/
0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x78,0x00,0x00,/*"f",70*/
0x00,0x00,0x00,0x00,0x00,0x3C,0x48,0x30,0x40,0x78,0x44,0x38,/*"g",71*/
0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0xEC,0x00,0x00,/*"h",72*/
0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00,/*"i",73*/
0x00,0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0,/*"j",74*/
0x00,0x00,0xC0,0x40,0x40,0x5C,0x50,0x70,0x48,0xEC,0x00,0x00,/*"k",75*/
0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00,/*"l",76*/
0x00,0x00,0x00,0x00,0x00,0xF0,0xA8,0xA8,0xA8,0xA8,0x00,0x00,/*"m",77*/
0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0xEC,0x00,0x00,/*"n",78*/
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00,/*"o",79*/
0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0x70,0x40,0xE0,/*"p",80*/
0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x1C,/*"q",81*/
0x00,0x00,0x00,0x00,0x00,0xD8,0x60,0x40,0x40,0xE0,0x00,0x00,/*"r",82*/
0x00,0x00,0x00,0x00,0x00,0x78,0x40,0x30,0x08,0x78,0x00,0x00,/*"s",83*/
0x00,0x00,0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,/*"t",84*/
0x00,0x00,0x00,0x00,0x00,0xD8,0x48,0x48,0x48,0x3C,0x00,0x00,/*"u",85*/
0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x00,0x00,/*"v",86*/
0x00,0x00,0x00,0x00,0x00,0xA8,0xA8,0x70,0x50,0x50,0x00,0x00,/*"w",87*/
0x00,0x00,0x00,0x00,0x00,0xD8,0x50,0x20,0x50,0xD8,0x00,0x00,/*"x",88*/
0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x20,0xC0,/*"y",89*/
0x00,0x00,0x00,0x00,0x00,0x78,0x10,0x20,0x20,0x78,0x00,0x00,/*"z",90*/
0x00,0x18,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x18,0x00,/*"{",91*/
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,/*"|",92*/
0x00,0x60,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x60,0x00,/*"}",93*/
0x40,0xA4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"~",94*/
};
const struct rtgui_font_bitmap asc12 =
{
asc12_font, /* bmp */
RT_NULL, /* each character width, NULL for fixed font */
RT_NULL, /* offset for each character */
6, /* width */
12, /* height */
32, /* first char */
127 /* last char */
};
struct rtgui_font rtgui_font_asc12 =
{
"asc", /* family */
12, /* height */
1, /* refer count */
&bmp_font_engine, /* font engine */
(struct rtgui_font_bitmap *) &asc12, /* font private data */
};
/*
* File : asc16font.c
* 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
*/
#include <rtgui/font.h>
#ifdef RTGUI_USING_FONT16
const unsigned char asc16_font[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00,/*"!",1*/
0x00,0x12,0x36,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*""",2*/
0x00,0x00,0x00,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x00,0x00,/*"#",3*/
0x00,0x00,0x10,0x38,0x54,0x54,0x50,0x30,0x18,0x14,0x14,0x54,0x54,0x38,0x10,0x10,/*"$",4*/
0x00,0x00,0x00,0x44,0xA4,0xA8,0xA8,0xA8,0x54,0x1A,0x2A,0x2A,0x2A,0x44,0x00,0x00,/*"%",5*/
0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x50,0x6E,0xA4,0x94,0x88,0x89,0x76,0x00,0x00,/*"&",6*/
0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"'",7*/
0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,/*"(",8*/
0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,/*")",9*/
0x00,0x00,0x00,0x00,0x10,0x10,0xD6,0x38,0x38,0xD6,0x10,0x10,0x00,0x00,0x00,0x00,/*"*",10*/
0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x00,0x00,0x00,/*"+",11*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0xC0,/*",",12*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"-",13*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,/*".",14*/
0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,/*"/",15*/
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,/*"0",16*/
0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"1",17*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00,/*"2",18*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00,/*"3",19*/
0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00,/*"4",20*/
0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00,/*"5",21*/
0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00,/*"6",22*/
0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,/*"7",23*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,/*"8",24*/
0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00,/*"9",25*/
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,/*":",26*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20,/*";",27*/
0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,/*"<",28*/
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,/*"=",29*/
0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,/*">",30*/
0x00,0x00,0x00,0x3C,0x42,0x42,0x62,0x02,0x04,0x08,0x08,0x00,0x18,0x18,0x00,0x00,/*"?",31*/
0x00,0x00,0x00,0x38,0x44,0x5A,0xAA,0xAA,0xAA,0xAA,0xB4,0x42,0x44,0x38,0x00,0x00,/*"@",32*/
0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00,/*"A",33*/
0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,/*"B",34*/
0x00,0x00,0x00,0x3E,0x42,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x44,0x38,0x00,0x00,/*"C",35*/
0x00,0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,/*"D",36*/
0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x42,0x42,0xFC,0x00,0x00,/*"E",37*/
0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x40,0x40,0xE0,0x00,0x00,/*"F",38*/
0x00,0x00,0x00,0x3C,0x44,0x44,0x80,0x80,0x80,0x8E,0x84,0x44,0x44,0x38,0x00,0x00,/*"G",39*/
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,/*"H",40*/
0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"I",41*/
0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0xF0,/*"J",42*/
0x00,0x00,0x00,0xEE,0x44,0x48,0x50,0x70,0x50,0x48,0x48,0x44,0x44,0xEE,0x00,0x00,/*"K",43*/
0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0xFE,0x00,0x00,/*"L",44*/
0x00,0x00,0x00,0xEE,0x6C,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x54,0x54,0xD6,0x00,0x00,/*"M",45*/
0x00,0x00,0x00,0xC7,0x62,0x62,0x52,0x52,0x4A,0x4A,0x4A,0x46,0x46,0xE2,0x00,0x00,/*"N",46*/
0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00,/*"O",47*/
0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,/*"P",48*/
0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0xB2,0xCA,0x4C,0x38,0x06,0x00,/*"Q",49*/
0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x7C,0x48,0x48,0x44,0x44,0x42,0xE3,0x00,0x00,/*"R",50*/
0x00,0x00,0x00,0x3E,0x42,0x42,0x40,0x20,0x18,0x04,0x02,0x42,0x42,0x7C,0x00,0x00,/*"S",51*/
0x00,0x00,0x00,0xFE,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,/*"T",52*/
0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,/*"U",53*/
0x00,0x00,0x00,0xE7,0x42,0x42,0x44,0x24,0x24,0x28,0x28,0x18,0x10,0x10,0x00,0x00,/*"V",54*/
0x00,0x00,0x00,0xD6,0x92,0x92,0x92,0x92,0xAA,0xAA,0x6C,0x44,0x44,0x44,0x00,0x00,/*"W",55*/
0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,/*"X",56*/
0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,/*"Y",57*/
0x00,0x00,0x00,0x7E,0x84,0x04,0x08,0x08,0x10,0x20,0x20,0x42,0x42,0xFC,0x00,0x00,/*"Z",58*/
0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,/*"[",59*/
0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02,/*"\",60*/
0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,/*"]",61*/
0x00,0x1C,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"^",62*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,/*"_",63*/
0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"`",64*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x1E,0x22,0x42,0x42,0x3F,0x00,0x00,/*"a",65*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x64,0x58,0x00,0x00,/*"b",66*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,/*"c",67*/
0x00,0x00,0x00,0x06,0x02,0x02,0x02,0x1E,0x22,0x42,0x42,0x42,0x26,0x1B,0x00,0x00,/*"d",68*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00,/*"e",69*/
0x00,0x00,0x00,0x0F,0x11,0x10,0x10,0x7E,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"f",70*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C,/*"g",71*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,/*"h",72*/
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"i",73*/
0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x78,/*"j",74*/
0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x4E,0x48,0x50,0x68,0x48,0x44,0xEE,0x00,0x00,/*"k",75*/
0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"l",76*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00,/*"m",77*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,/*"n",78*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,/*"o",79*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,/*"p",80*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,/*"q",81*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x32,0x20,0x20,0x20,0x20,0xF8,0x00,0x00,/*"r",82*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x40,0x3C,0x02,0x42,0x7C,0x00,0x00,/*"s",83*/
0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0x0C,0x00,0x00,/*"t",84*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x42,0x42,0x42,0x42,0x46,0x3B,0x00,0x00,/*"u",85*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x10,0x10,0x00,0x00,/*"v",86*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0x92,0x92,0xAA,0xAA,0x44,0x44,0x00,0x00,/*"w",87*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x24,0x18,0x18,0x18,0x24,0x76,0x00,0x00,/*"x",88*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x18,0x10,0x10,0xE0,/*"y",89*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x44,0x08,0x10,0x10,0x22,0x7E,0x00,0x00,/*"z",90*/
0x00,0x03,0x04,0x04,0x04,0x04,0x04,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,/*"{",91*/
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,/*"|",92*/
0x00,0x60,0x10,0x10,0x10,0x10,0x10,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x60,0x00,/*"}",93*/
0x30,0x4C,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"~",94*/
};
struct rtgui_font_bitmap asc16 =
{
(const rt_uint8_t *)asc16_font, /* bmp */
RT_NULL, /* each character width, NULL for fixed font */
RT_NULL, /* offset for each character */
8, /* width */
16, /* height */
32, /* first char */
127 /* last char */
};
struct rtgui_font rtgui_font_asc16 =
{
"asc", /* family */
16, /* height */
1, /* refer count */
&bmp_font_engine, /* font engine */
&asc16, /* font private data */
};
#endif
/*
* Change Logs:
* Date Author Notes
* 2012-01-24 onelife add one more blit table which exchanges the
* positions of R and B color components in output
*/
#include <rtgui/rtgui.h>
#include <rtgui/blit.h>
/* 2 bpp to 1 bpp */
static void rtgui_blit_line_2_1(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
return;
}
/* 3 bpp to 1 bpp */
static void rtgui_blit_line_3_1(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
line = line / 3;
while (line)
{
*dst_ptr = (rt_uint8_t)(((*src_ptr & 0x00E00000) >> 16) |
((*(src_ptr + 1) & 0x0000E000) >> 11) |
((*(src_ptr + 2) & 0x000000C0) >> 6));
src_ptr += 3;
dst_ptr ++;
line --;
}
return;
}
/* 4 bpp to 1 bpp */
static void rtgui_blit_line_4_1(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
struct _color
{
rt_uint8_t r, g, b, a;
} *c;
c = (struct _color *)src_ptr;
while (line-- > 0)
{
*dst_ptr = (c->r & 0xe0) | (c->g & 0xc0) >> 3 | (c->b & 0xe0) >> 5 ;
c ++;
dst_ptr ++;
}
}
/* 1 bpp to 2 bpp */
static void rtgui_blit_line_1_2(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
return;
}
/* 3 bpp to 2 bpp */
static void rtgui_blit_line_3_2(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t *dst;
dst = (rt_uint16_t *)dst_ptr;
line = line / 3;
while (line)
{
*dst = (((*(src_ptr + 2) << 8) & 0x0000F800) |
((*(src_ptr + 1) << 3) & 0x000007E0) |
((*src_ptr >> 3) & 0x0000001F));
src_ptr += 3;
dst ++;
line --;
}
return;
}
/* 4 bpp to 2 bpp */
static void rtgui_blit_line_4_2(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
struct _color
{
rt_uint8_t r, g, b, a;
} *c;
rt_uint16_t *ptr;
c = (struct _color *)src_ptr;
ptr = (rt_uint16_t *)dst_ptr;
line = line / 4;
while (line-- > 0)
{
*ptr = ((c->r & 0xf8) << 8) | ((c->g & 0xfc) << 3) | (c->b >> 3);
c ++;
ptr ++;
}
}
static void rtgui_blit_line_1_3(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
return;
}
#define HI 1
#define LO 0
/* Special optimized blit for RGB 5-6-5 --> RGBA 8-8-8-8 */
static const rt_uint32_t RGB565_RGBA8888_LUT[512] =
{
0x000000ff, 0x00000000, 0x000008ff, 0x00200000,
0x000010ff, 0x00400000, 0x000018ff, 0x00610000,
0x000020ff, 0x00810000, 0x000029ff, 0x00a10000,
0x000031ff, 0x00c20000, 0x000039ff, 0x00e20000,
0x000041ff, 0x08000000, 0x00004aff, 0x08200000,
0x000052ff, 0x08400000, 0x00005aff, 0x08610000,
0x000062ff, 0x08810000, 0x00006aff, 0x08a10000,
0x000073ff, 0x08c20000, 0x00007bff, 0x08e20000,
0x000083ff, 0x10000000, 0x00008bff, 0x10200000,
0x000094ff, 0x10400000, 0x00009cff, 0x10610000,
0x0000a4ff, 0x10810000, 0x0000acff, 0x10a10000,
0x0000b4ff, 0x10c20000, 0x0000bdff, 0x10e20000,
0x0000c5ff, 0x18000000, 0x0000cdff, 0x18200000,
0x0000d5ff, 0x18400000, 0x0000deff, 0x18610000,
0x0000e6ff, 0x18810000, 0x0000eeff, 0x18a10000,
0x0000f6ff, 0x18c20000, 0x0000ffff, 0x18e20000,
0x000400ff, 0x20000000, 0x000408ff, 0x20200000,
0x000410ff, 0x20400000, 0x000418ff, 0x20610000,
0x000420ff, 0x20810000, 0x000429ff, 0x20a10000,
0x000431ff, 0x20c20000, 0x000439ff, 0x20e20000,
0x000441ff, 0x29000000, 0x00044aff, 0x29200000,
0x000452ff, 0x29400000, 0x00045aff, 0x29610000,
0x000462ff, 0x29810000, 0x00046aff, 0x29a10000,
0x000473ff, 0x29c20000, 0x00047bff, 0x29e20000,
0x000483ff, 0x31000000, 0x00048bff, 0x31200000,
0x000494ff, 0x31400000, 0x00049cff, 0x31610000,
0x0004a4ff, 0x31810000, 0x0004acff, 0x31a10000,
0x0004b4ff, 0x31c20000, 0x0004bdff, 0x31e20000,
0x0004c5ff, 0x39000000, 0x0004cdff, 0x39200000,
0x0004d5ff, 0x39400000, 0x0004deff, 0x39610000,
0x0004e6ff, 0x39810000, 0x0004eeff, 0x39a10000,
0x0004f6ff, 0x39c20000, 0x0004ffff, 0x39e20000,
0x000800ff, 0x41000000, 0x000808ff, 0x41200000,
0x000810ff, 0x41400000, 0x000818ff, 0x41610000,
0x000820ff, 0x41810000, 0x000829ff, 0x41a10000,
0x000831ff, 0x41c20000, 0x000839ff, 0x41e20000,
0x000841ff, 0x4a000000, 0x00084aff, 0x4a200000,
0x000852ff, 0x4a400000, 0x00085aff, 0x4a610000,
0x000862ff, 0x4a810000, 0x00086aff, 0x4aa10000,
0x000873ff, 0x4ac20000, 0x00087bff, 0x4ae20000,
0x000883ff, 0x52000000, 0x00088bff, 0x52200000,
0x000894ff, 0x52400000, 0x00089cff, 0x52610000,
0x0008a4ff, 0x52810000, 0x0008acff, 0x52a10000,
0x0008b4ff, 0x52c20000, 0x0008bdff, 0x52e20000,
0x0008c5ff, 0x5a000000, 0x0008cdff, 0x5a200000,
0x0008d5ff, 0x5a400000, 0x0008deff, 0x5a610000,
0x0008e6ff, 0x5a810000, 0x0008eeff, 0x5aa10000,
0x0008f6ff, 0x5ac20000, 0x0008ffff, 0x5ae20000,
0x000c00ff, 0x62000000, 0x000c08ff, 0x62200000,
0x000c10ff, 0x62400000, 0x000c18ff, 0x62610000,
0x000c20ff, 0x62810000, 0x000c29ff, 0x62a10000,
0x000c31ff, 0x62c20000, 0x000c39ff, 0x62e20000,
0x000c41ff, 0x6a000000, 0x000c4aff, 0x6a200000,
0x000c52ff, 0x6a400000, 0x000c5aff, 0x6a610000,
0x000c62ff, 0x6a810000, 0x000c6aff, 0x6aa10000,
0x000c73ff, 0x6ac20000, 0x000c7bff, 0x6ae20000,
0x000c83ff, 0x73000000, 0x000c8bff, 0x73200000,
0x000c94ff, 0x73400000, 0x000c9cff, 0x73610000,
0x000ca4ff, 0x73810000, 0x000cacff, 0x73a10000,
0x000cb4ff, 0x73c20000, 0x000cbdff, 0x73e20000,
0x000cc5ff, 0x7b000000, 0x000ccdff, 0x7b200000,
0x000cd5ff, 0x7b400000, 0x000cdeff, 0x7b610000,
0x000ce6ff, 0x7b810000, 0x000ceeff, 0x7ba10000,
0x000cf6ff, 0x7bc20000, 0x000cffff, 0x7be20000,
0x001000ff, 0x83000000, 0x001008ff, 0x83200000,
0x001010ff, 0x83400000, 0x001018ff, 0x83610000,
0x001020ff, 0x83810000, 0x001029ff, 0x83a10000,
0x001031ff, 0x83c20000, 0x001039ff, 0x83e20000,
0x001041ff, 0x8b000000, 0x00104aff, 0x8b200000,
0x001052ff, 0x8b400000, 0x00105aff, 0x8b610000,
0x001062ff, 0x8b810000, 0x00106aff, 0x8ba10000,
0x001073ff, 0x8bc20000, 0x00107bff, 0x8be20000,
0x001083ff, 0x94000000, 0x00108bff, 0x94200000,
0x001094ff, 0x94400000, 0x00109cff, 0x94610000,
0x0010a4ff, 0x94810000, 0x0010acff, 0x94a10000,
0x0010b4ff, 0x94c20000, 0x0010bdff, 0x94e20000,
0x0010c5ff, 0x9c000000, 0x0010cdff, 0x9c200000,
0x0010d5ff, 0x9c400000, 0x0010deff, 0x9c610000,
0x0010e6ff, 0x9c810000, 0x0010eeff, 0x9ca10000,
0x0010f6ff, 0x9cc20000, 0x0010ffff, 0x9ce20000,
0x001400ff, 0xa4000000, 0x001408ff, 0xa4200000,
0x001410ff, 0xa4400000, 0x001418ff, 0xa4610000,
0x001420ff, 0xa4810000, 0x001429ff, 0xa4a10000,
0x001431ff, 0xa4c20000, 0x001439ff, 0xa4e20000,
0x001441ff, 0xac000000, 0x00144aff, 0xac200000,
0x001452ff, 0xac400000, 0x00145aff, 0xac610000,
0x001462ff, 0xac810000, 0x00146aff, 0xaca10000,
0x001473ff, 0xacc20000, 0x00147bff, 0xace20000,
0x001483ff, 0xb4000000, 0x00148bff, 0xb4200000,
0x001494ff, 0xb4400000, 0x00149cff, 0xb4610000,
0x0014a4ff, 0xb4810000, 0x0014acff, 0xb4a10000,
0x0014b4ff, 0xb4c20000, 0x0014bdff, 0xb4e20000,
0x0014c5ff, 0xbd000000, 0x0014cdff, 0xbd200000,
0x0014d5ff, 0xbd400000, 0x0014deff, 0xbd610000,
0x0014e6ff, 0xbd810000, 0x0014eeff, 0xbda10000,
0x0014f6ff, 0xbdc20000, 0x0014ffff, 0xbde20000,
0x001800ff, 0xc5000000, 0x001808ff, 0xc5200000,
0x001810ff, 0xc5400000, 0x001818ff, 0xc5610000,
0x001820ff, 0xc5810000, 0x001829ff, 0xc5a10000,
0x001831ff, 0xc5c20000, 0x001839ff, 0xc5e20000,
0x001841ff, 0xcd000000, 0x00184aff, 0xcd200000,
0x001852ff, 0xcd400000, 0x00185aff, 0xcd610000,
0x001862ff, 0xcd810000, 0x00186aff, 0xcda10000,
0x001873ff, 0xcdc20000, 0x00187bff, 0xcde20000,
0x001883ff, 0xd5000000, 0x00188bff, 0xd5200000,
0x001894ff, 0xd5400000, 0x00189cff, 0xd5610000,
0x0018a4ff, 0xd5810000, 0x0018acff, 0xd5a10000,
0x0018b4ff, 0xd5c20000, 0x0018bdff, 0xd5e20000,
0x0018c5ff, 0xde000000, 0x0018cdff, 0xde200000,
0x0018d5ff, 0xde400000, 0x0018deff, 0xde610000,
0x0018e6ff, 0xde810000, 0x0018eeff, 0xdea10000,
0x0018f6ff, 0xdec20000, 0x0018ffff, 0xdee20000,
0x001c00ff, 0xe6000000, 0x001c08ff, 0xe6200000,
0x001c10ff, 0xe6400000, 0x001c18ff, 0xe6610000,
0x001c20ff, 0xe6810000, 0x001c29ff, 0xe6a10000,
0x001c31ff, 0xe6c20000, 0x001c39ff, 0xe6e20000,
0x001c41ff, 0xee000000, 0x001c4aff, 0xee200000,
0x001c52ff, 0xee400000, 0x001c5aff, 0xee610000,
0x001c62ff, 0xee810000, 0x001c6aff, 0xeea10000,
0x001c73ff, 0xeec20000, 0x001c7bff, 0xeee20000,
0x001c83ff, 0xf6000000, 0x001c8bff, 0xf6200000,
0x001c94ff, 0xf6400000, 0x001c9cff, 0xf6610000,
0x001ca4ff, 0xf6810000, 0x001cacff, 0xf6a10000,
0x001cb4ff, 0xf6c20000, 0x001cbdff, 0xf6e20000,
0x001cc5ff, 0xff000000, 0x001ccdff, 0xff200000,
0x001cd5ff, 0xff400000, 0x001cdeff, 0xff610000,
0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000,
0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000,
};
static void rtgui_blit_line_2_3(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t *src;
rt_uint32_t *dst;
src = (rt_uint16_t *)src_ptr;
dst = (rt_uint32_t *)dst_ptr;
line = line / 2;
while (line)
{
*dst++ = RGB565_RGBA8888_LUT[src[LO] * 2] + RGB565_RGBA8888_LUT[src[HI] * 2 + 1];
line--;
src ++;
}
}
void rtgui_blit_line_direct(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_memcpy(dst_ptr, src_ptr, line);
}
/* convert 4bpp to 3bpp */
static void rtgui_blit_line_4_3(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
line = line / 4;
while (line)
{
*dst_ptr++ = *src_ptr++;
*dst_ptr++ = *src_ptr++;
*dst_ptr++ = *src_ptr++;
src_ptr ++;
line --;
}
}
static void rtgui_blit_line_1_4(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
}
static void rtgui_blit_line_2_4(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
}
/* convert 3bpp to 4bpp */
static void rtgui_blit_line_3_4(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
line = line / 4;
while (line)
{
*dst_ptr++ = *src_ptr++;
*dst_ptr++ = *src_ptr++;
*dst_ptr++ = *src_ptr++;
*dst_ptr++ = 0;
line --;
}
}
static const rtgui_blit_line_func _blit_table[5][5] =
{
/* 0_0, 1_0, 2_0, 3_0, 4_0 */
{RT_NULL, RT_NULL, RT_NULL, RT_NULL, RT_NULL },
/* 0_1, 1_1, 2_1, 3_1, 4_1 */
{RT_NULL, rtgui_blit_line_direct, rtgui_blit_line_2_1, rtgui_blit_line_3_1, rtgui_blit_line_4_1 },
/* 0_2, 1_2, 2_2, 3_2, 4_2 */
{RT_NULL, rtgui_blit_line_1_2, rtgui_blit_line_direct, rtgui_blit_line_3_2, rtgui_blit_line_4_2 },
/* 0_3, 1_3, 2_3, 3_3, 4_3 */
{RT_NULL, rtgui_blit_line_1_3, rtgui_blit_line_2_3, rtgui_blit_line_direct, rtgui_blit_line_4_3 },
/* 0_4, 1_4, 2_4, 3_4, 4_4 */
{RT_NULL, rtgui_blit_line_1_4, rtgui_blit_line_2_4, rtgui_blit_line_3_4, rtgui_blit_line_direct },
};
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp)
{
RT_ASSERT(dst_bpp > 0 && dst_bpp < 5);
RT_ASSERT(src_bpp > 0 && src_bpp < 5);
return _blit_table[dst_bpp][src_bpp];
}
static void rtgui_blit_line_3_2_inv(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t *dst;
dst = (rt_uint16_t *)dst_ptr;
line = line / 3;
while (line)
{
*dst = (((*src_ptr << 8) & 0x0000F800) |
((*(src_ptr + 1) << 3) & 0x000007E0) |
((*(src_ptr + 2) >> 3) & 0x0000001F));
src_ptr += 3;
dst ++;
line --;
}
return;
}
void rtgui_blit_line_2_2_inv(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t *dst, *src;
dst = (rt_uint16_t *)dst_ptr;
src = (rt_uint16_t *)src_ptr;
line = line / 2;
while (line)
{
*dst = ((*src << 11) & 0xF800) | (*src & 0x07E0) | ((*src >> 11) & 0x001F);
src ++;
dst ++;
line --;
}
}
static const rtgui_blit_line_func _blit_table_inv[5][5] =
{
/* 0_0, 1_0, 2_0, 3_0, 4_0 */
{RT_NULL, RT_NULL, RT_NULL, RT_NULL, RT_NULL },
/* 0_1, 1_1, 2_1, 3_1, 4_1 */
{RT_NULL, rtgui_blit_line_direct, rtgui_blit_line_2_1, rtgui_blit_line_3_1, rtgui_blit_line_4_1 },
/* 0_2, 1_2, 2_2, 3_2, 4_2 */
{RT_NULL, rtgui_blit_line_1_2, rtgui_blit_line_2_2_inv, rtgui_blit_line_3_2_inv, rtgui_blit_line_4_2 },
/* 0_3, 1_3, 2_3, 3_3, 4_3 */
{RT_NULL, rtgui_blit_line_1_3, rtgui_blit_line_2_3, rtgui_blit_line_direct, rtgui_blit_line_4_3 },
/* 0_4, 1_4, 2_4, 3_4, 4_4 */
{RT_NULL, rtgui_blit_line_1_4, rtgui_blit_line_2_4, rtgui_blit_line_3_4, rtgui_blit_line_direct },
};
rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp)
{
RT_ASSERT(dst_bpp > 0 && dst_bpp < 5);
RT_ASSERT(src_bpp > 0 && src_bpp < 5);
return _blit_table_inv[dst_bpp][src_bpp];
}
/*
* File : color.c
* 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
*/
#include <rtgui/color.h>
const rtgui_color_t red = RTGUI_RGB(0xff, 0x00, 0x00);
const rtgui_color_t green = RTGUI_RGB(0x00, 0xff, 0x00);
const rtgui_color_t blue = RTGUI_RGB(0x00, 0x00, 0xff);
const rtgui_color_t black = RTGUI_RGB(0x00, 0x00, 0x00);
const rtgui_color_t white = RTGUI_RGB(0xff, 0xff, 0xff);
const rtgui_color_t high_light = RTGUI_RGB(0xff, 0xff, 0xff);
const rtgui_color_t dark_grey = RTGUI_RGB(0x7f, 0x7f, 0x7f);
const rtgui_color_t light_grey = RTGUI_RGB(0xc0, 0xc0, 0xc0);
#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)
此差异已折叠。
/*
* File : dc_buffer.c
* 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
*/
#include <rtgui/rtgui.h>
#include <rtgui/dc.h>
#include <rtgui/blit.h>
#include <rtgui/dc_hw.h>
#include <rtgui/color.h>
#include <rtgui/rtgui_system.h>
#define hw_driver (rtgui_graphic_driver_get_default())
#define RTGUI_BLENDMODE_NONE 0x00
#define RTGUI_BLENDMODE_BLEND 0x01
#define RTGUI_BLENDMODE_ADD 0x02
#define RTGUI_BLENDMODE_MOD 0x03
struct rtgui_dc_buffer
{
struct rtgui_dc parent;
/* graphic context */
rtgui_gc_t gc;
/* pixel format */
rt_uint8_t pixel_format;
rt_uint8_t blend_mode;
/* width and height */
rt_uint16_t width, height;
rt_uint16_t pitch;
/* blit info */
rtgui_region_t clip;
/* pixel data */
rt_uint8_t *pixel;
};
static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc *dc);
static void rtgui_dc_buffer_draw_point(struct rtgui_dc *dc, int x, int y);
static void rtgui_dc_buffer_draw_color_point(struct rtgui_dc *dc, int x, int y, rtgui_color_t color);
static void rtgui_dc_buffer_draw_vline(struct rtgui_dc *dc, int x, int y1, int y2);
static void rtgui_dc_buffer_draw_hline(struct rtgui_dc *dc, int x1, int x2, int y);
static void rtgui_dc_buffer_fill_rect(struct rtgui_dc *dc, struct rtgui_rect *rect);
static void rtgui_dc_buffer_blit_line(struct rtgui_dc *self, int x1, int x2, int y, rt_uint8_t *line_data);
static void rtgui_dc_buffer_blit(struct rtgui_dc *self, struct rtgui_point *dc_point,
struct rtgui_dc *dest, rtgui_rect_t *rect);
static void rtgui_dc_buffer_set_gc(struct rtgui_dc *dc, rtgui_gc_t *gc);
static rtgui_gc_t *rtgui_dc_buffer_get_gc(struct rtgui_dc *dc);
static rt_bool_t rtgui_dc_buffer_get_visible(struct rtgui_dc *dc);
static void rtgui_dc_buffer_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
const static struct rtgui_dc_engine dc_buffer_engine =
{
rtgui_dc_buffer_draw_point,
rtgui_dc_buffer_draw_color_point,
rtgui_dc_buffer_draw_vline,
rtgui_dc_buffer_draw_hline,
rtgui_dc_buffer_fill_rect,
rtgui_dc_buffer_blit_line,
rtgui_dc_buffer_blit,
rtgui_dc_buffer_set_gc,
rtgui_dc_buffer_get_gc,
rtgui_dc_buffer_get_visible,
rtgui_dc_buffer_get_rect,
rtgui_dc_buffer_fini,
};
struct rtgui_dc *rtgui_dc_buffer_create(int w, int h)
{
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer *)rtgui_malloc(sizeof(struct rtgui_dc_buffer));
dc->parent.type = RTGUI_DC_BUFFER;
dc->parent.engine = &dc_buffer_engine;
dc->gc.foreground = default_foreground;
dc->gc.background = default_background;
dc->gc.font = rtgui_font_default();
dc->gc.textalign = RTGUI_ALIGN_LEFT | RTGUI_ALIGN_TOP;
dc->width = w;
dc->height = h;
dc->pitch = w *sizeof(rtgui_color_t);
rtgui_region_init(&(dc->clip));
dc->pixel = rtgui_malloc(h * dc->pitch);
rt_memset(dc->pixel, 0, h * dc->pitch);
return &(dc->parent);
}
rt_uint8_t *rtgui_dc_buffer_get_pixel(struct rtgui_dc *dc)
{
struct rtgui_dc_buffer *dc_buffer;
dc_buffer = (struct rtgui_dc_buffer *)dc;
return dc_buffer->pixel;
}
static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc *dc)
{
struct rtgui_dc_buffer *buffer = (struct rtgui_dc_buffer *)dc;
if (dc->type != RTGUI_DC_BUFFER) return RT_FALSE;
rtgui_free(buffer->pixel);
buffer->pixel = RT_NULL;
return RT_TRUE;
}
static void rtgui_dc_buffer_draw_point(struct rtgui_dc *self, int x, int y)
{
rtgui_color_t *ptr;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer *)self;
/* does not draw point out of dc */
if ((x > dc->width) || (y > dc->height)) return ;
/* note: there is no parameter check in this function */
ptr = (rtgui_color_t *)(dc->pixel + y * dc->pitch + x * sizeof(rtgui_color_t));
*ptr = dc->gc.foreground;
}
static void rtgui_dc_buffer_draw_color_point(struct rtgui_dc *self, int x, int y, rtgui_color_t color)
{
rtgui_color_t *ptr;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer *)self;
/* note: there is no parameter check in this function */
ptr = (rtgui_color_t *)(dc->pixel + y * dc->pitch + x * sizeof(rtgui_color_t));
*ptr = color;
}
static void rtgui_dc_buffer_draw_vline(struct rtgui_dc *self, int x, int y1, int y2)
{
rtgui_color_t *ptr;
register rt_base_t index;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer *)self;
if (x >= dc->width) return;
if (y1 > dc->height) y1 = dc->height;
if (y2 > dc->height) y2 = dc->height;
ptr = (rtgui_color_t *)(dc->pixel + y1 * dc->pitch + x * sizeof(rtgui_color_t));
for (index = y1; index < y2; index ++)
{
/* draw this point */
*ptr = dc->gc.foreground;
ptr += dc->width;
}
}
static void rtgui_dc_buffer_draw_hline(struct rtgui_dc *self, int x1, int x2, int y)
{
rtgui_color_t *ptr;
register rt_base_t index;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer *)self;
if (y >= dc->height) return;
if (x1 > dc->width) x1 = dc->width;
if (x2 > dc->width) x2 = dc->width;
ptr = (rtgui_color_t *)(dc->pixel + y * dc->pitch + x1 * sizeof(rtgui_color_t));
for (index = x1; index < x2; index ++)
{
/* draw this point */
*ptr++ = dc->gc.foreground;
}
}
static void rtgui_dc_buffer_fill_rect(struct rtgui_dc *self, struct rtgui_rect *rect)
{
rtgui_color_t foreground;
rtgui_rect_t r;
struct rtgui_dc_buffer *dc;
r = *rect;
dc = (struct rtgui_dc_buffer *)self;
if (r.x1 > dc->width) r.x1 = dc->width;
if (r.x2 > dc->width) r.x2 = dc->width;
if (r.y1 > dc->height) r.y1 = dc->height;
if (r.y2 > dc->height) r.y2 = dc->height;
/* save foreground color */
foreground = RTGUI_DC_FC(self);
/* set background color as foreground color */
RTGUI_DC_FC(self) = RTGUI_DC_BC(self);
/* fill first line */
rtgui_dc_buffer_draw_hline(&(dc->parent), r.x1, r.x2, r.y1);
/* memory copy other lines */
if (r.y2 > r.y1)
{
register rt_base_t index;
for (index = r.y1 + 1; index < r.y2; index ++)
{
rt_memcpy(dc->pixel + index * dc->pitch,
dc->pixel + r.y1 * dc->pitch,
(r.x2 - r.x1) * sizeof(rtgui_color_t));
}
}
/* restore foreground color */
RTGUI_DC_FC(self) = foreground;
}
/* blit a dc to a hardware dc */
static void rtgui_dc_buffer_blit(struct rtgui_dc *self, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect)
{
struct rtgui_dc_buffer *dc = (struct rtgui_dc_buffer *)self;
if (dc_point == RT_NULL) dc_point = &rtgui_empty_point;
if (rtgui_dc_get_visible(dest) == RT_FALSE) return;
if ((dest->type == RTGUI_DC_HW) || (dest->type == RTGUI_DC_CLIENT))
{
rt_uint8_t *line_ptr, *pixels;
rt_uint16_t rect_width, rect_height, index, pitch;
rtgui_blit_line_func blit_line;
/* calculate correct width and height */
if (rtgui_rect_width(*rect) > (dc->width - dc_point->x))
rect_width = dc->width - dc_point->x;
else
rect_width = rtgui_rect_width(*rect);
if (rtgui_rect_height(*rect) > (dc->height - dc_point->y))
rect_height = dc->height - dc_point->y;
else
rect_height = rtgui_rect_height(*rect);
/* prepare pixel line */
pixels = dc->pixel + dc_point->y * dc->pitch + dc_point->x * sizeof(rtgui_color_t);
if (hw_driver->bits_per_pixel == sizeof(rtgui_color_t) * 8)
{
/* it's the same byte per pixel, draw it directly */
for (index = rect->y1; index < rect->y1 + rect_height; index++)
{
dest->engine->blit_line(dest, rect->x1, rect->x1 + rect_width, index, pixels);
pixels += dc->width * sizeof(rtgui_color_t);
}
}
else
{
/* get blit line function */
blit_line = rtgui_blit_line_get(hw_driver->bits_per_pixel / 8, 4);
/* calculate pitch */
pitch = rect_width * sizeof(rtgui_color_t);
/* create line buffer */
line_ptr = (rt_uint8_t *) rtgui_malloc(rect_width * hw_driver->bits_per_pixel / 8);
/* draw each line */
for (index = rect->y1; index < rect->y1 + rect_height; index ++)
{
/* blit on line buffer */
blit_line(line_ptr, (rt_uint8_t *)pixels, pitch);
pixels += dc->width * sizeof(rtgui_color_t);
/* draw on hardware dc */
dest->engine->blit_line(dest, rect->x1, rect->x1 + rect_width, index, line_ptr);
}
/* release line buffer */
rtgui_free(line_ptr);
}
}
}
static void rtgui_dc_buffer_blit_line(struct rtgui_dc *self, int x1, int x2, int y, rt_uint8_t *line_data)
{
rtgui_color_t *color_ptr;
struct rtgui_dc_buffer *dc = (struct rtgui_dc_buffer *)self;
RT_ASSERT(dc != RT_NULL);
RT_ASSERT(line_data != RT_NULL);
/* out of range */
if ((x1 > dc->width) || (y > dc->height)) return;
/* check range */
if (x2 > dc->width) x2 = dc->width;
color_ptr = (rtgui_color_t *)(dc->pixel + y * dc->pitch + x1 * sizeof(rtgui_color_t));
rt_memcpy(color_ptr, line_data, (x2 - x1) * sizeof(rtgui_color_t));
}
static void rtgui_dc_buffer_set_gc(struct rtgui_dc *self, rtgui_gc_t *gc)
{
struct rtgui_dc_buffer *dc = (struct rtgui_dc_buffer *)self;
dc->gc = *gc;
}
static rtgui_gc_t *rtgui_dc_buffer_get_gc(struct rtgui_dc *self)
{
struct rtgui_dc_buffer *dc = (struct rtgui_dc_buffer *)self;
return &dc->gc;
}
static rt_bool_t rtgui_dc_buffer_get_visible(struct rtgui_dc *dc)
{
return RT_TRUE;
}
static void rtgui_dc_buffer_get_rect(struct rtgui_dc *self, rtgui_rect_t *rect)
{
struct rtgui_dc_buffer *dc = (struct rtgui_dc_buffer *)self;
rect->x1 = rect->y1 = 0;
rect->x2 = dc->width;
rect->y2 = dc->height;
}
/*
* File : dc_client.c
* 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
* 2010-08-09 Bernard rename hardware dc to client dc
* 2010-09-13 Bernard fix rtgui_dc_client_blit_line issue, which found
* by appele
* 2010-09-14 Bernard fix vline and hline coordinate issue
*/
#include <rtgui/dc.h>
#include <rtgui/dc_hw.h>
#include <rtgui/dc_client.h>
#include <rtgui/driver.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/rtgui_server.h>
#include <rtgui/widgets/container.h>
#include <rtgui/widgets/window.h>
#include <rtgui/widgets/title.h>
static void rtgui_dc_client_draw_point(struct rtgui_dc *dc, int x, int y);
static void rtgui_dc_client_draw_color_point(struct rtgui_dc *dc, int x, int y, rtgui_color_t color);
static void rtgui_dc_client_draw_hline(struct rtgui_dc *dc, int x1, int x2, int y);
static void rtgui_dc_client_draw_vline(struct rtgui_dc *dc, int x, int y1, int y2);
static void rtgui_dc_client_fill_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
static void rtgui_dc_client_blit_line(struct rtgui_dc *self, int x1, int x2, int y, rt_uint8_t *line_data);
static void rtgui_dc_client_blit(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect);
static void rtgui_dc_client_set_gc(struct rtgui_dc *dc, rtgui_gc_t *gc);
static rtgui_gc_t *rtgui_dc_client_get_gc(struct rtgui_dc *dc);
static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc *dc);
static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc *dc);
static void rtgui_dc_client_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
#define hw_driver (rtgui_graphic_driver_get_default())
#define dc_set_foreground(c) dc->gc.foreground = c
#define dc_set_background(c) dc->gc.background = c
#define _int_swap(x, y) do {x ^= y; y ^= x; x ^= y;} while (0)
struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner)
{
struct rtgui_dc *dc;
RT_ASSERT(owner != RT_NULL);
rtgui_screen_lock(RT_WAITING_FOREVER);
if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
rtgui_rect_is_equal(&(owner->extent), &(owner->clip.extents)) == RT_EOK)
dc = rtgui_dc_hw_create(owner);
else
dc = rtgui_dc_client_create(owner);
if (dc == RT_NULL) rtgui_screen_unlock();
return dc;
}
RTM_EXPORT(rtgui_dc_begin_drawing);
void rtgui_dc_end_drawing(struct rtgui_dc *dc)
{
dc->engine->fini(dc);
rtgui_screen_unlock();
}
RTM_EXPORT(rtgui_dc_end_drawing);
const struct rtgui_dc_engine dc_client_engine =
{
rtgui_dc_client_draw_point,
rtgui_dc_client_draw_color_point,
rtgui_dc_client_draw_vline,
rtgui_dc_client_draw_hline,
rtgui_dc_client_fill_rect,
rtgui_dc_client_blit_line,
rtgui_dc_client_blit,
rtgui_dc_client_set_gc,
rtgui_dc_client_get_gc,
rtgui_dc_client_get_visible,
rtgui_dc_client_get_rect,
rtgui_dc_client_fini,
};
void rtgui_dc_client_init(rtgui_widget_t *owner)
{
struct rtgui_dc *dc;
RT_ASSERT(owner != RT_NULL);
dc = RTGUI_WIDGET_DC(owner);
dc->type = RTGUI_DC_CLIENT;
dc->engine = &dc_client_engine;
}
extern struct rt_mutex cursor_mutex;
extern void rtgui_mouse_show_cursor(void);
extern void rtgui_mouse_hide_cursor(void);
struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner)
{
struct rtgui_dc *dc;
rtgui_widget_t *widget;
/* adjudge owner */
if (owner == RT_NULL || owner->toplevel == RT_NULL) return RT_NULL;
if (!RTGUI_IS_WIN(owner->toplevel)) return RT_NULL;
dc = RTGUI_WIDGET_DC(owner);
/* set init visible as true */
RTGUI_WIDGET_DC_SET_VISIBLE(owner);
/* check widget visible */
widget = owner;
while (widget != RT_NULL)
{
if (RTGUI_WIDGET_IS_HIDE(widget))
{
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
return RT_NULL;
}
widget = widget->parent;
}
if (RTGUI_IS_WINTITLE(owner->toplevel))
{
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef RTGUI_USING_MOUSE_CURSOR
#ifdef _WIN32_NATIVE
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
#else
/* hide cursor */
rtgui_mouse_hide_cursor();
#endif
#endif
}
}
else if (RTGUI_IS_APP(owner->toplevel))
{
RT_ASSERT(0);
}
else if (RTGUI_IS_WIN(owner->toplevel))
{
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
#endif
#else
/* send draw begin to server */
struct rtgui_event_update_begin eupdate;
RTGUI_EVENT_UPDATE_BEGIN_INIT(&(eupdate));
eupdate.rect = RTGUI_WIDGET(top)->extent;
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
#endif
}
}
return dc;
}
static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc *dc)
{
rtgui_widget_t *owner;
if (dc == RT_NULL || dc->type != RTGUI_DC_CLIENT) return RT_FALSE;
/* get owner */
owner = RTGUI_CONTAINER_OF(dc, struct rtgui_widget, dc_type);
if (RTGUI_IS_WINTITLE(owner->toplevel))
{
/* update title extent */
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing --;
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
rtgui_mouse_show_cursor();
rt_kprintf("show cursor\n");
#endif
/* update screen */
rtgui_graphic_driver_screen_update(hw_driver, &(owner->extent));
#else
#ifdef RTGUI_USING_MOUSE_CURSOR
/* show cursor */
rtgui_mouse_show_cursor();
#endif
/* update screen */
rtgui_graphic_driver_screen_update(hw_driver, &(owner->extent));
#endif
}
}
else if (RTGUI_IS_APP(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing --;
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
{
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
rtgui_mouse_show_cursor();
rt_kprintf("show cursor\n");
#endif
/* update screen */
rtgui_graphic_driver_screen_update(hw_driver, &(owner->extent));
#else
/* send to server to end drawing */
struct rtgui_event_update_end eupdate;
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
eupdate.rect = owner->extent;
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
#endif
}
}
return RT_TRUE;
}
/*
* draw a logic point on device
*/
static void rtgui_dc_client_draw_point(struct rtgui_dc *self, int x, int y)
{
rtgui_rect_t rect;
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
x = x + owner->extent.x1;
y = y + owner->extent.y1;
if (rtgui_region_contains_point(&(owner->clip), x, y, &rect) == RT_EOK)
{
/* draw this point */
hw_driver->ops->set_pixel(&(owner->gc.foreground), x, y);
}
}
static void rtgui_dc_client_draw_color_point(struct rtgui_dc *self, int x, int y, rtgui_color_t color)
{
rtgui_rect_t rect;
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
x = x + owner->extent.x1;
y = y + owner->extent.y1;
if (rtgui_region_contains_point(&(owner->clip), x, y, &rect) == RT_EOK)
{
/* draw this point */
hw_driver->ops->set_pixel(&color, x, y);
}
}
/*
* draw a logic vertical line on device
*/
static void rtgui_dc_client_draw_vline(struct rtgui_dc *self, int x, int y1, int y2)
{
register rt_base_t index;
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
x = x + owner->extent.x1;
y1 = y1 + owner->extent.y1;
y2 = y2 + owner->extent.y1;
if (y1 > y2) _int_swap(y1, y2);
if (owner->clip.data == RT_NULL)
{
rtgui_rect_t *prect;
prect = &(owner->clip.extents);
/* calculate vline intersect */
if (prect->x1 > x || prect->x2 <= x) return;
if (prect->y2 <= y1 || prect->y1 > y2) return;
if (prect->y1 > y1) y1 = prect->y1;
if (prect->y2 < y2) y2 = prect->y2;
/* draw vline */
hw_driver->ops->draw_vline(&(owner->gc.foreground), x, y1, y2);
}
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
{
rtgui_rect_t *prect;
register rt_base_t draw_y1, draw_y2;
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
draw_y1 = y1;
draw_y2 = y2;
/* calculate vline clip */
if (prect->x1 > x || prect->x2 <= x) continue;
if (prect->y2 <= y1 || prect->y1 > y2) continue;
if (prect->y1 > y1) draw_y1 = prect->y1;
if (prect->y2 < y2) draw_y2 = prect->y2;
/* draw vline */
hw_driver->ops->draw_vline(&(owner->gc.foreground), x, draw_y1, draw_y2);
}
}
/*
* draw a logic horizontal line on device
*/
static void rtgui_dc_client_draw_hline(struct rtgui_dc *self, int x1, int x2, int y)
{
register rt_base_t index;
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
/* convert logic to device */
x1 = x1 + owner->extent.x1;
x2 = x2 + owner->extent.x1;
if (x1 > x2) _int_swap(x1, x2);
y = y + owner->extent.y1;
if (owner->clip.data == RT_NULL)
{
rtgui_rect_t *prect;
prect = &(owner->clip.extents);
/* calculate vline intersect */
if (prect->y1 > y || prect->y2 <= y) return;
if (prect->x2 <= x1 || prect->x1 > x2) return;
if (prect->x1 > x1) x1 = prect->x1;
if (prect->x2 < x2) x2 = prect->x2;
/* draw hline */
hw_driver->ops->draw_hline(&(owner->gc.foreground), x1, x2, y);
}
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
{
rtgui_rect_t *prect;
register rt_base_t draw_x1, draw_x2;
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
draw_x1 = x1;
draw_x2 = x2;
/* calculate hline clip */
if (prect->y1 > y || prect->y2 <= y) continue;
if (prect->x2 <= x1 || prect->x1 > x2) continue;
if (prect->x1 > x1) draw_x1 = prect->x1;
if (prect->x2 < x2) draw_x2 = prect->x2;
/* draw hline */
hw_driver->ops->draw_hline(&(owner->gc.foreground), draw_x1, draw_x2, y);
}
}
static void rtgui_dc_client_fill_rect(struct rtgui_dc *self, struct rtgui_rect *rect)
{
rtgui_color_t foreground;
register rt_base_t index;
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
/* save foreground color */
foreground = owner->gc.foreground;
/* set background color as foreground color */
owner->gc.foreground = owner->gc.background;
/* fill rect */
for (index = rect->y1; index < rect->y2; index ++)
{
rtgui_dc_client_draw_hline(self, rect->x1, rect->x2, index);
}
/* restore foreground color */
owner->gc.foreground = foreground;
}
static void rtgui_dc_client_blit_line(struct rtgui_dc *self, int x1, int x2, int y, rt_uint8_t *line_data)
{
register rt_base_t index;
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
/* convert logic to device */
x1 = x1 + owner->extent.x1;
x2 = x2 + owner->extent.x1;
if (x1 > x2) _int_swap(x1, x2);
y = y + owner->extent.y1;
if (rtgui_region_is_flat(&(owner->clip)) == RT_EOK)
{
rtgui_rect_t *prect;
int offset = 0;
prect = &(owner->clip.extents);
/* calculate vline intersect */
if (prect->y1 > y || prect->y2 <= y) return;
if (prect->x2 <= x1 || prect->x1 > x2) return;
if (prect->x1 > x1) x1 = prect->x1;
if (prect->x2 < x2) x2 = prect->x2;
/* patch note:
* We need to adjust the offset when update widget clip!
* Of course at ordinary times for 0. General */
offset = owner->clip.extents.x1 - owner->extent.x1;
offset = offset * hw_driver->bits_per_pixel / 8;
/* draw hline */
hw_driver->ops->draw_raw_hline(line_data + offset, x1, x2, y);
}
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
{
rtgui_rect_t *prect;
register rt_base_t draw_x1, draw_x2;
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
draw_x1 = x1;
draw_x2 = x2;
/* calculate hline clip */
if (prect->y1 > y || prect->y2 <= y) continue;
if (prect->x2 <= x1 || prect->x1 > x2) continue;
if (prect->x1 > x1) draw_x1 = prect->x1;
if (prect->x2 < x2) draw_x2 = prect->x2;
/* draw hline */
hw_driver->ops->draw_raw_hline(line_data + (draw_x1 - x1) * hw_driver->bits_per_pixel / 8, draw_x1, draw_x2, y);
}
}
static void rtgui_dc_client_blit(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect)
{
/* not blit in hardware dc */
return ;
}
static void rtgui_dc_client_set_gc(struct rtgui_dc *self, rtgui_gc_t *gc)
{
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
owner->gc = *gc;
}
static rtgui_gc_t *rtgui_dc_client_get_gc(struct rtgui_dc *self)
{
rtgui_widget_t *owner;
RT_ASSERT(self != RT_NULL);
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
return &(owner->gc);
}
static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc *self)
{
rtgui_widget_t *owner;
if (self == RT_NULL) return RT_FALSE;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return RT_FALSE;
return RT_TRUE;
}
static void rtgui_dc_client_get_rect(struct rtgui_dc *self, rtgui_rect_t *rect)
{
rtgui_widget_t *owner;
if (self == RT_NULL) return;
/* get owner */
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
rtgui_widget_get_rect(owner, rect);
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/* adapted from utils/perfect_hash/example1-C/states-tmpl.c */
#include <rtthread.h>
#include <string.h>
static const rt_uint32_t T1[] = { $S1 };
static const rt_uint32_t T2[] = { $S2 };
static const rt_uint16_t G[] = { $G };
static rt_uint32_t hash_g(const rt_uint16_t key, const rt_uint32_t *T)
{
rt_uint32_t sum = (T[0] * (key & 0xFF) + T[1] * (key >> 8)) % $NG;
return G[sum % $NG];
}
static rt_uint32_t perfect_hash(const rt_uint16_t key)
{
return (hash_g(key, T1) + hash_g(key, T2)) % $NG;
}
rt_uint32_t rtgui_font_mph${height}(const rt_uint16_t key)
{
rt_uint32_t hash_value = perfect_hash(key);
/*rt_kprintf("hash 0x7684 is %d", perfect_hash(0x7684));*/
/*RT_ASSERT(K[hash_value] == key);*/
/* NOTE: we trust you will not feed invalid data into me. So there is no
* more sanity check which will consume more flash and memory. */
if (hash_value < $NK)
return hash_value;
return -1;
}
const unsigned char hz${height}_font[] = { $font_data };
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
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 包含之。
7, 若窗口在销毁(destroy)时没有关闭,则 RTGUI 会先关闭之。也会调用 on_close 函数
但是此函数的返回值会被忽略。
此差异已折叠。
此差异已折叠。
#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);
rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp);
#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
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册