sync RTGUI with github(https://github.com/RT-Thread/RTGUI) 9ae08379da5b698d6facc40bd0415de2e254ae9c

As always, full log is in GitHub.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2449 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
dzzxzz@gmail.com 2012-11-26 02:42:52 +00:00
parent 9789907ca1
commit 62447b2cd8
131 changed files with 50561 additions and 49024 deletions

View File

@ -32,6 +32,7 @@ common/hz12font.c
common/hz16font.c
common/framebuffer_driver.c
common/pixel_driver.c
common/rtgui_mv_model.c
""")
server_src = Split("""
@ -68,10 +69,17 @@ widgets/window.c
widgets/panel.c
widgets/groupbox.c
widgets/edit.c
widgets/mv_view.c
widgets/plot.c
widgets/plot_curve.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

View File

@ -13,199 +13,200 @@
*/
#include <rtgui/font.h>
const rt_uint8_t asc12_font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81,
0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff,
0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00,
0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c,
0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18,
0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x3c,
0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99,
0xc3, 0xff, 0xff, 0xff, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00,
0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30,
0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67,
0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00,
0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x06, 0x0e, 0x1e, 0x3e,
0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c,
0x18, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00,
0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0xc6, 0x60, 0x38, 0x6c,
0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
0xfe, 0xfe, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00,
0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
0x10, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x50, 0x50, 0x00, 0x00,
0x00, 0x10, 0x38, 0x40, 0x40, 0x38, 0x48, 0x70, 0x10, 0x10, 0x00, 0x00, 0x00, 0x20, 0x50, 0x20,
0x0c, 0x70, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x54, 0x48,
0x34, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, 0x20, 0x20, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x10, 0x7c, 0x10, 0x28, 0x28, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xfc, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x00, 0x00,
0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x20, 0x44,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x18, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x14, 0x14, 0x24, 0x44, 0x7c, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x20,
0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x40, 0x78, 0x44, 0x44, 0x44,
0x38, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x44, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44,
0x44, 0x3c, 0x04, 0x08, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x30, 0x20, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x10, 0x60, 0x80, 0x60, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x18, 0x20,
0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00,
0x38, 0x44, 0x44, 0x4c, 0x54, 0x54, 0x4c, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, 0x30, 0x10, 0x28,
0x28, 0x28, 0x7c, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0xf0, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x44, 0x50,
0x70, 0x50, 0x40, 0x44, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x20, 0x28, 0x38, 0x28, 0x20, 0x20,
0x70, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x4c, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0xec, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x08, 0x08, 0x08, 0x48, 0x48, 0x48,
0x30, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x48, 0x50, 0x70, 0x48, 0x44, 0xe4, 0x00, 0x00, 0x00,
0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x24, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xec, 0x6c, 0x6c,
0x54, 0x54, 0x44, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0xec, 0x64, 0x64, 0x54, 0x54, 0x54, 0x4c,
0xec, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x78, 0x24, 0x24, 0x24, 0x38, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44, 0x38, 0x1c, 0x00, 0x00, 0x00, 0xf8, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44,
0xe0, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4c, 0x40, 0x38, 0x04, 0x04, 0x64, 0x58, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10,
0x10, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44, 0x54, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00,
0x00, 0xc4, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0xc4, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x28,
0x28, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x44, 0x08, 0x10, 0x10, 0x20, 0x44,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00,
0x00, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x10, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x44, 0x3c, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x04, 0x34, 0x4c, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x44, 0x7c, 0x40, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x7c, 0x20, 0x20, 0x20, 0x20,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4c, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x38, 0x00,
0x00, 0xc0, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x70,
0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x70, 0x00, 0x00, 0xc0, 0x40, 0x5c, 0x48, 0x70, 0x50, 0x48, 0xdc, 0x00, 0x00, 0x00,
0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8,
0x54, 0x54, 0x54, 0x54, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x64, 0x44, 0x44, 0x44,
0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xd8, 0x64, 0x44, 0x44, 0x44, 0x78, 0x40, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x34,
0x4c, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x30, 0x20, 0x20, 0x20,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x38, 0x04, 0x44, 0x78, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x7c, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc,
0x44, 0x44, 0x44, 0x4c, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44, 0x28, 0x28,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xcc, 0x48, 0x30, 0x30, 0x48, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec,
0x44, 0x24, 0x28, 0x18, 0x10, 0x10, 0x78, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x48, 0x10, 0x20, 0x44,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x20, 0x10, 0x10, 0x10, 0x08, 0x00,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10,
0x10, 0x10, 0x08, 0x10, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x58, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
const rt_uint8_t asc12_font[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81,
0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff,
0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00,
0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c,
0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18,
0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x3c,
0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99,
0xc3, 0xff, 0xff, 0xff, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00,
0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30,
0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67,
0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00,
0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x06, 0x0e, 0x1e, 0x3e,
0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c,
0x18, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00,
0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0xc6, 0x60, 0x38, 0x6c,
0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe,
0xfe, 0xfe, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00,
0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28,
0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe,
0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10,
0x10, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x50, 0x50, 0x00, 0x00,
0x00, 0x10, 0x38, 0x40, 0x40, 0x38, 0x48, 0x70, 0x10, 0x10, 0x00, 0x00, 0x00, 0x20, 0x50, 0x20,
0x0c, 0x70, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x54, 0x48,
0x34, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x00, 0x20, 0x20, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x20, 0x00, 0x00, 0x10, 0x7c, 0x10, 0x28, 0x28, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0xfc, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x00, 0x00,
0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x08, 0x10, 0x20, 0x44,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x18, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x14, 0x14, 0x24, 0x44, 0x7c, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x20,
0x38, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x40, 0x78, 0x44, 0x44, 0x44,
0x38, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x44, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44,
0x44, 0x3c, 0x04, 0x08, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x30, 0x20, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x10, 0x60, 0x80, 0x60, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x18, 0x20,
0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x10, 0x00, 0x30, 0x00, 0x00, 0x00,
0x38, 0x44, 0x44, 0x4c, 0x54, 0x54, 0x4c, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00, 0x30, 0x10, 0x28,
0x28, 0x28, 0x7c, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0xf0, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x44, 0x50,
0x70, 0x50, 0x40, 0x44, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x20, 0x28, 0x38, 0x28, 0x20, 0x20,
0x70, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x4c, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0xec, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x08, 0x08, 0x08, 0x48, 0x48, 0x48,
0x30, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x48, 0x50, 0x70, 0x48, 0x44, 0xe4, 0x00, 0x00, 0x00,
0x00, 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x24, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xec, 0x6c, 0x6c,
0x54, 0x54, 0x44, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0xec, 0x64, 0x64, 0x54, 0x54, 0x54, 0x4c,
0xec, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x78, 0x24, 0x24, 0x24, 0x38, 0x20, 0x20, 0x70, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44, 0x38, 0x1c, 0x00, 0x00, 0x00, 0xf8, 0x44, 0x44, 0x44, 0x78, 0x48, 0x44,
0xe0, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4c, 0x40, 0x38, 0x04, 0x04, 0x64, 0x58, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x90, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10,
0x10, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44, 0x54, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00,
0x00, 0xc4, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, 0xc4, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x28,
0x28, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x44, 0x08, 0x10, 0x10, 0x20, 0x44,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00,
0x00, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x10, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x44, 0x3c, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44,
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x04, 0x34, 0x4c, 0x44, 0x44, 0x44, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
0x44, 0x7c, 0x40, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x7c, 0x20, 0x20, 0x20, 0x20,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4c, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x38, 0x00,
0x00, 0xc0, 0x40, 0x58, 0x64, 0x44, 0x44, 0x44, 0xec, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x70,
0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x70, 0x00, 0x00, 0xc0, 0x40, 0x5c, 0x48, 0x70, 0x50, 0x48, 0xdc, 0x00, 0x00, 0x00,
0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8,
0x54, 0x54, 0x54, 0x54, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x64, 0x44, 0x44, 0x44,
0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xd8, 0x64, 0x44, 0x44, 0x44, 0x78, 0x40, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x34,
0x4c, 0x44, 0x44, 0x44, 0x3c, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x30, 0x20, 0x20, 0x20,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x38, 0x04, 0x44, 0x78, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x7c, 0x20, 0x20, 0x20, 0x20, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc,
0x44, 0x44, 0x44, 0x4c, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x44, 0x28, 0x28,
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x44, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xcc, 0x48, 0x30, 0x30, 0x48, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec,
0x44, 0x24, 0x28, 0x18, 0x10, 0x10, 0x78, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x48, 0x10, 0x20, 0x44,
0x7c, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x20, 0x10, 0x10, 0x10, 0x08, 0x00,
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10,
0x10, 0x10, 0x08, 0x10, 0x10, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x58, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const struct rtgui_font_bitmap asc12 =
@ -225,5 +226,5 @@ struct rtgui_font rtgui_font_asc12 =
12, /* height */
1, /* refer count */
&bmp_font_engine, /* font engine */
(struct rtgui_font_bitmap *)&asc12, /* font private data */
(struct rtgui_font_bitmap *) &asc12, /* font private data */
};

View File

@ -14,268 +14,269 @@
#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,
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00,
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
const unsigned char asc16_font[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00,
0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00,
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
struct rtgui_font_bitmap asc16 =
{
(const rt_uint8_t*)asc16_font, /* bmp */
(const rt_uint8_t *)asc16_font, /* bmp */
RT_NULL, /* each character width, NULL for fixed font */
RT_NULL, /* offset for each character */
8, /* width */

View File

@ -8,20 +8,20 @@
#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)
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)
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));
*dst_ptr = (rt_uint8_t)(((*src_ptr & 0x00E00000) >> 16) |
((*(src_ptr + 1) & 0x0000E000) >> 11) |
((*(src_ptr + 2) & 0x000000C0) >> 6));
src_ptr += 3;
dst_ptr ++;
@ -31,11 +31,14 @@ static void rtgui_blit_line_3_1(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int li
}
/* 4 bpp to 1 bpp */
static void rtgui_blit_line_4_1(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
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;
struct _color
{
rt_uint8_t r, g, b, a;
} *c;
c = (struct _color*)src_ptr;
c = (struct _color *)src_ptr;
while (line-- > 0)
{
*dst_ptr = (c->r & 0xe0) | (c->g & 0xc0) >> 3 | (c->b & 0xe0) >> 5 ;
@ -46,17 +49,17 @@ static void rtgui_blit_line_4_1(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int li
}
/* 1 bpp to 2 bpp */
static void rtgui_blit_line_1_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
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)
static void rtgui_blit_line_3_2(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t* dst;
rt_uint16_t *dst;
dst = (rt_uint16_t*)dst_ptr;
dst = (rt_uint16_t *)dst_ptr;
line = line / 3;
while (line)
{
@ -73,13 +76,16 @@ static void rtgui_blit_line_3_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int li
}
/* 4 bpp to 2 bpp */
static void rtgui_blit_line_4_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
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;
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;
c = (struct _color *)src_ptr;
ptr = (rt_uint16_t *)dst_ptr;
line = line / 4;
while (line-- > 0)
@ -91,7 +97,7 @@ static void rtgui_blit_line_4_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int li
}
}
static void rtgui_blit_line_1_3(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
static void rtgui_blit_line_1_3(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
return;
}
@ -232,30 +238,30 @@ static const rt_uint32_t RGB565_RGBA8888_LUT[512] =
0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000,
};
static void rtgui_blit_line_2_3(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
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;
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];
*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)
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)
static void rtgui_blit_line_4_3(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
line = line / 4;
while (line)
@ -268,16 +274,16 @@ static void rtgui_blit_line_4_3(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int li
}
}
static void rtgui_blit_line_1_4(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int 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)
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)
static void rtgui_blit_line_3_4(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
line = line / 4;
while (line)
@ -306,18 +312,18 @@ static const rtgui_blit_line_func _blit_table[5][5] =
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);
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)
static void rtgui_blit_line_3_2_inv(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t* dst;
rt_uint16_t *dst;
dst = (rt_uint16_t*)dst_ptr;
dst = (rt_uint16_t *)dst_ptr;
line = line / 3;
while (line)
{
@ -333,7 +339,7 @@ static void rtgui_blit_line_3_2_inv(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, in
return;
}
void rtgui_blit_line_2_2_inv(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
void rtgui_blit_line_2_2_inv(rt_uint8_t *dst_ptr, rt_uint8_t *src_ptr, int line)
{
rt_uint16_t *dst, *src;
@ -365,8 +371,8 @@ static const rtgui_blit_line_func _blit_table_inv[5][5] =
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);
RT_ASSERT(dst_bpp > 0 && dst_bpp < 5);
RT_ASSERT(src_bpp > 0 && src_bpp < 5);
return _blit_table_inv[dst_bpp][src_bpp];
}

View File

@ -31,7 +31,7 @@ static int _int_compare(const void *a, const void *b)
return (*(const int *) a) - (*(const int *) b);
}
void rtgui_dc_destory(struct rtgui_dc* dc)
void rtgui_dc_destory(struct rtgui_dc *dc)
{
if (dc == RT_NULL) return;
@ -40,7 +40,7 @@ void rtgui_dc_destory(struct rtgui_dc* dc)
}
RTM_EXPORT(rtgui_dc_destory);
void rtgui_dc_draw_line (struct rtgui_dc* dc, int x1, int y1, int x2, int y2)
void rtgui_dc_draw_line(struct rtgui_dc *dc, int x1, int y1, int x2, int y2)
{
if (dc == RT_NULL) return;
@ -73,12 +73,12 @@ void rtgui_dc_draw_line (struct rtgui_dc* dc, int x1, int y1, int x2, int y2)
px = x1;
py = y1;
if(dxabs >= dyabs) /* the line is more horizontal than vertical */
if (dxabs >= dyabs) /* the line is more horizontal than vertical */
{
for(i = 0; i < dxabs; i++)
for (i = 0; i < dxabs; i++)
{
y += dyabs;
if(y >= dxabs)
if (y >= dxabs)
{
y -= dxabs;
py += sdy;
@ -91,10 +91,10 @@ void rtgui_dc_draw_line (struct rtgui_dc* dc, int x1, int y1, int x2, int y2)
}
else /* the line is more vertical than horizontal */
{
for(i = 0; i < dyabs; i++)
for (i = 0; i < dyabs; i++)
{
x += dxabs;
if(x >= dyabs)
if (x >= dyabs)
{
x -= dyabs;
px += sdx;
@ -109,7 +109,7 @@ void rtgui_dc_draw_line (struct rtgui_dc* dc, int x1, int y1, int x2, int y2)
}
RTM_EXPORT(rtgui_dc_draw_line);
void rtgui_dc_draw_horizontal_line(struct rtgui_dc* dc, int x1, int x2, int y)
void rtgui_dc_draw_horizontal_line(struct rtgui_dc *dc, int x1, int x2, int y)
{
rtgui_color_t color;
@ -131,7 +131,7 @@ void rtgui_dc_draw_horizontal_line(struct rtgui_dc* dc, int x1, int x2, int y)
}
RTM_EXPORT(rtgui_dc_draw_horizontal_line);
void rtgui_dc_draw_vertical_line(struct rtgui_dc* dc, int x, int y1, int y2)
void rtgui_dc_draw_vertical_line(struct rtgui_dc *dc, int x, int y1, int y2)
{
rtgui_color_t color;
@ -153,7 +153,7 @@ void rtgui_dc_draw_vertical_line(struct rtgui_dc* dc, int x, int y1, int y2)
}
RTM_EXPORT(rtgui_dc_draw_vertical_line);
void rtgui_dc_draw_rect (struct rtgui_dc* dc, struct rtgui_rect* rect)
void rtgui_dc_draw_rect(struct rtgui_dc *dc, struct rtgui_rect *rect)
{
rtgui_dc_draw_hline(dc, rect->x1, rect->x2, rect->y1);
rtgui_dc_draw_hline(dc, rect->x1, rect->x2, rect->y2 - 1);
@ -163,35 +163,36 @@ void rtgui_dc_draw_rect (struct rtgui_dc* dc, struct rtgui_rect* rect)
}
RTM_EXPORT(rtgui_dc_draw_rect);
void rtgui_dc_fill_rect_forecolor(struct rtgui_dc* dc, struct rtgui_rect* rect)
void rtgui_dc_fill_rect_forecolor(struct rtgui_dc *dc, struct rtgui_rect *rect)
{
int i = 0;
rtgui_dc_draw_rect(dc, rect);
do
{
rtgui_dc_draw_hline(dc, rect->x1+1, rect->x2-1, rect->y1+i);
rtgui_dc_draw_hline(dc, rect->x1 + 1, rect->x2 - 1, rect->y1 + i);
i++;
}while(!(rect->y1+i == rect->y2));
}
while (!(rect->y1 + i == rect->y2));
}
RTM_EXPORT(rtgui_dc_fill_rect_forecolor);
void rtgui_dc_draw_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect, int r)
void rtgui_dc_draw_round_rect(struct rtgui_dc *dc, struct rtgui_rect *rect, int r)
{
RT_ASSERT(((rect->x2 - rect->x1)/2 >= r)&&((rect->y2-rect->y1)/2 >= r));
RT_ASSERT(((rect->x2 - rect->x1) / 2 >= r) && ((rect->y2 - rect->y1) / 2 >= r));
if(r < 0)
if (r < 0)
{
return;
}
if(r == 0)
if (r == 0)
{
rtgui_dc_draw_rect(dc, rect);
return;
}
if(((rect->x2 - rect->x1)/2 >= r)&&((rect->y2-rect->y1)/2 >= r))
if (((rect->x2 - rect->x1) / 2 >= r) && ((rect->y2 - rect->y1) / 2 >= r))
{
rtgui_dc_draw_arc(dc, rect->x1 + r, rect->y1 + r, r, 180, 270);
rtgui_dc_draw_arc(dc, rect->x2 - r, rect->y1 + r, r, 270, 360);
@ -206,13 +207,13 @@ void rtgui_dc_draw_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect, int
}
RTM_EXPORT(rtgui_dc_draw_round_rect);
void rtgui_dc_fill_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect, int r)
void rtgui_dc_fill_round_rect(struct rtgui_dc *dc, struct rtgui_rect *rect, int r)
{
struct rtgui_rect rect_temp;
RT_ASSERT(((rect->x2 - rect->x1)/2 >= r)&&((rect->y2-rect->y1)/2 >= r));
RT_ASSERT(((rect->x2 - rect->x1) / 2 >= r) && ((rect->y2 - rect->y1) / 2 >= r));
if(((rect->x2 - rect->x1)/2 >= r)&&((rect->y2-rect->y1)/2 >= r))
if (((rect->x2 - rect->x1) / 2 >= r) && ((rect->y2 - rect->y1) / 2 >= r))
{
rect_temp.x1 = rect->x1 + r;
rect_temp.y1 = rect->y1;
@ -240,7 +241,7 @@ void rtgui_dc_fill_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect, int
}
RTM_EXPORT(rtgui_dc_fill_round_rect);
void rtgui_dc_draw_shaded_rect(struct rtgui_dc* dc, rtgui_rect_t* rect,
void rtgui_dc_draw_shaded_rect(struct rtgui_dc *dc, rtgui_rect_t *rect,
rtgui_color_t c1, rtgui_color_t c2)
{
RT_ASSERT(dc != RT_NULL);
@ -255,29 +256,29 @@ void rtgui_dc_draw_shaded_rect(struct rtgui_dc* dc, rtgui_rect_t* rect,
}
RTM_EXPORT(rtgui_dc_draw_shaded_rect);
void rtgui_dc_draw_focus_rect(struct rtgui_dc* dc, rtgui_rect_t* rect)
void rtgui_dc_draw_focus_rect(struct rtgui_dc *dc, rtgui_rect_t *rect)
{
int x,y;
int x, y;
for (x=rect->x1; x<rect->x2-1; x++)
for (x = rect->x1; x < rect->x2 - 1; x++)
{
if ((x+rect->y1)&0x01)
if ((x + rect->y1) & 0x01)
rtgui_dc_draw_point(dc, x, rect->y1);
if ((x+rect->y2-1)&0x01)
rtgui_dc_draw_point(dc, x, rect->y2-1);
if ((x + rect->y2 - 1) & 0x01)
rtgui_dc_draw_point(dc, x, rect->y2 - 1);
}
for (y=rect->y1; y<rect->y2; y++)
for (y = rect->y1; y < rect->y2; y++)
{
if ((rect->x1+y)&0x01)
if ((rect->x1 + y) & 0x01)
rtgui_dc_draw_point(dc, rect->x1, y);
if ((rect->x2-1+y)&0x01)
rtgui_dc_draw_point(dc, rect->x2-1, y);
if ((rect->x2 - 1 + y) & 0x01)
rtgui_dc_draw_point(dc, rect->x2 - 1, y);
}
}
RTM_EXPORT(rtgui_dc_draw_focus_rect);
void rtgui_dc_draw_text (struct rtgui_dc* dc, const char* text, struct rtgui_rect* rect)
void rtgui_dc_draw_text(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect)
{
rt_uint32_t len;
struct rtgui_font *font;
@ -296,12 +297,12 @@ void rtgui_dc_draw_text (struct rtgui_dc* dc, const char* text, struct rtgui_rec
rtgui_font_get_metrics(font, text, &text_rect);
rtgui_rect_moveto_align(rect, &text_rect, RTGUI_DC_TEXTALIGN(dc));
len = strlen((const char*)text);
len = strlen((const char *)text);
rtgui_font_draw(font, dc, text, len, &text_rect);
}
RTM_EXPORT(rtgui_dc_draw_text);
void rtgui_dc_draw_text_stroke (struct rtgui_dc* dc, const char* text, struct rtgui_rect* rect,
void rtgui_dc_draw_text_stroke(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect,
rtgui_color_t color_stroke, rtgui_color_t color_core)
{
int x, y;
@ -312,9 +313,9 @@ void rtgui_dc_draw_text_stroke (struct rtgui_dc* dc, const char* text, struct rt
fc = RTGUI_DC_FC(dc);
RTGUI_DC_FC(dc) = color_stroke;
for(x=-1; x<2; x++)
for (x = -1; x < 2; x++)
{
for(y=-1; y<2; y++)
for (y = -1; y < 2; y++)
{
r = *rect;
rtgui_rect_moveto(&r, x, y);
@ -330,35 +331,35 @@ RTM_EXPORT(rtgui_dc_draw_text_stroke);
/*
* draw a monochrome color bitmap data
*/
void rtgui_dc_draw_mono_bmp(struct rtgui_dc* dc, int x, int y, int w, int h, const rt_uint8_t* data)
void rtgui_dc_draw_mono_bmp(struct rtgui_dc *dc, int x, int y, int w, int h, const rt_uint8_t *data)
{
int i, j, k;
/* get word bytes */
w = (w + 7)/8;
w = (w + 7) / 8;
/* draw mono bitmap data */
for (i = 0; i < h; i ++)
for (j = 0; j < w; j++)
for (k = 0; k < 8; k++)
if ( ((data[i*w + j] >> (7-k)) & 0x01) != 0)
rtgui_dc_draw_point(dc, x + 8*j + k, y + i);
if (((data[i * w + j] >> (7 - k)) & 0x01) != 0)
rtgui_dc_draw_point(dc, x + 8 * j + k, y + i);
}
RTM_EXPORT(rtgui_dc_draw_mono_bmp);
void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
void rtgui_dc_draw_byte(struct rtgui_dc *dc, int x, int y, int h, const rt_uint8_t *data)
{
rtgui_dc_draw_mono_bmp(dc, x, y, 8, h, data);
}
RTM_EXPORT(rtgui_dc_draw_byte);
void rtgui_dc_draw_word(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
void rtgui_dc_draw_word(struct rtgui_dc *dc, int x, int y, int h, const rt_uint8_t *data)
{
rtgui_dc_draw_mono_bmp(dc, x, y, 16, h, data);
}
RTM_EXPORT(rtgui_dc_draw_word);
void rtgui_dc_draw_border(struct rtgui_dc* dc, rtgui_rect_t* rect, int flag)
void rtgui_dc_draw_border(struct rtgui_dc *dc, rtgui_rect_t *rect, int flag)
{
rtgui_rect_t r;
rtgui_color_t color;
@ -412,7 +413,7 @@ void rtgui_dc_draw_border(struct rtgui_dc* dc, rtgui_rect_t* rect, int flag)
}
RTM_EXPORT(rtgui_dc_draw_border);
void rtgui_dc_draw_polygon(struct rtgui_dc* dc, const int *vx, const int *vy, int count)
void rtgui_dc_draw_polygon(struct rtgui_dc *dc, const int *vx, const int *vy, int count)
{
int i;
const int *x1, *y1, *x2, *y2;
@ -445,7 +446,7 @@ void rtgui_dc_draw_polygon(struct rtgui_dc* dc, const int *vx, const int *vy, in
}
RTM_EXPORT(rtgui_dc_draw_polygon);
void rtgui_dc_draw_regular_polygon(struct rtgui_dc* dc, int x, int y, int r, int count, rt_uint16_t angle)
void rtgui_dc_draw_regular_polygon(struct rtgui_dc *dc, int x, int y, int r, int count, rt_uint16_t angle)
{
int i, temp_val;
double temp;
@ -469,7 +470,7 @@ void rtgui_dc_draw_regular_polygon(struct rtgui_dc* dc, int x, int y, int r, int
x_head = xx = (int *)rtgui_malloc(sizeof(int) * count);
y_head = yy = (int *)rtgui_malloc(sizeof(int) * count);
for(i = 0; i < count; i++)
for (i = 0; i < count; i++)
{
temp = cos(((angle_interval * i) + angle) * M_PI / 180);
temp *= r;
@ -493,7 +494,7 @@ void rtgui_dc_draw_regular_polygon(struct rtgui_dc* dc, int x, int y, int r, int
}
RTM_EXPORT(rtgui_dc_draw_regular_polygon);
void rtgui_dc_fill_polygon(struct rtgui_dc* dc, const int* vx, const int* vy, int count)
void rtgui_dc_fill_polygon(struct rtgui_dc *dc, const int *vx, const int *vy, int count)
{
int i;
int y, xa, xb;
@ -529,31 +530,41 @@ void rtgui_dc_fill_polygon(struct rtgui_dc* dc, const int* vx, const int* vy, in
/*
* Draw, scanning y
*/
for (y = miny; (y <= maxy); y++) {
for (y = miny; (y <= maxy); y++)
{
ints = 0;
for (i = 0; (i < count); i++) {
if (!i) {
for (i = 0; (i < count); i++)
{
if (!i)
{
ind1 = count - 1;
ind2 = 0;
} else {
}
else
{
ind1 = i - 1;
ind2 = i;
}
y1 = vy[ind1];
y2 = vy[ind2];
if (y1 < y2) {
if (y1 < y2)
{
x1 = vx[ind1];
x2 = vx[ind2];
} else if (y1 > y2) {
}
else if (y1 > y2)
{
y2 = vy[ind1];
y1 = vy[ind2];
x2 = vx[ind1];
x1 = vx[ind2];
} else {
}
else
{
continue;
}
if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) )
if (((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)))
{
poly_ints[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
}
@ -565,7 +576,7 @@ void rtgui_dc_fill_polygon(struct rtgui_dc* dc, const int* vx, const int* vy, in
{
xa = poly_ints[i] + 1;
xa = (xa >> 16) + ((xa & 32768) >> 15);
xb = poly_ints[i+1] - 1;
xb = poly_ints[i + 1] - 1;
xb = (xb >> 16) + ((xb & 32768) >> 15);
rtgui_dc_draw_hline(dc, xa, xb, y);
}
@ -576,7 +587,7 @@ void rtgui_dc_fill_polygon(struct rtgui_dc* dc, const int* vx, const int* vy, in
}
RTM_EXPORT(rtgui_dc_fill_polygon);
void rtgui_dc_draw_circle(struct rtgui_dc* dc, int x, int y, int r)
void rtgui_dc_draw_circle(struct rtgui_dc *dc, int x, int y, int r)
{
rt_int16_t cx = 0;
rt_int16_t cy = r;
@ -649,11 +660,12 @@ void rtgui_dc_draw_circle(struct rtgui_dc* dc, int x, int y, int r)
cy--;
}
cx++;
}while (cx <= cy);
}
while (cx <= cy);
}
RTM_EXPORT(rtgui_dc_draw_circle);
void rtgui_dc_fill_circle(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_int16_t r)
void rtgui_dc_fill_circle(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r)
{
rt_int16_t cx = 0;
rt_int16_t cy = r;
@ -682,30 +694,40 @@ void rtgui_dc_fill_circle(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_in
/*
* Draw
*/
do {
do
{
xpcx = x + cx;
xmcx = x - cx;
xpcy = x + cy;
xmcy = x - cy;
if (ocy != cy) {
if (cy > 0) {
if (ocy != cy)
{
if (cy > 0)
{
ypcy = y + cy;
ymcy = y - cy;
rtgui_dc_draw_hline(dc, xmcx, xpcx, ypcy);
rtgui_dc_draw_hline(dc, xmcx, xpcx, ymcy);
} else {
}
else
{
rtgui_dc_draw_hline(dc, xmcx, xpcx, y);
}
ocy = cy;
}
if (ocx != cx) {
if (cx != cy) {
if (cx > 0) {
if (ocx != cx)
{
if (cx != cy)
{
if (cx > 0)
{
ypcx = y + cx;
ymcx = y - cx;
rtgui_dc_draw_hline(dc, xmcy, xpcy, ymcx);
rtgui_dc_draw_hline(dc, xmcy, xpcy, ypcx);
} else {
}
else
{
rtgui_dc_draw_hline(dc, xmcy, xpcy, y);
}
}
@ -714,18 +736,22 @@ void rtgui_dc_fill_circle(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_in
/*
* Update
*/
if (df < 0) {
if (df < 0)
{
df += d_e;
d_e += 2;
d_se += 2;
} else {
}
else
{
df += d_se;
d_e += 2;
d_se += 4;
cy--;
}
cx++;
} while (cx <= cy);
}
while (cx <= cy);
}
RTM_EXPORT(rtgui_dc_fill_circle);
@ -790,7 +816,8 @@ void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16
oct = startoct - 1; // we increment as first step in loop
//stopval_start, stopval_end; // what values of cx to stop at.
do {
do
{
oct = (oct + 1) % 8;
if (oct == startoct)
@ -869,10 +896,13 @@ void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16
}
else if (oct % 2) drawoct &= 255 - (1 << oct);
else drawoct |= (1 << oct);
} else if (oct != startoct) { // already verified that it's != endoct
}
else if (oct != startoct) // already verified that it's != endoct
{
drawoct |= (1 << oct); // draw this entire segment
}
} while (oct != endoct);
}
while (oct != endoct);
// so now we have what octants to draw and when to draw them. all that's left is the actual raster code.
do
@ -945,7 +975,8 @@ void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16
}
cx++;
} while (cx <= cy);
}
while (cx <= cy);
}
RTM_EXPORT(rtgui_dc_draw_arc);
@ -1066,11 +1097,12 @@ void rtgui_dc_fill_sector(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_in
start ++;
rtgui_dc_draw_line(dc, x, y, start_x, start_y);
}while(!((start_x == end_x) && (start_y == end_y)));
}
while (!((start_x == end_x) && (start_y == end_y)));
}
RTM_EXPORT(rtgui_dc_fill_sector);
void rtgui_dc_draw_ellipse(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry)
void rtgui_dc_draw_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry)
{
int ix, iy;
int h, i, j, k;
@ -1160,7 +1192,8 @@ void rtgui_dc_draw_ellipse(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_i
ix = ix + iy / rx;
iy = iy - ix / rx;
} while (i > h);
}
while (i > h);
}
else
{
@ -1214,7 +1247,8 @@ void rtgui_dc_draw_ellipse(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_i
ix = ix + iy / ry;
iy = iy - ix / ry;
} while (i > h);
}
while (i > h);
}
}
RTM_EXPORT(rtgui_dc_draw_ellipse);
@ -1239,7 +1273,8 @@ void rtgui_dc_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_i
}
/* special case for ry=0 - draw a hline */
if (ry == 0) {
if (ry == 0)
{
rtgui_dc_draw_hline(dc, x - rx, x + rx, y);
return;
}
@ -1252,34 +1287,44 @@ void rtgui_dc_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_i
/*
* Draw
*/
if (rx > ry) {
if (rx > ry)
{
ix = 0;
iy = rx * 64;
do {
do
{
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * ry) / rx;
k = (i * ry) / rx;
if ((ok != k) && (oj != k)) {
if ((ok != k) && (oj != k))
{
xph = x + h;
xmh = x - h;
if (k > 0) {
if (k > 0)
{
rtgui_dc_draw_hline(dc, xmh, xph, y + k);
rtgui_dc_draw_hline(dc, xmh, xph, y - k);
} else {
}
else
{
rtgui_dc_draw_hline(dc, xmh, xph, y);
}
ok = k;
}
if ((oj != j) && (ok != j) && (k != j)) {
if ((oj != j) && (ok != j) && (k != j))
{
xmi = x - i;
xpi = x + i;
if (j > 0) {
if (j > 0)
{
rtgui_dc_draw_hline(dc, xmi, xpi, y + j);
rtgui_dc_draw_hline(dc, xmi, xpi, y - j);
} else {
}
else
{
rtgui_dc_draw_hline(dc, xmi, xpi, y);
}
oj = j;
@ -1288,42 +1333,55 @@ void rtgui_dc_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_i
ix = ix + iy / rx;
iy = iy - ix / rx;
} while (i > h);
} else {
}
while (i > h);
}
else
{
ix = 0;
iy = ry * 64;
do {
do
{
h = (ix + 32) >> 6;
i = (iy + 32) >> 6;
j = (h * rx) / ry;
k = (i * rx) / ry;
if ((oi != i) && (oh != i)) {
if ((oi != i) && (oh != i))
{
xmj = x - j;
xpj = x + j;
if (i > 0) {
if (i > 0)
{
rtgui_dc_draw_hline(dc, xmj, xpj, y + i);
rtgui_dc_draw_hline(dc, xmj, xpj, y - i);
} else {
}
else
{
rtgui_dc_draw_hline(dc, xmj, xpj, y);
}
oi = i;
}
if ((oh != h) && (oi != h) && (i != h)) {
if ((oh != h) && (oi != h) && (i != h))
{
xmk = x - k;
xpk = x + k;
if (h > 0) {
if (h > 0)
{
rtgui_dc_draw_hline(dc, xmk, xpk, y + h);
rtgui_dc_draw_hline(dc, xmk, xpk, y - h);
} else {
}
else
{
rtgui_dc_draw_hline(dc, xmk, xpk, y);
}
oh = h;
}
ix = ix + iy / ry;
iy = iy - ix / ry;
} while (i > h);
}
while (i > h);
}
}
RTM_EXPORT(rtgui_dc_fill_ellipse);

View File

@ -44,24 +44,24 @@ struct rtgui_dc_buffer
rtgui_region_t clip;
/* pixel data */
rt_uint8_t* pixel;
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 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 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);
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 =
{
@ -82,11 +82,11 @@ const static struct rtgui_dc_engine dc_buffer_engine =
rtgui_dc_buffer_fini,
};
struct rtgui_dc* rtgui_dc_buffer_create(int w, int h)
struct rtgui_dc *rtgui_dc_buffer_create(int w, int h)
{
struct rtgui_dc_buffer* dc;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer*)rtgui_malloc(sizeof(struct rtgui_dc_buffer));
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;
@ -96,7 +96,7 @@ struct rtgui_dc* rtgui_dc_buffer_create(int w, int h)
dc->width = w;
dc->height = h;
dc->pitch = w * sizeof(rtgui_color_t);
dc->pitch = w *sizeof(rtgui_color_t);
rtgui_region_init(&(dc->clip));
@ -106,18 +106,18 @@ struct rtgui_dc* rtgui_dc_buffer_create(int w, int h)
return &(dc->parent);
}
rt_uint8_t* rtgui_dc_buffer_get_pixel(struct rtgui_dc* dc)
rt_uint8_t *rtgui_dc_buffer_get_pixel(struct rtgui_dc *dc)
{
struct rtgui_dc_buffer* dc_buffer;
struct rtgui_dc_buffer *dc_buffer;
dc_buffer = (struct rtgui_dc_buffer*)dc;
dc_buffer = (struct rtgui_dc_buffer *)dc;
return dc_buffer->pixel;
}
static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc* dc)
static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc *dc)
{
struct rtgui_dc_buffer* buffer = (struct rtgui_dc_buffer*)dc;
struct rtgui_dc_buffer *buffer = (struct rtgui_dc_buffer *)dc;
if (dc->type != RTGUI_DC_BUFFER) return RT_FALSE;
@ -127,48 +127,48 @@ static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc* dc)
return RT_TRUE;
}
static void rtgui_dc_buffer_draw_point(struct rtgui_dc* self, int x, int y)
static void rtgui_dc_buffer_draw_point(struct rtgui_dc *self, int x, int y)
{
rtgui_color_t* ptr;
struct rtgui_dc_buffer* dc;
rtgui_color_t *ptr;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer*)self;
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 = (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)
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;
rtgui_color_t *ptr;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer*)self;
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 = (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)
static void rtgui_dc_buffer_draw_vline(struct rtgui_dc *self, int x, int y1, int y2)
{
rtgui_color_t* ptr;
rtgui_color_t *ptr;
register rt_base_t index;
struct rtgui_dc_buffer* dc;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer*)self;
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));
ptr = (rtgui_color_t *)(dc->pixel + y1 * dc->pitch + x * sizeof(rtgui_color_t));
for (index = y1; index < y2; index ++)
{
/* draw this point */
@ -177,18 +177,18 @@ static void rtgui_dc_buffer_draw_vline(struct rtgui_dc* self, int x, int y1, int
}
}
static void rtgui_dc_buffer_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
static void rtgui_dc_buffer_draw_hline(struct rtgui_dc *self, int x1, int x2, int y)
{
rtgui_color_t* ptr;
rtgui_color_t *ptr;
register rt_base_t index;
struct rtgui_dc_buffer* dc;
struct rtgui_dc_buffer *dc;
dc = (struct rtgui_dc_buffer*)self;
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));
ptr = (rtgui_color_t *)(dc->pixel + y * dc->pitch + x1 * sizeof(rtgui_color_t));
for (index = x1; index < x2; index ++)
{
/* draw this point */
@ -196,14 +196,14 @@ static void rtgui_dc_buffer_draw_hline(struct rtgui_dc* self, int x1, int x2, in
}
}
static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
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;
struct rtgui_dc_buffer *dc;
r = *rect;
dc = (struct rtgui_dc_buffer*)self;
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;
@ -235,9 +235,9 @@ static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* self, struct rtgui_rect*
}
/* 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)
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;
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;
@ -274,17 +274,17 @@ static void rtgui_dc_buffer_blit(struct rtgui_dc* self, struct rtgui_point* dc_p
else
{
/* get blit line function */
blit_line = rtgui_blit_line_get(hw_driver->bits_per_pixel/8, 4);
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);
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);
blit_line(line_ptr, (rt_uint8_t *)pixels, pitch);
pixels += dc->width * sizeof(rtgui_color_t);
/* draw on hardware dc */
@ -297,10 +297,10 @@ static void rtgui_dc_buffer_blit(struct rtgui_dc* self, struct rtgui_point* dc_p
}
}
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_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;
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);
@ -310,32 +310,32 @@ static void rtgui_dc_buffer_blit_line(struct rtgui_dc* self, int x1, int x2, int
/* check range */
if (x2 > dc->width) x2 = dc->width;
color_ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x1 * sizeof(rtgui_color_t));
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)
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;
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)
static rtgui_gc_t *rtgui_dc_buffer_get_gc(struct rtgui_dc *self)
{
struct rtgui_dc_buffer* dc = (struct rtgui_dc_buffer*)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)
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)
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;
struct rtgui_dc_buffer *dc = (struct rtgui_dc_buffer *)self;
rect->x1 = rect->y1 = 0;

View File

@ -27,27 +27,27 @@
#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);
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 *rtgui_dc_begin_drawing(rtgui_widget_t *owner)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
RT_ASSERT(owner != RT_NULL);
rtgui_screen_lock(RT_WAITING_FOREVER);
@ -64,7 +64,7 @@ struct rtgui_dc* rtgui_dc_begin_drawing(rtgui_widget_t* owner)
}
RTM_EXPORT(rtgui_dc_begin_drawing);
void rtgui_dc_end_drawing(struct rtgui_dc* dc)
void rtgui_dc_end_drawing(struct rtgui_dc *dc)
{
dc->engine->fini(dc);
rtgui_screen_unlock();
@ -90,9 +90,9 @@ const struct rtgui_dc_engine dc_client_engine =
rtgui_dc_client_fini,
};
void rtgui_dc_client_init(rtgui_widget_t* owner)
void rtgui_dc_client_init(rtgui_widget_t *owner)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
RT_ASSERT(owner != RT_NULL);
@ -104,10 +104,10 @@ void rtgui_dc_client_init(rtgui_widget_t* owner)
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 *rtgui_dc_client_create(rtgui_widget_t *owner)
{
struct rtgui_dc* dc;
rtgui_widget_t* widget;
struct rtgui_dc *dc;
rtgui_widget_t *widget;
/* adjudge owner */
if (owner == RT_NULL || owner->toplevel == RT_NULL) return RT_NULL;
@ -132,13 +132,13 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
if (RTGUI_IS_WINTITLE(owner->toplevel))
{
struct rtgui_win* top = RTGUI_WIN(owner->toplevel);
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef RTGUI_USING_MOUSE_CURSOR
#ifdef _WIN32
#ifdef _WIN32_NATIVE
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
@ -155,12 +155,12 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
}
else if (RTGUI_IS_WIN(owner->toplevel))
{
struct rtgui_win* top = RTGUI_WIN(owner->toplevel);
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
@ -172,7 +172,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_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
#endif
}
}
@ -180,9 +180,9 @@ struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
return dc;
}
static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc *dc)
{
rtgui_widget_t* owner;
rtgui_widget_t *owner;
if (dc == RT_NULL || dc->type != RTGUI_DC_CLIENT) return RT_FALSE;
@ -192,12 +192,12 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
if (RTGUI_IS_WINTITLE(owner->toplevel))
{
/* update title extent */
struct rtgui_win* top = RTGUI_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
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
@ -220,12 +220,12 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
else if (RTGUI_IS_APP(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
struct rtgui_win* top = RTGUI_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
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
@ -240,7 +240,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
eupdate.rect = owner->extent;
rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
#endif
}
}
@ -251,7 +251,7 @@ static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
/*
* draw a logic point on device
*/
static void rtgui_dc_client_draw_point(struct rtgui_dc* self, int x, int y)
static void rtgui_dc_client_draw_point(struct rtgui_dc *self, int x, int y)
{
rtgui_rect_t rect;
rtgui_widget_t *owner;
@ -272,7 +272,7 @@ static void rtgui_dc_client_draw_point(struct rtgui_dc* self, int x, int y)
}
}
static void rtgui_dc_client_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color)
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;
@ -296,7 +296,7 @@ static void rtgui_dc_client_draw_color_point(struct rtgui_dc* self, int x, int 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)
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;
@ -314,7 +314,7 @@ static void rtgui_dc_client_draw_vline(struct rtgui_dc* self, int x, int y1, int
if (owner->clip.data == RT_NULL)
{
rtgui_rect_t* prect;
rtgui_rect_t *prect;
prect = &(owner->clip.extents);
@ -330,7 +330,7 @@ static void rtgui_dc_client_draw_vline(struct rtgui_dc* self, int x, int y1, int
}
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
{
rtgui_rect_t* prect;
rtgui_rect_t *prect;
register rt_base_t draw_y1, draw_y2;
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
@ -352,7 +352,7 @@ static void rtgui_dc_client_draw_vline(struct rtgui_dc* self, int x, int y1, int
/*
* draw a logic horizontal line on device
*/
static void rtgui_dc_client_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
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;
@ -371,12 +371,12 @@ static void rtgui_dc_client_draw_hline(struct rtgui_dc* self, int x1, int x2, in
if (owner->clip.data == RT_NULL)
{
rtgui_rect_t* prect;
rtgui_rect_t *prect;
prect = &(owner->clip.extents);
/* calculate vline intersect */
if (prect->y1 > y || prect->y2 <= y ) return;
if (prect->y1 > y || prect->y2 <= y) return;
if (prect->x2 <= x1 || prect->x1 > x2) return;
if (prect->x1 > x1) x1 = prect->x1;
@ -387,7 +387,7 @@ static void rtgui_dc_client_draw_hline(struct rtgui_dc* self, int x1, int x2, in
}
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
{
rtgui_rect_t* prect;
rtgui_rect_t *prect;
register rt_base_t draw_x1, draw_x2;
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
@ -395,7 +395,7 @@ static void rtgui_dc_client_draw_hline(struct rtgui_dc* self, int x1, int x2, in
draw_x2 = x2;
/* calculate hline clip */
if (prect->y1 > y || prect->y2 <= y ) continue;
if (prect->y1 > y || prect->y2 <= y) continue;
if (prect->x2 <= x1 || prect->x1 > x2) continue;
if (prect->x1 > x1) draw_x1 = prect->x1;
@ -406,7 +406,7 @@ static void rtgui_dc_client_draw_hline(struct rtgui_dc* self, int x1, int x2, in
}
}
static void rtgui_dc_client_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
static void rtgui_dc_client_fill_rect(struct rtgui_dc *self, struct rtgui_rect *rect)
{
rtgui_color_t foreground;
register rt_base_t index;
@ -434,7 +434,7 @@ static void rtgui_dc_client_fill_rect (struct rtgui_dc* self, struct rtgui_rect*
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)
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;
@ -453,12 +453,12 @@ static void rtgui_dc_client_blit_line (struct rtgui_dc* self, int x1, int x2, in
if (rtgui_region_is_flat(&(owner->clip)) == RT_EOK)
{
rtgui_rect_t* prect;
rtgui_rect_t *prect;
int offset = 0;
prect = &(owner->clip.extents);
/* calculate vline intersect */
if (prect->y1 > y || prect->y2 <= y ) return;
if (prect->y1 > y || prect->y2 <= y) return;
if (prect->x2 <= x1 || prect->x1 > x2) return;
if (prect->x1 > x1) x1 = prect->x1;
@ -468,13 +468,13 @@ static void rtgui_dc_client_blit_line (struct rtgui_dc* self, int x1, int x2, in
* 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;
offset = offset * hw_driver->bits_per_pixel / 8;
/* draw hline */
hw_driver->ops->draw_raw_hline(line_data+offset, x1, x2, y);
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;
rtgui_rect_t *prect;
register rt_base_t draw_x1, draw_x2;
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
@ -482,24 +482,24 @@ static void rtgui_dc_client_blit_line (struct rtgui_dc* self, int x1, int x2, in
draw_x2 = x2;
/* calculate hline clip */
if (prect->y1 > y || prect->y2 <= y ) continue;
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);
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)
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)
static void rtgui_dc_client_set_gc(struct rtgui_dc *self, rtgui_gc_t *gc)
{
rtgui_widget_t *owner;
@ -510,7 +510,7 @@ static void rtgui_dc_client_set_gc(struct rtgui_dc* self, rtgui_gc_t *gc)
owner->gc = *gc;
}
static rtgui_gc_t* rtgui_dc_client_get_gc(struct rtgui_dc* self)
static rtgui_gc_t *rtgui_dc_client_get_gc(struct rtgui_dc *self)
{
rtgui_widget_t *owner;
@ -522,7 +522,7 @@ static rtgui_gc_t* rtgui_dc_client_get_gc(struct rtgui_dc* self)
return &(owner->gc);
}
static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc* self)
static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc *self)
{
rtgui_widget_t *owner;
@ -535,7 +535,7 @@ static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc* self)
return RT_TRUE;
}
static void rtgui_dc_client_get_rect(struct rtgui_dc* self, rtgui_rect_t* rect)
static void rtgui_dc_client_get_rect(struct rtgui_dc *self, rtgui_rect_t *rect)
{
rtgui_widget_t *owner;

View File

@ -24,24 +24,24 @@
#define _int_swap(x, y) do {x ^= y; y ^= x; x ^= y;} while (0)
static void rtgui_dc_hw_draw_point(struct rtgui_dc* dc, int x, int y);
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgui_color_t color);
static void rtgui_dc_hw_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y);
static void rtgui_dc_hw_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2);
static void rtgui_dc_hw_fill_rect (struct rtgui_dc* dc, rtgui_rect_t* rect);
static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data);
static void rtgui_dc_hw_blit (struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect);
static void rtgui_dc_hw_set_gc (struct rtgui_dc* dc, rtgui_gc_t *gc);
static rtgui_gc_t *rtgui_dc_hw_get_gc (struct rtgui_dc* dc);
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc);
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc* dc);
static void rtgui_dc_hw_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
static void rtgui_dc_hw_draw_point(struct rtgui_dc *dc, int x, int y);
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc *dc, int x, int y, rtgui_color_t color);
static void rtgui_dc_hw_draw_hline(struct rtgui_dc *dc, int x1, int x2, int y);
static void rtgui_dc_hw_draw_vline(struct rtgui_dc *dc, int x, int y1, int y2);
static void rtgui_dc_hw_fill_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
static void rtgui_dc_hw_blit_line(struct rtgui_dc *self, int x1, int x2, int y, rt_uint8_t *line_data);
static void rtgui_dc_hw_blit(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect);
static void rtgui_dc_hw_set_gc(struct rtgui_dc *dc, rtgui_gc_t *gc);
static rtgui_gc_t *rtgui_dc_hw_get_gc(struct rtgui_dc *dc);
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc *dc);
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc *dc);
static void rtgui_dc_hw_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
struct rtgui_dc_hw
{
struct rtgui_dc parent;
rtgui_widget_t *owner;
const struct rtgui_graphic_driver* hw_driver;
const struct rtgui_graphic_driver *hw_driver;
};
const struct rtgui_dc_engine dc_hw_engine =
@ -66,10 +66,10 @@ const struct rtgui_dc_engine dc_hw_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_hw_create(rtgui_widget_t* owner)
struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner)
{
struct rtgui_dc_hw* dc;
rtgui_widget_t* widget;
struct rtgui_dc_hw *dc;
rtgui_widget_t *widget;
/* adjudge owner */
if (owner == RT_NULL || owner->toplevel == RT_NULL) return RT_NULL;
@ -94,7 +94,7 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return RT_NULL;
/* create DC */
dc = (struct rtgui_dc_hw*) rtgui_malloc(sizeof(struct rtgui_dc_hw));
dc = (struct rtgui_dc_hw *) rtgui_malloc(sizeof(struct rtgui_dc_hw));
dc->parent.type = RTGUI_DC_HW;
dc->parent.engine = &dc_hw_engine;
dc->owner = owner;
@ -102,13 +102,13 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
if (RTGUI_IS_WINTITLE(owner->toplevel))
{
struct rtgui_win* top = RTGUI_WIN(owner->toplevel);
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef RTGUI_USING_MOUSE_CURSOR
#ifdef _WIN32
#ifdef _WIN32_NATIVE
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
rtgui_mouse_hide_cursor();
@ -122,12 +122,12 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
else if (RTGUI_IS_APP(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
struct rtgui_win* top = RTGUI_WIN(owner->toplevel);
struct rtgui_win *top = RTGUI_WIN(owner->toplevel);
top->drawing ++;
if (top->drawing == 1)
{
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
rt_kprintf("hide cursor\n");
@ -139,7 +139,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_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
#endif
}
}
@ -147,26 +147,26 @@ struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
return &(dc->parent);
}
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc *dc)
{
rtgui_widget_t* owner;
struct rtgui_dc_hw* self;
rtgui_widget_t *owner;
struct rtgui_dc_hw *self;
if (dc == RT_NULL || dc->type != RTGUI_DC_HW) return RT_FALSE;
self = (struct rtgui_dc_hw*)dc;
self = (struct rtgui_dc_hw *)dc;
/* get owner */
owner = self->owner;
if (RTGUI_IS_WINTITLE(owner->toplevel))
{
/* update title extent */
struct rtgui_win* top = RTGUI_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
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
@ -189,12 +189,12 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
else if (RTGUI_IS_APP(owner->toplevel) ||
RTGUI_IS_WIN(owner->toplevel))
{
struct rtgui_win* top = RTGUI_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
#ifdef _WIN32_NATIVE
#ifdef RTGUI_USING_MOUSE_CURSOR
rt_mutex_release(&cursor_mutex);
/* show cursor */
@ -209,7 +209,7 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
eupdate.rect = owner->extent;
rtgui_server_post_event((struct rtgui_event*)&eupdate, sizeof(eupdate));
rtgui_server_post_event((struct rtgui_event *)&eupdate, sizeof(eupdate));
#endif
}
}
@ -223,31 +223,26 @@ static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
/*
* draw a logic point on device
*/
static void rtgui_dc_hw_draw_point(struct rtgui_dc* self, int x, int y)
static void rtgui_dc_hw_draw_point(struct rtgui_dc *self, int x, int y)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
x = x + dc->owner->extent.x1;
#if (0) /* Please yourself to decide whether to use it*/
if(x < dc->owner->extent.x1 || x >= dc->owner->extent.x2) return;
#endif
y = y + dc->owner->extent.y1;
#if (0)
if(y < dc->owner->extent.y1 || y >= dc->owner->extent.y2) return;
#endif
/* draw this point */
dc->hw_driver->ops->set_pixel(&(dc->owner->gc.foreground), x, y);
}
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color)
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc *self, int x, int y, rtgui_color_t color)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
x = x + dc->owner->extent.x1;
y = y + dc->owner->extent.y1;
@ -259,12 +254,12 @@ static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* self, int x, int y, rt
/*
* draw a logic vertical line on device
*/
static void rtgui_dc_hw_draw_vline(struct rtgui_dc* self, int x, int y1, int y2)
static void rtgui_dc_hw_draw_vline(struct rtgui_dc *self, int x, int y1, int y2)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
x = x + dc->owner->extent.x1;
y1 = y1 + dc->owner->extent.y1;
@ -278,12 +273,12 @@ static void rtgui_dc_hw_draw_vline(struct rtgui_dc* self, int x, int y1, int y2)
/*
* draw a logic horizontal line on device
*/
static void rtgui_dc_hw_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
static void rtgui_dc_hw_draw_hline(struct rtgui_dc *self, int x1, int x2, int y)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
/* convert logic to device */
x1 = x1 + dc->owner->extent.x1;
@ -295,14 +290,14 @@ static void rtgui_dc_hw_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
dc->hw_driver->ops->draw_hline(&(dc->owner->gc.foreground), x1, x2, y);
}
static void rtgui_dc_hw_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
static void rtgui_dc_hw_fill_rect(struct rtgui_dc *self, struct rtgui_rect *rect)
{
rtgui_color_t color;
register rt_base_t index, x1, x2;
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
/* get background color */
color = dc->owner->gc.background;
@ -317,12 +312,12 @@ static void rtgui_dc_hw_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rec
}
}
static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data)
static void rtgui_dc_hw_blit_line(struct rtgui_dc *self, int x1, int x2, int y, rt_uint8_t *line_data)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
/* convert logic to device */
x1 = x1 + dc->owner->extent.x1;
@ -333,51 +328,51 @@ static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y,
dc->hw_driver->ops->draw_raw_hline(line_data, x1, x2, y);
}
static void rtgui_dc_hw_blit(struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect)
static void rtgui_dc_hw_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_hw_set_gc(struct rtgui_dc* self, rtgui_gc_t *gc)
static void rtgui_dc_hw_set_gc(struct rtgui_dc *self, rtgui_gc_t *gc)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
/* set gc */
dc->owner->gc = *gc;
}
static rtgui_gc_t* rtgui_dc_hw_get_gc(struct rtgui_dc* self)
static rtgui_gc_t *rtgui_dc_hw_get_gc(struct rtgui_dc *self)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
return &(dc->owner->gc);
}
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc* self)
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc *self)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
if (!RTGUI_WIDGET_IS_DC_VISIBLE(dc->owner)) return RT_FALSE;
return RT_TRUE;
}
static void rtgui_dc_hw_get_rect(struct rtgui_dc* self, rtgui_rect_t* rect)
static void rtgui_dc_hw_get_rect(struct rtgui_dc *self, rtgui_rect_t *rect)
{
struct rtgui_dc_hw* dc;
struct rtgui_dc_hw *dc;
RT_ASSERT(self != RT_NULL);
dc = (struct rtgui_dc_hw*) self;
dc = (struct rtgui_dc_hw *) self;
/* get owner */
rtgui_widget_get_rect(dc->owner, rect);

View File

@ -28,7 +28,7 @@ struct rtgui_filerw_stdio
static int stdio_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
{
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
struct rtgui_filerw_stdio *stdio_filerw = (struct rtgui_filerw_stdio *)context;
int stdio_whence[3] = {SEEK_SET, SEEK_CUR, SEEK_END};
if (whence < RTGUI_FILE_SEEK_SET || whence > RTGUI_FILE_SEEK_END)
@ -43,7 +43,7 @@ static int stdio_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, r
{
int result;
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
struct rtgui_filerw_stdio *stdio_filerw = (struct rtgui_filerw_stdio *)context;
/* end of file */
if (stdio_filerw->eof == RT_TRUE) return -1;
@ -56,22 +56,22 @@ static int stdio_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, r
static int stdio_write(struct rtgui_filerw *context, const void *ptr, rt_size_t size, rt_size_t num)
{
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
struct rtgui_filerw_stdio *stdio_filerw = (struct rtgui_filerw_stdio *)context;
return write(stdio_filerw->fd, (char*)ptr, size * num);
return write(stdio_filerw->fd, (char *)ptr, size * num);
}
static int stdio_tell(struct rtgui_filerw* context)
static int stdio_tell(struct rtgui_filerw *context)
{
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
struct rtgui_filerw_stdio *stdio_filerw = (struct rtgui_filerw_stdio *)context;
return lseek(stdio_filerw->fd, 0, SEEK_CUR);
}
static int stdio_eof(struct rtgui_filerw* context)
static int stdio_eof(struct rtgui_filerw *context)
{
int result;
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
struct rtgui_filerw_stdio *stdio_filerw = (struct rtgui_filerw_stdio *)context;
if (stdio_filerw->eof == RT_TRUE) result = 1;
else result = -1;
@ -81,7 +81,7 @@ static int stdio_eof(struct rtgui_filerw* context)
static int stdio_close(struct rtgui_filerw *context)
{
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
struct rtgui_filerw_stdio *stdio_filerw = (struct rtgui_filerw_stdio *)context;
if (stdio_filerw)
{
@ -107,12 +107,13 @@ struct rtgui_filerw_mem
static int mem_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
{
const rt_uint8_t* newpos;
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
const rt_uint8_t *newpos;
struct rtgui_filerw_mem *mem = (struct rtgui_filerw_mem *)context;
RT_ASSERT(mem != RT_NULL);
switch (whence) {
switch (whence)
{
case RTGUI_FILE_SEEK_SET:
newpos = mem->mem_base + offset;
break;
@ -129,24 +130,24 @@ static int mem_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
return -1;
}
if ( newpos < mem->mem_base )
if (newpos < mem->mem_base)
newpos = mem->mem_base;
if ( newpos > mem->mem_end )
if (newpos > mem->mem_end)
newpos = mem->mem_end;
mem->mem_position = newpos;
return mem->mem_position- mem->mem_base;
return mem->mem_position - mem->mem_base;
}
static int mem_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, rt_size_t maxnum)
{
int total_bytes;
int mem_available;
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
struct rtgui_filerw_mem *mem = (struct rtgui_filerw_mem *)context;
total_bytes = (maxnum * size);
if ( (maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size) )
if ((maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size))
{
return -1;
}
@ -166,23 +167,23 @@ static int mem_write(struct rtgui_filerw *context, const void *ptr, rt_size_t si
return 0; /* not support memory write */
}
static int mem_tell(struct rtgui_filerw* context)
static int mem_tell(struct rtgui_filerw *context)
{
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
struct rtgui_filerw_mem *mem = (struct rtgui_filerw_mem *)context;
return mem->mem_position - mem->mem_base;
}
static int mem_eof(struct rtgui_filerw* context)
static int mem_eof(struct rtgui_filerw *context)
{
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
struct rtgui_filerw_mem *mem = (struct rtgui_filerw_mem *)context;
return mem->mem_position >= mem->mem_end;
}
static int mem_close(struct rtgui_filerw *context)
{
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
struct rtgui_filerw_mem *mem = (struct rtgui_filerw_mem *)context;
if (mem != RT_NULL)
{
@ -193,9 +194,9 @@ static int mem_close(struct rtgui_filerw *context)
return -1;
}
const rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context)
const rt_uint8_t *rtgui_filerw_mem_getdata(struct rtgui_filerw *context)
{
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
struct rtgui_filerw_mem *mem = (struct rtgui_filerw_mem *)context;
/* check whether it's a memory filerw */
if (mem->parent.read != mem_read) return RT_NULL;
@ -207,25 +208,36 @@ const rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context)
#ifdef RTGUI_USING_DFS_FILERW
static int parse_mode(const char *mode)
{
int f=0;
int f = 0;
for (;;)
{
switch (*mode)
{
case 0: return f;
case 'b': f|=O_BINARY;break;
case 'r': f=O_RDONLY; break;
case 'w': f=O_WRONLY|O_CREAT|O_TRUNC; break;
case 'a': f=O_WRONLY|O_CREAT|O_APPEND; break;
case '+': f=(f&(~O_WRONLY))|O_RDWR; break;
case 0:
return f;
case 'b':
f |= O_BINARY;
break;
case 'r':
f = O_RDONLY;
break;
case 'w':
f = O_WRONLY | O_CREAT | O_TRUNC;
break;
case 'a':
f = O_WRONLY | O_CREAT | O_APPEND;
break;
case '+':
f = (f & (~O_WRONLY)) | O_RDWR;
break;
}
++mode;
}
}
struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char* mode)
struct rtgui_filerw *rtgui_filerw_create_file(const char *filename, const char *mode)
{
int fd;
struct rtgui_filerw_stdio *rw;
@ -233,15 +245,15 @@ struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char*
RT_ASSERT(filename != RT_NULL);
rw = RT_NULL;
#ifdef _WIN32
#ifdef _WIN32_NATIVE
fd = _open(filename, parse_mode(mode), 0);
#else
fd = open(filename, parse_mode(mode), 0);
#endif
if ( fd >= 0 )
if (fd >= 0)
{
rw = (struct rtgui_filerw_stdio*) rtgui_malloc(sizeof(struct rtgui_filerw_stdio));
rw = (struct rtgui_filerw_stdio *) rtgui_malloc(sizeof(struct rtgui_filerw_stdio));
if (rw != RT_NULL)
{
rw->parent.seek = stdio_seek;
@ -261,21 +273,26 @@ struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char*
int rtgui_filerw_unlink(const char *filename)
{
#ifdef _WIN32
#ifdef _WIN32_NATIVE
return _unlink(filename);
#else
#ifndef RT_USING_DFS
/* no unlink function */
return -1;
#else
return unlink(filename);
#endif
#endif
}
#endif
struct rtgui_filerw* rtgui_filerw_create_mem(const rt_uint8_t* mem, rt_size_t size)
struct rtgui_filerw *rtgui_filerw_create_mem(const rt_uint8_t *mem, rt_size_t size)
{
struct rtgui_filerw_mem* rw;
struct rtgui_filerw_mem *rw;
RT_ASSERT(mem != RT_NULL);
rw = (struct rtgui_filerw_mem*) rtgui_malloc(sizeof(struct rtgui_filerw_mem));
rw = (struct rtgui_filerw_mem *) rtgui_malloc(sizeof(struct rtgui_filerw_mem));
if (rw != RT_NULL)
{
rw->parent.seek = mem_seek;
@ -293,42 +310,42 @@ struct rtgui_filerw* rtgui_filerw_create_mem(const rt_uint8_t* mem, rt_size_t si
return &(rw->parent);
}
int rtgui_filerw_seek(struct rtgui_filerw* context, rt_off_t offset, int whence)
int rtgui_filerw_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
{
RT_ASSERT(context != RT_NULL);
return context->seek(context, offset, whence);
}
int rtgui_filerw_read(struct rtgui_filerw* context, void* buffer, rt_size_t size, rt_size_t count)
int rtgui_filerw_read(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count)
{
RT_ASSERT(context != RT_NULL);
return context->read(context, buffer, size, count);
}
int rtgui_filerw_write(struct rtgui_filerw* context, const void* buffer, rt_size_t size, rt_size_t count)
int rtgui_filerw_write(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count)
{
RT_ASSERT(context != RT_NULL);
return context->write(context, buffer, size, count);
}
int rtgui_filerw_eof (struct rtgui_filerw* context)
int rtgui_filerw_eof(struct rtgui_filerw *context)
{
RT_ASSERT(context != RT_NULL);
return context->eof(context);
}
int rtgui_filerw_tell(struct rtgui_filerw* context)
int rtgui_filerw_tell(struct rtgui_filerw *context)
{
RT_ASSERT(context != RT_NULL);
return context->tell(context);
}
int rtgui_filerw_close(struct rtgui_filerw* context)
int rtgui_filerw_close(struct rtgui_filerw *context)
{
int result;

View File

@ -15,7 +15,7 @@
#include <rtgui/dc.h>
static rtgui_list_t _rtgui_font_list;
static struct rtgui_font* rtgui_default_font;
static struct rtgui_font *rtgui_default_font;
extern struct rtgui_font rtgui_font_asc16;
extern struct rtgui_font rtgui_font_arial16;
@ -57,7 +57,7 @@ void rtgui_font_system_init()
#endif
}
void rtgui_font_system_add_font(struct rtgui_font* font)
void rtgui_font_system_add_font(struct rtgui_font *font)
{
rtgui_list_init(&(font->list));
rtgui_list_append(&_rtgui_font_list, &(font->list));
@ -71,31 +71,31 @@ void rtgui_font_system_add_font(struct rtgui_font* font)
font->engine->font_load(font);
}
void rtgui_font_system_remove_font(struct rtgui_font* font)
void rtgui_font_system_remove_font(struct rtgui_font *font)
{
rtgui_list_remove(&_rtgui_font_list, &(font->list));
}
struct rtgui_font* rtgui_font_default()
struct rtgui_font *rtgui_font_default()
{
return rtgui_default_font;
}
void rtgui_font_set_defaut(struct rtgui_font* font)
void rtgui_font_set_defaut(struct rtgui_font *font)
{
rtgui_default_font = font;
}
struct rtgui_font* rtgui_font_refer(const rt_uint8_t* family, rt_uint16_t height)
struct rtgui_font *rtgui_font_refer(const char *family, rt_uint16_t height)
{
/* search font */
struct rtgui_list_node* node;
struct rtgui_font* font;
struct rtgui_list_node *node;
struct rtgui_font *font;
rtgui_list_foreach(node, &_rtgui_font_list)
{
font = rtgui_list_entry(node, struct rtgui_font, list);
if ((rt_strncmp((const char*)font->family, (const char*)family, RTGUI_NAME_MAX) == 0) &&
if ((rt_strncmp(font->family, family, RTGUI_NAME_MAX) == 0) &&
font->height == height)
{
font->refer_count ++;
@ -106,7 +106,7 @@ struct rtgui_font* rtgui_font_refer(const rt_uint8_t* family, rt_uint16_t height
return RT_NULL;
}
void rtgui_font_derefer(struct rtgui_font* font)
void rtgui_font_derefer(struct rtgui_font *font)
{
RT_ASSERT(font != RT_NULL);
@ -120,7 +120,7 @@ void rtgui_font_derefer(struct rtgui_font* font)
}
/* draw a text */
void rtgui_font_draw(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
void rtgui_font_draw(struct rtgui_font *font, struct rtgui_dc *dc, const char *text, rt_ubase_t len, struct rtgui_rect *rect)
{
RT_ASSERT(font != RT_NULL);
@ -131,7 +131,7 @@ void rtgui_font_draw(struct rtgui_font* font, struct rtgui_dc* dc, const char* t
}
}
int rtgui_font_get_string_width(struct rtgui_font* font, const char* text)
int rtgui_font_get_string_width(struct rtgui_font *font, const char *text)
{
rtgui_rect_t rect;
@ -141,7 +141,7 @@ int rtgui_font_get_string_width(struct rtgui_font* font, const char* text)
return rect.x2 - rect.x1;
}
void rtgui_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
void rtgui_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect)
{
RT_ASSERT(font != RT_NULL);

View File

@ -16,8 +16,8 @@
/* bitmap font private data */
static void rtgui_bitmap_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_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
static void rtgui_bitmap_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_bitmap_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect);
const struct rtgui_font_engine bmp_font_engine =
{
RT_NULL,
@ -26,11 +26,11 @@ const struct rtgui_font_engine bmp_font_engine =
rtgui_bitmap_font_get_metrics
};
void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc* dc, const char ch,
rtgui_rect_t* rect)
void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap *font, struct rtgui_dc *dc, const char ch,
rtgui_rect_t *rect)
{
rtgui_color_t bc;
const rt_uint8_t* font_ptr;
const rt_uint8_t *font_ptr;
rt_uint16_t x, y, w, h, style;
register rt_base_t i, j, /*k,*/ word_bytes;
@ -51,20 +51,20 @@ void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc
}
else
{
word_bytes = ((font->char_width[ch - font->first_char] - 1)/8) + 1;
word_bytes = ((font->char_width[ch - font->first_char] - 1) / 8) + 1;
font_ptr = font->bmp + font->offset[ch - font->first_char];
}
w = (font->width + x > rect->x2) ? rect->x2 - rect->x1 : font->width;
h = (font->height + y > rect->y2) ? rect->y2 - rect->y1 : font->height;
for(i = 0; i < h; i++)
for (i = 0; i < h; i++)
{
rt_uint8_t chr;
const rt_uint8_t *ptr = font_ptr + i * word_bytes;
for(j = 0; j < w; j++)
for (j = 0; j < w; j++)
{
if(j % 8 == 0)chr = *ptr++;
if(chr & 0x80)
if (j % 8 == 0)chr = *ptr++;
if (chr & 0x80)
rtgui_dc_draw_point(dc, j + x, i + y);
else if (style & RTGUI_TEXTSTYLE_DRAW_BACKGROUND)
rtgui_dc_draw_color_point(dc, j + x, i + y, bc);
@ -73,13 +73,13 @@ void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc
}
}
static void rtgui_bitmap_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_bitmap_font_draw_text(struct rtgui_font *font, struct rtgui_dc *dc,
const char *text, rt_ubase_t len, struct rtgui_rect *rect)
{
rt_uint32_t length;
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
struct rtgui_font_bitmap *bmp_font = (struct rtgui_font_bitmap *)(font->data);
#ifdef RTGUI_USING_FONTHZ
struct rtgui_font* hz_font;
struct rtgui_font *hz_font;
RT_ASSERT(bmp_font != RT_NULL);
@ -89,7 +89,7 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc
while ((rect->x1 < rect->x2) && len)
{
length = 0;
while ((rt_uint8_t)*(text + length) >= 0x80) length ++; /* it's not a ascii character */
while ((rt_uint8_t) * (text + length) >= 0x80) length ++; /* it's not a ascii character */
if (length > 0)
{
if (hz_font != RT_NULL) rtgui_font_draw(hz_font, dc, text, length, rect);
@ -98,7 +98,7 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc
}
length = 0;
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
while (((rt_uint8_t) * (text + length) < 0x80) && *(text + length)) length ++;
if (length > 0)
{
len -= length;
@ -124,7 +124,7 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc
while ((rect->x1 < rect->x2) && len)
{
length = 0;
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
while (((rt_uint8_t) * (text + length) < 0x80) && *(text + length)) length ++;
if (length > 0)
{
len -= length;
@ -144,26 +144,27 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc
#endif
}
static void rtgui_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
static void rtgui_bitmap_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect)
{
rt_uint32_t length;
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
struct rtgui_font_bitmap *bmp_font = (struct rtgui_font_bitmap *)(font->data);
RT_ASSERT(bmp_font != RT_NULL);
/* set init metrics rect */
rect->x1 = rect->y1 = 0;rect->x2 = 0;
rect->x1 = rect->y1 = 0;
rect->x2 = 0;
rect->y2 = bmp_font->height;
while (*text)
{
length = 0;
while ((rt_uint8_t)*(text + length) >= 0x80) length ++; /* it's not a ascii character */
rect->x2 += (font->height/2) * length;
while ((rt_uint8_t) * (text + length) >= 0x80) length ++; /* it's not a ascii character */
rect->x2 += (font->height / 2) * length;
text += length;
length = 0;
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
while (((rt_uint8_t) * (text + length) < 0x80) && *(text + length)) length ++;
if (bmp_font->char_width != NULL)
{
/* get width for each character */

View File

@ -5,8 +5,8 @@
#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);
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 =
{
@ -31,7 +31,7 @@ static void gbk_to_unicode(rt_uint16_t *unicode, const unsigned char *text, int
unsigned short wch;
extern unsigned short ff_convert(unsigned short wch, int direction);
for (i = 0; i < len; )
for (i = 0; i < len;)
{
if (*text < 0x80)
{
@ -54,19 +54,19 @@ static void gbk_to_unicode(rt_uint16_t *unicode, const unsigned char *text, int
*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)
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;
struct rtgui_freetype_font *freetype;
RT_ASSERT(font != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
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);
text_short = (rt_uint16_t *)rtgui_malloc((len + 1) * 2);
if (text_short == RT_NULL) return ; /* out of memory */
/* convert gbk to unicode */
@ -76,14 +76,14 @@ static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_
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);
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT | FT_LOAD_RENDER);
if (err == 0)
{
int rows, x;
rt_uint8_t* ptr;
rt_uint8_t *ptr;
/* render font */
ptr = (rt_uint8_t*)freetype->face->glyph->bitmap.buffer;
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++)
@ -102,24 +102,24 @@ static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_
rtgui_free(text_short);
}
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
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;
struct rtgui_freetype_font *freetype;
RT_ASSERT(font != RT_NULL);
RT_ASSERT(rect != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
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);
text_short = (rt_uint16_t *)rtgui_malloc((len + 1) * 2);
if (text_short == RT_NULL) return ; /* out of memory */
/* convert gbk to unicode */
@ -143,24 +143,26 @@ static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char*
text_ptr ++;
}
rect->x1 = 0; rect->y1 = 0;
rect->x2 = w; rect->y2 = h;
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)
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;
struct rtgui_font *font;
font = (struct rtgui_font*) rtgui_malloc (sizeof(struct rtgui_font));
font = (struct rtgui_font *) rtgui_malloc(sizeof(struct rtgui_font));
if (font != RT_NULL)
{
struct rtgui_freetype_font* freetype;
struct rtgui_freetype_font *freetype;
freetype = (struct rtgui_freetype_font*) rtgui_malloc (sizeof(struct rtgui_freetype_font));
freetype = (struct rtgui_freetype_font *) rtgui_malloc(sizeof(struct rtgui_freetype_font));
if (freetype == RT_NULL)
{
rtgui_free(font);
@ -169,7 +171,7 @@ rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int ita
else
{
err = FT_Init_FreeType(&freetype->library);
if((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
if ((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
{
FT_Done_FreeType(freetype->library);
@ -179,9 +181,9 @@ rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int ita
else
{
err = FT_Select_Charmap(freetype->face, ft_encoding_unicode);
if(err)
if (err)
{
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1 );
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1);
}
err = FT_Set_Pixel_Sizes(freetype->face, 0, size);
@ -219,17 +221,17 @@ rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int ita
return font;
}
void rtgui_freetype_font_destroy(rtgui_font_t* font)
void rtgui_freetype_font_destroy(rtgui_font_t *font)
{
struct rtgui_freetype_font* freetype;
struct rtgui_freetype_font *freetype;
RT_ASSERT(font != RT_NULL);
freetype = (struct rtgui_freetype_font*) font->data;
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_Face(freetype->face);
FT_Done_FreeType(freetype->library);
rtgui_free(freetype);
rtgui_free(font);

View File

@ -4,8 +4,8 @@
#ifdef RTGUI_USING_HZ_BMP
static void rtgui_hz_bitmap_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_hz_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
static void rtgui_hz_bitmap_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_hz_bitmap_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect);
const struct rtgui_font_engine hz_bmp_font_engine =
{
RT_NULL,
@ -14,11 +14,49 @@ const struct rtgui_font_engine hz_bmp_font_engine =
rtgui_hz_bitmap_font_get_metrics
};
static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
#ifdef RTGUI_USING_FONT_COMPACT
extern rt_uint32_t rtgui_font_mph12(const rt_uint16_t key);
extern rt_uint32_t rtgui_font_mph16(const rt_uint16_t key);
rt_inline const rt_uint8_t *_rtgui_hz_bitmap_get_font_ptr(struct rtgui_font_bitmap *bmp_font,
rt_uint8_t *str,
rt_base_t font_bytes)
{
rt_uint16_t cha = *(rt_uint16_t *)str;
int idx;
if (bmp_font->height == 16)
idx = rtgui_font_mph16(cha);
else // asume the height is 12
idx = rtgui_font_mph12(cha);
/* don't access beyond the data */
if (idx < 0)
idx = 0;
/* get font pixel data */
return bmp_font->bmp + idx * font_bytes;
}
#else
rt_inline const rt_uint8_t *_rtgui_hz_bitmap_get_font_ptr(struct rtgui_font_bitmap *bmp_font,
rt_uint8_t *str,
rt_base_t font_bytes)
{
rt_ubase_t sect, index;
/* calculate section and index */
sect = *str - 0xA0;
index = *(str + 1) - 0xA0;
/* get font pixel data */
return bmp_font->bmp + (94 * (sect - 1) + (index - 1)) * font_bytes;
}
#endif
static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap *bmp_font, struct rtgui_dc *dc, const char *text, rt_ubase_t len, struct rtgui_rect *rect)
{
rt_uint8_t* str;
rtgui_color_t bc;
rt_uint16_t style;
rt_uint8_t *str;
register rt_base_t h, word_bytes, font_bytes;
RT_ASSERT(bmp_font != RT_NULL);
@ -28,38 +66,33 @@ static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font,
bc = rtgui_dc_get_gc(dc)->background;
/* drawing height */
h = (bmp_font->height + rect->y1 > rect->y2)? rect->y2 - rect->y1 : bmp_font->height;
word_bytes = (bmp_font->width + 7)/8;
h = (bmp_font->height + rect->y1 > rect->y2) ? rect->y2 - rect->y1 : bmp_font->height;
word_bytes = (bmp_font->width + 7) / 8;
font_bytes = word_bytes * bmp_font->height;
str = (rt_uint8_t*)text;
str = (rt_uint8_t *)text;
while (len > 0 && rect->x1 < rect->x2)
{
const rt_uint8_t* font_ptr;
rt_ubase_t sect, index;
const rt_uint8_t *font_ptr;
register rt_base_t i, j, k;
/* calculate section and index */
sect = *str - 0xA0;
index = *(str+1) - 0xA0;
/* get font pixel data */
font_ptr = bmp_font->bmp + (94 * (sect - 1) + (index - 1)) * font_bytes;
font_ptr = _rtgui_hz_bitmap_get_font_ptr(bmp_font, str, font_bytes);
/* draw word */
for (i=0; i < h; i ++)
for (i = 0; i < h; i ++)
{
for (j=0; j < word_bytes; j++)
for (k=0; k < 8; k++)
for (j = 0; j < word_bytes; j++)
for (k = 0; k < 8; k++)
{
if ( ((font_ptr[i*word_bytes + j] >> (7-k)) & 0x01) != 0 &&
if (((font_ptr[i * word_bytes + j] >> (7 - k)) & 0x01) != 0 &&
(rect->x1 + 8 * j + k < rect->x2))
{
rtgui_dc_draw_point(dc, rect->x1 + 8*j + k, rect->y1 + i);
rtgui_dc_draw_point(dc, rect->x1 + 8 * j + k, rect->y1 + i);
}
else if (style & RTGUI_TEXTSTYLE_DRAW_BACKGROUND)
{
rtgui_dc_draw_color_point(dc, rect->x1 + 8*j + k, rect->y1 + i, bc);
rtgui_dc_draw_color_point(dc, rect->x1 + 8 * j + k, rect->y1 + i, bc);
}
}
}
@ -71,11 +104,11 @@ static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font,
}
}
static void rtgui_hz_bitmap_font_draw_text (struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t length, struct rtgui_rect* rect)
static void rtgui_hz_bitmap_font_draw_text(struct rtgui_font *font, struct rtgui_dc *dc, const char *text, rt_ubase_t length, struct rtgui_rect *rect)
{
rt_uint32_t len;
struct rtgui_font *efont;
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
struct rtgui_font_bitmap *bmp_font = (struct rtgui_font_bitmap *)(font->data);
RT_ASSERT(dc != RT_NULL);
@ -86,7 +119,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 < length) len ++;
while (((rt_uint8_t) * (text + len)) < 0x80 && *(text + len) && len < length) len ++;
/* draw text with English font */
if (len > 0)
{
@ -97,7 +130,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 < length) 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);
@ -110,16 +143,16 @@ static void rtgui_hz_bitmap_font_draw_text (struct rtgui_font* font, struct rtgu
rtgui_font_derefer(efont);
}
static void rtgui_hz_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
static void rtgui_hz_bitmap_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect)
{
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
struct rtgui_font_bitmap *bmp_font = (struct rtgui_font_bitmap *)(font->data);
RT_ASSERT(bmp_font != RT_NULL);
/* set metrics rect */
rect->x1 = rect->y1 = 0;
/* Chinese font is always fixed font */
rect->x2 = (rt_int16_t)(bmp_font->width * rt_strlen((const char*)text));
rect->x2 = (rt_int16_t)(bmp_font->width * rt_strlen((const char *)text));
rect->y2 = bmp_font->height;
}

View File

@ -7,7 +7,7 @@
#include <rtgui/rtgui_system.h>
#ifdef RTGUI_USING_HZ_FILE
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -23,11 +23,11 @@
#define HZ_CACHE_MAX 64
static int _font_cache_compare(struct hz_cache* node1, struct hz_cache* node2);
static int _font_cache_compare(struct hz_cache *node1, struct hz_cache *node2);
static void rtgui_hz_file_font_load(struct rtgui_font* font);
static void rtgui_hz_file_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_hz_file_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
static void rtgui_hz_file_font_load(struct rtgui_font *font);
static void rtgui_hz_file_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_hz_file_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect);
const struct rtgui_font_engine rtgui_hz_file_font_engine =
{
RT_NULL,
@ -37,9 +37,9 @@ const struct rtgui_font_engine rtgui_hz_file_font_engine =
};
SPLAY_PROTOTYPE(cache_tree, hz_cache, hz_node, _font_cache_compare);
SPLAY_GENERATE (cache_tree, hz_cache, hz_node, _font_cache_compare);
SPLAY_GENERATE(cache_tree, hz_cache, hz_node, _font_cache_compare);
static int _font_cache_compare(struct hz_cache* cache_1, struct hz_cache* cache_2)
static int _font_cache_compare(struct hz_cache *cache_1, struct hz_cache *cache_2)
{
if (cache_1->hz_id > cache_2->hz_id) return 1;
if (cache_1->hz_id < cache_2->hz_id) return -1;
@ -47,7 +47,7 @@ static int _font_cache_compare(struct hz_cache* cache_1, struct hz_cache* cache_
return 0;
}
static rt_uint8_t* _font_cache_get(struct rtgui_hz_file_font* font, rt_uint16_t hz_id)
static rt_uint8_t *_font_cache_get(struct rtgui_hz_file_font *font, rt_uint16_t hz_id)
{
rt_uint32_t seek;
struct hz_cache *cache, search;
@ -64,14 +64,14 @@ static rt_uint8_t* _font_cache_get(struct rtgui_hz_file_font* font, rt_uint16_t
rtgui_exit_critical();
/* found it */
return (rt_uint8_t*)(cache + 1);
return (rt_uint8_t *)(cache + 1);
}
/* exit critical */
rtgui_exit_critical();
/* can not find it, load to cache */
cache = (struct hz_cache*) rtgui_malloc(sizeof(struct hz_cache) + font->font_data_size);
cache = (struct hz_cache *) rtgui_malloc(sizeof(struct hz_cache) + font->font_data_size);
if (cache == RT_NULL)
return RT_NULL; /* no memory yet */
@ -81,7 +81,7 @@ static rt_uint8_t* _font_cache_get(struct rtgui_hz_file_font* font, rt_uint16_t
/* read hz font data */
if ((lseek(font->fd, seek, SEEK_SET) < 0) ||
read(font->fd, (char*)(cache + 1), font->font_data_size) !=
read(font->fd, (char *)(cache + 1), font->font_data_size) !=
font->font_data_size)
{
rtgui_free(cache);
@ -94,7 +94,7 @@ static rt_uint8_t* _font_cache_get(struct rtgui_hz_file_font* font, rt_uint16_t
if (font->cache_size >= HZ_CACHE_MAX)
{
/* remove a cache */
struct hz_cache* left;
struct hz_cache *left;
left = font->cache_root.sph_root;
while (SPLAY_LEFT(left, hz_node) != RT_NULL) left = SPLAY_LEFT(left, hz_node);
@ -111,20 +111,20 @@ static rt_uint8_t* _font_cache_get(struct rtgui_hz_file_font* font, rt_uint16_t
/* exit critical */
rtgui_exit_critical();
return (rt_uint8_t*)(cache + 1);
return (rt_uint8_t *)(cache + 1);
}
static void rtgui_hz_file_font_load(struct rtgui_font* font)
static void rtgui_hz_file_font_load(struct rtgui_font *font)
{
struct rtgui_hz_file_font* hz_file_font = (struct rtgui_hz_file_font*)font->data;
struct rtgui_hz_file_font *hz_file_font = (struct rtgui_hz_file_font *)font->data;
RT_ASSERT(hz_file_font != RT_NULL);
hz_file_font->fd = open(hz_file_font->font_fn, O_RDONLY, 0);
}
static void _rtgui_hz_file_font_draw_text(struct rtgui_hz_file_font* hz_file_font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
static void _rtgui_hz_file_font_draw_text(struct rtgui_hz_file_font *hz_file_font, struct rtgui_dc *dc, const char *text, rt_ubase_t len, struct rtgui_rect *rect)
{
rt_uint8_t* str;
rt_uint8_t *str;
rtgui_color_t bc;
rt_uint16_t style;
register rt_base_t h, word_bytes;
@ -134,34 +134,34 @@ static void _rtgui_hz_file_font_draw_text(struct rtgui_hz_file_font* hz_file_fon
bc = rtgui_dc_get_gc(dc)->background;
/* drawing height */
h = (hz_file_font->font_size + rect->y1 > rect->y2)?
h = (hz_file_font->font_size + rect->y1 > rect->y2) ?
rect->y2 - rect->y1 : hz_file_font->font_size;
word_bytes = (hz_file_font->font_size + 7) / 8;
str = (rt_uint8_t*)text;
str = (rt_uint8_t *)text;
while (len > 0 && rect->x1 < rect->x2)
{
const rt_uint8_t* font_ptr;
const rt_uint8_t *font_ptr;
register rt_base_t i, j, k;
/* get font pixel data */
font_ptr = _font_cache_get(hz_file_font, *str | (*(str+1) << 8));
font_ptr = _font_cache_get(hz_file_font, *str | (*(str + 1) << 8));
/* draw word */
for (i=0; i < h; i ++)
for (i = 0; i < h; i ++)
{
for (j=0; j < word_bytes; j++)
for (k=0; k < 8; k++)
for (j = 0; j < word_bytes; j++)
for (k = 0; k < 8; k++)
{
if ( ((font_ptr[i*word_bytes + j] >> (7-k)) & 0x01) != 0 &&
if (((font_ptr[i * word_bytes + j] >> (7 - k)) & 0x01) != 0 &&
(rect->x1 + 8 * j + k < rect->x2))
{
rtgui_dc_draw_point(dc, rect->x1 + 8*j + k, rect->y1 + i);
rtgui_dc_draw_point(dc, rect->x1 + 8 * j + k, rect->y1 + i);
}
else if (style & RTGUI_TEXTSTYLE_DRAW_BACKGROUND)
{
rtgui_dc_draw_color_point(dc, rect->x1 + 8*j + k, rect->y1 + i, bc);
rtgui_dc_draw_color_point(dc, rect->x1 + 8 * j + k, rect->y1 + i, bc);
}
}
}
@ -173,11 +173,11 @@ static void _rtgui_hz_file_font_draw_text(struct rtgui_hz_file_font* hz_file_fon
}
}
static void rtgui_hz_file_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t length, struct rtgui_rect* rect)
static void rtgui_hz_file_font_draw_text(struct rtgui_font *font, struct rtgui_dc *dc, const char *text, rt_ubase_t length, struct rtgui_rect *rect)
{
rt_uint32_t len;
struct rtgui_font *efont;
struct rtgui_hz_file_font* hz_file_font = (struct rtgui_hz_file_font*)font->data;
struct rtgui_hz_file_font *hz_file_font = (struct rtgui_hz_file_font *)font->data;
RT_ASSERT(dc != RT_NULL);
RT_ASSERT(hz_file_font != RT_NULL);
@ -189,7 +189,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 < length) len ++;
while (((rt_uint8_t) * (text + len)) < 0x80 && *(text + len) && len < length) len ++;
/* draw text with English font */
if (len > 0)
{
@ -200,7 +200,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 < length) 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);
@ -213,14 +213,14 @@ static void rtgui_hz_file_font_draw_text(struct rtgui_font* font, struct rtgui_d
rtgui_font_derefer(efont);
}
static void rtgui_hz_file_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
static void rtgui_hz_file_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect)
{
struct rtgui_hz_file_font* hz_file_font = (struct rtgui_hz_file_font*)font->data;
struct rtgui_hz_file_font *hz_file_font = (struct rtgui_hz_file_font *)font->data;
RT_ASSERT(hz_file_font != RT_NULL);
/* set metrics rect */
rect->x1 = rect->y1 = 0;
rect->x2 = (rt_int16_t)(hz_file_font->font_size/2 * rt_strlen((const char*)text));
rect->x2 = (rt_int16_t)(hz_file_font->font_size / 2 * rt_strlen((const char *)text));
rect->y2 = hz_file_font->font_size;
}
#endif

View File

@ -0,0 +1,35 @@
/* 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 };

View File

@ -48,7 +48,7 @@ static void _rgb565_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
for (index = y1; index < y2; index ++)
{
*(rt_uint16_t*)dst = pixel;
*(rt_uint16_t *)dst = pixel;
dst += rtgui_graphic_get_device()->pitch;
}
}
@ -97,7 +97,7 @@ static void _rgb565p_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
for (index = y1; index < y2; index ++)
{
*(rt_uint16_t*)dst = pixel;
*(rt_uint16_t *)dst = pixel;
dst += rtgui_graphic_get_device()->pitch;
}
}
@ -108,7 +108,7 @@ 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));
rt_memcpy(dst, pixels, (x2 - x1) * (rtgui_graphic_get_device()->bits_per_pixel / 8));
}
const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops =
@ -136,14 +136,14 @@ const struct rtgui_graphic_driver_ops _framebuffer_rgb565p_ops =
static void _mono_set_pixel(rtgui_color_t *c, int x, int y)
{
if (*c == white)
MONO_PIXEL(FRAMEBUFFER, x, y) &= ~(1 << (y%8));
MONO_PIXEL(FRAMEBUFFER, x, y) &= ~(1 << (y % 8));
else
MONO_PIXEL(FRAMEBUFFER, x, y) |= (1 << (y%8));
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)))
if (MONO_PIXEL(FRAMEBUFFER, x, y) & (1 << (y % 8)))
*c = black;
else
*c = white;
@ -156,12 +156,12 @@ static void _mono_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
if (*c == white)
for (index = x1; index < x2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y % 8));
}
else
for (index = x1; index < x2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y % 8));
}
}
@ -172,12 +172,12 @@ static void _mono_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
if (*c == white)
for (index = y1; index < y2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, x, index) &= ~(1 << (index%8));
MONO_PIXEL(FRAMEBUFFER, x, index) &= ~(1 << (index % 8));
}
else
for (index = y1; index < y2; index ++)
{
MONO_PIXEL(FRAMEBUFFER, x, index) |= (1 << (index%8));
MONO_PIXEL(FRAMEBUFFER, x, index) |= (1 << (index % 8));
}
}
@ -188,10 +188,10 @@ static void _mono_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
for (index = x1; index < x2; index ++)
{
if (pixels[index/8] && (1 << (index % 8)))
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
if (pixels[index / 8] && (1 << (index % 8)))
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y % 8));
else
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y % 8));
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,9 @@
#include <rtgui/image_container.h>
#include <string.h>
#ifdef _WIN32
#define strncasecmp strnicmp
#endif
#ifdef RTGUI_IMAGE_XPM
#include <rtgui/image_xpm.h>
@ -66,7 +69,7 @@ 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(const char *type)
{
struct rtgui_list_node *node;
struct rtgui_image_engine *engine;
@ -75,7 +78,7 @@ static struct rtgui_image_engine* rtgui_image_get_engine(const char* type)
{
engine = rtgui_list_entry(node, struct rtgui_image_engine, list);
if (strncasecmp(engine->name, type, strlen(engine->name)) ==0)
if (strncasecmp(engine->name, type, strlen(engine->name)) == 0)
return engine;
}
@ -83,16 +86,20 @@ static struct rtgui_image_engine* rtgui_image_get_engine(const char* type)
}
#if defined(RTGUI_USING_DFS_FILERW)
struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn)
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;
const char *ext;
ext = fn + rt_strlen(fn);
while (ext != fn)
{
if (*ext == '.') { ext ++; break; }
if (*ext == '.')
{
ext ++;
break;
}
ext --;
}
if (ext == fn) return RT_NULL; /* no ext */
@ -108,11 +115,11 @@ struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn)
}
RTM_EXPORT(rtgui_image_get_engine_by_filename);
struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load)
struct rtgui_image *rtgui_image_create_from_file(const char *type, const char *filename, rt_bool_t load)
{
struct rtgui_filerw* filerw;
struct rtgui_image_engine* engine;
struct rtgui_image* image = RT_NULL;
struct rtgui_filerw *filerw;
struct rtgui_image_engine *engine;
struct rtgui_image *image = RT_NULL;
/* create filerw context */
filerw = rtgui_filerw_create_file(filename, "rb");
@ -129,7 +136,7 @@ struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* f
if (engine->image_check(filerw) == RT_TRUE)
{
image = (struct rtgui_image*) rtgui_malloc(sizeof(struct rtgui_image));
image = (struct rtgui_image *) rtgui_malloc(sizeof(struct rtgui_image));
if (image == RT_NULL)
{
/* close filerw context */
@ -157,11 +164,11 @@ struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* f
}
RTM_EXPORT(rtgui_image_create_from_file);
struct rtgui_image* rtgui_image_create(const char* filename, rt_bool_t load)
struct rtgui_image *rtgui_image_create(const char *filename, rt_bool_t load)
{
struct rtgui_filerw* filerw;
struct rtgui_image_engine* engine;
struct rtgui_image* image = RT_NULL;
struct rtgui_filerw *filerw;
struct rtgui_image_engine *engine;
struct rtgui_image *image = RT_NULL;
/* create filerw context */
filerw = rtgui_filerw_create_file(filename, "rb");
@ -178,7 +185,7 @@ struct rtgui_image* rtgui_image_create(const char* filename, rt_bool_t load)
if (engine->image_check(filerw) == RT_TRUE)
{
image = (struct rtgui_image*) rtgui_malloc(sizeof(struct rtgui_image));
image = (struct rtgui_image *) rtgui_malloc(sizeof(struct rtgui_image));
if (image == RT_NULL)
{
/* close filerw context */
@ -207,11 +214,11 @@ struct rtgui_image* rtgui_image_create(const char* filename, rt_bool_t load)
RTM_EXPORT(rtgui_image_create);
#endif
struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length, rt_bool_t load)
struct rtgui_image *rtgui_image_create_from_mem(const char *type, const rt_uint8_t *data, rt_size_t length, rt_bool_t load)
{
struct rtgui_filerw* filerw;
struct rtgui_image_engine* engine;
struct rtgui_image* image = RT_NULL;
struct rtgui_filerw *filerw;
struct rtgui_image_engine *engine;
struct rtgui_image *image = RT_NULL;
/* create filerw context */
filerw = rtgui_filerw_create_mem(data, length);
@ -228,7 +235,7 @@ struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8
if (engine->image_check(filerw) == RT_TRUE)
{
image = (struct rtgui_image*) rtgui_malloc(sizeof(struct rtgui_image));
image = (struct rtgui_image *) rtgui_malloc(sizeof(struct rtgui_image));
if (image == RT_NULL)
{
/* close filerw context */
@ -256,7 +263,7 @@ struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8
}
RTM_EXPORT(rtgui_image_create_from_mem);
void rtgui_image_destroy(struct rtgui_image* image)
void rtgui_image_destroy(struct rtgui_image *image)
{
RT_ASSERT(image != RT_NULL);
@ -268,15 +275,15 @@ void rtgui_image_destroy(struct rtgui_image* image)
RTM_EXPORT(rtgui_image_destroy);
/* register an image engine */
void rtgui_image_register_engine(struct rtgui_image_engine* engine)
void rtgui_image_register_engine(struct rtgui_image_engine *engine)
{
RT_ASSERT(engine!= RT_NULL);
RT_ASSERT(engine != RT_NULL);
rtgui_list_append(&_rtgui_system_image_list, &(engine->list));
}
RTM_EXPORT(rtgui_image_register_engine);
void rtgui_image_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect)
void rtgui_image_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect)
{
RT_ASSERT(dc != RT_NULL);
RT_ASSERT(rect != RT_NULL);
@ -291,32 +298,34 @@ void rtgui_image_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtg
}
RTM_EXPORT(rtgui_image_blit);
struct rtgui_image_palette* rtgui_image_palette_create(rt_uint32_t ncolors)
struct rtgui_image_palette *rtgui_image_palette_create(rt_uint32_t ncolors)
{
struct rtgui_image_palette* palette = RT_NULL;
struct rtgui_image_palette *palette = RT_NULL;
if (ncolors > 0)
{
palette = (struct rtgui_image_palette*) rtgui_malloc(sizeof(struct rtgui_image_palette) +
palette = (struct rtgui_image_palette *) rtgui_malloc(sizeof(struct rtgui_image_palette) +
sizeof(rtgui_color_t) * ncolors);
if (palette != RT_NULL) palette->colors = (rtgui_color_t*)(palette + 1);
if (palette != RT_NULL) palette->colors = (rtgui_color_t *)(palette + 1);
}
return palette;
}
RTM_EXPORT(rtgui_image_palette_create);
void rtgui_image_get_rect(struct rtgui_image* image, struct rtgui_rect* rect)
void rtgui_image_get_rect(struct rtgui_image *image, struct rtgui_rect *rect)
{
RT_ASSERT(image != RT_NULL);
RT_ASSERT(rect != RT_NULL);
rect->x1 = 0; rect->y1 = 0;
rect->x2 = image->w; rect->y2 = image->h;
rect->x1 = 0;
rect->y1 = 0;
rect->x2 = image->w;
rect->y2 = image->h;
}
RTM_EXPORT(rtgui_image_get_rect);
rtgui_image_t* rtgui_image_zoom(rtgui_image_t* image, float scalew, float scaleh, rt_uint32_t mode)
rtgui_image_t *rtgui_image_zoom(rtgui_image_t *image, float scalew, float scaleh, rt_uint32_t mode)
{
if (image != RT_NULL && image->engine != RT_NULL)
{
@ -326,7 +335,7 @@ rtgui_image_t* rtgui_image_zoom(rtgui_image_t* image, float scalew, float scaleh
}
RTM_EXPORT(rtgui_image_zoom);
rtgui_image_t* rtgui_image_rotate(rtgui_image_t* image, float angle)
rtgui_image_t *rtgui_image_rotate(rtgui_image_t *image, float angle)
{
if (image != RT_NULL && image->engine != RT_NULL)
{

View File

@ -46,9 +46,9 @@ static rt_bool_t rtgui_image_bmp_check(struct rtgui_filerw *file);
static rt_bool_t rtgui_image_bmp_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load);
static void rtgui_image_bmp_unload(struct rtgui_image *image);
static void rtgui_image_bmp_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
static struct rtgui_image *rtgui_image_bmp_zoom(struct rtgui_image *image,
float scalew, float scaleh, rt_uint32_t mode);
static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, float angle);
static struct rtgui_image *rtgui_image_bmp_rotate(struct rtgui_image *image, float angle);
struct rtgui_image_engine rtgui_image_bmp_engine =
{
@ -841,7 +841,7 @@ static void rtgui_image_bmp_blit(struct rtgui_image *image, struct rtgui_dc *dc,
*/
void rtgui_image_bmp_header_cfg(struct rtgui_image_bmp_header *bhr, rt_int32_t w, rt_int32_t h, rt_uint16_t bits_per_pixel)
{
int image_size = w * h * bits_per_pixel/8;
int image_size = w * h * bits_per_pixel / 8;
int header_size = sizeof(struct rtgui_image_bmp_header);
bhr->bfType = 0x4d42; /* BM */
@ -861,7 +861,7 @@ void rtgui_image_bmp_header_cfg(struct rtgui_image_bmp_header *bhr, rt_int32_t w
bhr->biYPelsPerMeter = 0;
bhr->biClrUsed = 0;
bhr->biClrImportant = 0;
if(bhr->biBitCount == 16 && bhr->biCompression == BI_BITFIELDS)
if (bhr->biBitCount == 16 && bhr->biCompression == BI_BITFIELDS)
{
bhr->bfSize += 12;
bhr->bfOffBits += 12;
@ -873,14 +873,14 @@ void bmp_align_write(struct rtgui_filerw *file, char *dest, char *src, rt_int32_
{
rt_int32_t len_bak = len;
while(len)
while (len)
{
if(*count >= WRITE_CLUSTER_SIZE)
if (*count >= WRITE_CLUSTER_SIZE)
{
rtgui_filerw_write(file, dest, WRITE_CLUSTER_SIZE, 1);
*count = 0;
}
*(dest + *count) = *(src + (len_bak-len));
*(dest + *count) = *(src + (len_bak - len));
len --;
(*count) ++;
}
@ -904,10 +904,10 @@ void screenshot(const char *filename)
rt_uint16_t color, tmp;
#endif
char *pixel_buf;
rt_int32_t write_count=0;
rt_int32_t write_count = 0;
file = rtgui_filerw_create_file(filename, "wb");
if(file == RT_NULL)
if (file == RT_NULL)
{
rt_kprintf("create file failed\n");
return;
@ -919,14 +919,14 @@ void screenshot(const char *filename)
pitch = w * sizeof(rt_uint16_t);
#ifdef RGB_CONVERT_TO_BGR
line_buf = rt_malloc(pitch);
if(line_buf == RT_NULL)
if (line_buf == RT_NULL)
{
rt_kprintf("no memory!\n");
return;
}
#endif
pixel_buf = rt_malloc(WRITE_CLUSTER_SIZE);
if(pixel_buf == RT_NULL)
if (pixel_buf == RT_NULL)
{
rt_kprintf("no memory!\n");
#ifdef RGB_CONVERT_TO_BGR
@ -937,39 +937,39 @@ void screenshot(const char *filename)
rtgui_image_bmp_header_cfg(&bhr, w, h, grp->bits_per_pixel);
bmp_align_write(file, pixel_buf, (char*)&bhr,
bmp_align_write(file, pixel_buf, (char *)&bhr,
sizeof(struct rtgui_image_bmp_header), &write_count);
if(bhr.biCompression == BI_BITFIELDS)
if (bhr.biCompression == BI_BITFIELDS)
{
mask = 0xF800; /* Red Mask */
bmp_align_write(file, pixel_buf, (char*)&mask, 4, &write_count);
bmp_align_write(file, pixel_buf, (char *)&mask, 4, &write_count);
mask = 0x07E0; /* Green Mask */
bmp_align_write(file, pixel_buf, (char*)&mask, 4, &write_count);
bmp_align_write(file, pixel_buf, (char *)&mask, 4, &write_count);
mask = 0x001F; /* Blue Mask */
bmp_align_write(file, pixel_buf, (char*)&mask, 4, &write_count);
bmp_align_write(file, pixel_buf, (char *)&mask, 4, &write_count);
}
rtgui_screen_lock(RT_WAITING_FOREVER);
if(grp->framebuffer != RT_NULL)
if (grp->framebuffer != RT_NULL)
{
src = (rt_uint16_t*)grp->framebuffer;
src = (rt_uint16_t *)grp->framebuffer;
src += w * h;
for(i=0; i<h; i++)
for (i = 0; i < h; i++)
{
src -= w;
#ifdef RGB_CONVERT_TO_BGR
for(j=0; j<w; j++)
for (j = 0; j < w; j++)
{
tmp = *(src + j);
color = (tmp & 0x001F)<<11;
color = (tmp & 0x001F) << 11;
color += (tmp & 0x07E0);
color += (tmp & 0xF800)>>11;
color += (tmp & 0xF800) >> 11;
*(line_buf + i) = color;
}
bmp_align_write(file, pixel_buf, (char*)line_buf, pitch, &write_count);
bmp_align_write(file, pixel_buf, (char *)line_buf, pitch, &write_count);
#else
bmp_align_write(file, pixel_buf, (char*)src, pitch, &write_count);
bmp_align_write(file, pixel_buf, (char *)src, pitch, &write_count);
#endif
}
}
@ -978,22 +978,22 @@ void screenshot(const char *filename)
rtgui_color_t pixel_color;
rt_uint16_t write_color;
int x;
for(i=h-1; i>=0; i--)
for (i = h - 1; i >= 0; i--)
{
x = 0;
if(i%10==0)rt_kprintf(">",i);
while(x < w)
if (i % 10 == 0)rt_kprintf(">", i);
while (x < w)
{
grp->ops->get_pixel(&pixel_color, x, i);
write_color = rtgui_color_to_565p(pixel_color);
bmp_align_write(file, pixel_buf, (char*)&write_color,
bmp_align_write(file, pixel_buf, (char *)&write_color,
sizeof(rt_uint16_t), &write_count);
x++;
}
}
}
/* write The tail of the last */
if(write_count < WRITE_CLUSTER_SIZE)
if (write_count < WRITE_CLUSTER_SIZE)
rtgui_filerw_write(file, pixel_buf, write_count, 1);
rtgui_screen_unlock();
#ifdef RGB_CONVERT_TO_BGR
@ -1012,7 +1012,7 @@ FINSH_FUNCTION_EXPORT(screenshot, usage: screenshot(filename));
* image zoom in, zoom out interface
* Support 16/24 bits format image
*/
static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
static struct rtgui_image *rtgui_image_bmp_zoom(struct rtgui_image *image,
float scalew, float scaleh, rt_uint32_t mode)
{
struct rtgui_image *d_img;
@ -1024,24 +1024,24 @@ static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
char *src_buf;
char *des_buf;
bmp = (struct rtgui_image_bmp*)image->data;
bmp = (struct rtgui_image_bmp *)image->data;
src_buf = bmp->pixels;
sw = bmp->w;
sh = bmp->h;
bitcount = bmp->bit_per_pixel;
if(bitcount != 16 && bitcount != 24)
if (bitcount != 16 && bitcount != 24)
{
rt_kprintf("Does not support %d bits format\n", bitcount);
return RT_NULL;
}
nbytes = bitcount / 8;
src_line_size = sw * nbytes;
src_line_size = sw *nbytes;
dw = (int)(sw / scalew);
dh = (int)(sh / scaleh);
d_img = rt_malloc(sizeof(struct rtgui_image));
if(d_img == RT_NULL)
if (d_img == RT_NULL)
{
rt_kprintf("Not enough memory allocation IMG!\n");
return RT_NULL;
@ -1052,10 +1052,10 @@ static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
d_img->palette = RT_NULL;
/* config dest bmp data */
dest_line_size = ((dw * bitcount + (bitcount-1)) / bitcount) * nbytes;
dest_buff_size = dest_line_size * dh;
dest_line_size = ((dw * bitcount + (bitcount - 1)) / bitcount) *nbytes;
dest_buff_size = dest_line_size *dh;
d_bmp = rt_malloc(sizeof(struct rtgui_image_bmp));
if(d_bmp == RT_NULL)
if (d_bmp == RT_NULL)
{
rt_free(d_img);
rt_kprintf("Not enough memory allocation BMP!\n");
@ -1068,11 +1068,11 @@ static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
d_bmp->pixel_offset = 54; /* insignificant parameter */
d_bmp->filerw = RT_NULL;
d_bmp->is_loaded = RT_TRUE; /* Don't want to loading */
d_bmp->pitch = d_bmp->w * nbytes;
d_bmp->pad = ((d_bmp->pitch % 4) ? (4 - (d_bmp->pitch%4)) : 0);
d_bmp->pitch = d_bmp->w *nbytes;
d_bmp->pad = ((d_bmp->pitch % 4) ? (4 - (d_bmp->pitch % 4)) : 0);
d_bmp->scale = 0;
d_bmp->pixels = rt_malloc(dest_buff_size);
if(d_bmp->pixels == RT_NULL)
if (d_bmp->pixels == RT_NULL)
{
rt_free(d_img);
rt_free(d_bmp);
@ -1089,7 +1089,7 @@ static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
for (j = 0; j < dw; j++)
{
int src_tw = (int)(scalew * j + 0.5);
rt_memcpy (&des_buf[i * dest_line_size] + j * nbytes,
rt_memcpy(&des_buf[i * dest_line_size] + j * nbytes,
&src_buf[src_th * src_line_size] + src_tw * nbytes,
nbytes);
}
@ -1111,44 +1111,46 @@ static struct rtgui_image* rtgui_image_bmp_zoom(struct rtgui_image* image,
{
int x = (int)(scalew * j);
float v = (float)(scalew * j - x);
if(bitcount == 16)
{ /* Each color component is calculated separately */
rt_uint32_t cc1,cc2,cc3,cc4;
if (bitcount == 16)
{
/* Each color component is calculated separately */
rt_uint32_t cc1, cc2, cc3, cc4;
unsigned char r, g, b;
cc1 = rtgui_color_from_565p(*(rt_uint16_t*)(src_buf +
src_line_size * y + nbytes * x ));
cc2 = rtgui_color_from_565p(*(rt_uint16_t*)(src_buf +
src_line_size * y + nbytes * (x+1)));
cc3 = rtgui_color_from_565p(*(rt_uint16_t*)(src_buf +
src_line_size * (y+1) + nbytes * x ));
cc4 = rtgui_color_from_565p(*(rt_uint16_t*)(src_buf +
src_line_size * (y+1) + nbytes * (x+1)));
cc1 = rtgui_color_from_565p(*(rt_uint16_t *)(src_buf +
src_line_size * y + nbytes * x));
cc2 = rtgui_color_from_565p(*(rt_uint16_t *)(src_buf +
src_line_size * y + nbytes * (x + 1)));
cc3 = rtgui_color_from_565p(*(rt_uint16_t *)(src_buf +
src_line_size * (y + 1) + nbytes * x));
cc4 = rtgui_color_from_565p(*(rt_uint16_t *)(src_buf +
src_line_size * (y + 1) + nbytes * (x + 1)));
r = (unsigned char)((1-u)*(1-v)*(float)RTGUI_RGB_R(cc1) +
(1-u)*v*(float)RTGUI_RGB_R(cc2) + u*(1-v)*(float)RTGUI_RGB_R(cc3) +
u*v*(float)RTGUI_RGB_R(cc4));
g = (unsigned char)((1-u)*(1-v)*(float)RTGUI_RGB_G(cc1) +
(1-u)*v*(float)RTGUI_RGB_G(cc2) + u*(1-v)*(float)RTGUI_RGB_G(cc3) +
u*v*(float)RTGUI_RGB_G(cc4));
b = (unsigned char)((1-u)*(1-v)*(float)RTGUI_RGB_B(cc1) +
(1-u)*v*(float)RTGUI_RGB_B(cc2) + u*(1-v)*(float)RTGUI_RGB_B(cc3) +
u*v*(float)RTGUI_RGB_B(cc4));
r = (unsigned char)((1 - u) * (1 - v) * (float)RTGUI_RGB_R(cc1) +
(1 - u) * v * (float)RTGUI_RGB_R(cc2) + u * (1 - v) * (float)RTGUI_RGB_R(cc3) +
u * v * (float)RTGUI_RGB_R(cc4));
g = (unsigned char)((1 - u) * (1 - v) * (float)RTGUI_RGB_G(cc1) +
(1 - u) * v * (float)RTGUI_RGB_G(cc2) + u * (1 - v) * (float)RTGUI_RGB_G(cc3) +
u * v * (float)RTGUI_RGB_G(cc4));
b = (unsigned char)((1 - u) * (1 - v) * (float)RTGUI_RGB_B(cc1) +
(1 - u) * v * (float)RTGUI_RGB_B(cc2) + u * (1 - v) * (float)RTGUI_RGB_B(cc3) +
u * v * (float)RTGUI_RGB_B(cc4));
*(rt_uint16_t*)(des_buf + i * dest_line_size + j * nbytes) =
*(rt_uint16_t *)(des_buf + i * dest_line_size + j * nbytes) =
rtgui_color_to_565p(RTGUI_RGB(r, g, b));
}
else if(bitcount == 24)
else if (bitcount == 24)
{
int k;
for (k = 0; k < 3; k++)
{ /* 24 bits color is 3 bytes R:G:B */
{
/* 24 bits color is 3 bytes R:G:B */
c1 = (src_buf[src_line_size * y + nbytes * x + k]);
c2 = (src_buf[src_line_size * y + nbytes * (x+1) + k]);
c3 = (src_buf[src_line_size * (y+1) + nbytes * x + k]);
c4 = (src_buf[src_line_size * (y+1) + nbytes * (x+1) + k]);
c2 = (src_buf[src_line_size * y + nbytes * (x + 1) + k]);
c3 = (src_buf[src_line_size * (y + 1) + nbytes * x + k]);
c4 = (src_buf[src_line_size * (y + 1) + nbytes * (x + 1) + k]);
des_buf[i * dest_line_size + j * nbytes + k] = (unsigned char)
((1-u)*(1-v)*(float)c1 + (1-u)*v*(float)c2 + u*(1-v)*(float)c3 + u*v*(float)c4);
((1 - u) * (1 - v) * (float)c1 + (1 - u) * v * (float)c2 + u * (1 - v) * (float)c3 + u * v * (float)c4);
}
}
}
@ -1184,7 +1186,7 @@ rt_inline rtgui_point_t _rotate_pos(rtgui_point_t o, rtgui_point_t p, float sina
* image rotate interface, rotate direction: clockwise
* Support 16/24 bits format image
*/
static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, float angle)
static struct rtgui_image *rtgui_image_bmp_rotate(struct rtgui_image *image, float angle)
{
float age, sina, cosa;
rtgui_point_t o, p, cp;
@ -1199,21 +1201,21 @@ static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, flo
char *des_buf;
/* rt_tick_t tick = rt_tick_get(); */
bmp = (struct rtgui_image_bmp*)image->data;
bmp = (struct rtgui_image_bmp *)image->data;
src_buf = bmp->pixels;
sw = bmp->w;
sh = bmp->h;
bitcount = bmp->bit_per_pixel;
if(bitcount != 16 && bitcount != 24)
if (bitcount != 16 && bitcount != 24)
{
rt_kprintf("Does not support %d bits format\n", bitcount);
return RT_NULL;
}
nbytes = bitcount / 8;
src_line_size = sw * nbytes;
src_line_size = sw *nbytes;
/* convert angle to radians */
age = angle * M_PI / 180.0;
age = angle *M_PI / 180.0;
sina = sin(age);
cosa = cos(age);
@ -1222,13 +1224,14 @@ static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, flo
** solve: aa = a*abs(cos(angle)) + b*abs(sin(angle));
** solve: bb = b*abs(cos(angle)) + a*abs(sin(angle));
*/
dw = (int)(sw * fabs(cosa) + sh * fabs(sina));
dh = (int)(sh * fabs(cosa) + sw * fabs(sina));
dw = (int)(sw *fabs(cosa) + sh *fabs(sina));
dh = (int)(sh *fabs(cosa) + sw *fabs(sina));
rect.x1 = rect.y1 = 0;
rect.x2 = sw; rect.y2 = sh;
rect.x2 = sw;
rect.y2 = sh;
d_img = rt_malloc(sizeof(struct rtgui_image));
if(d_img == RT_NULL)
if (d_img == RT_NULL)
{
rt_kprintf("Not enough memory allocation IMG!\n");
return RT_NULL;
@ -1239,10 +1242,10 @@ static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, flo
d_img->palette = RT_NULL;
/* config dest bmp data */
dest_line_size = ((dw * bitcount + (bitcount-1)) / bitcount) * nbytes;
dest_buff_size = dest_line_size * dh;
dest_line_size = ((dw * bitcount + (bitcount - 1)) / bitcount) *nbytes;
dest_buff_size = dest_line_size *dh;
d_bmp = rt_malloc(sizeof(struct rtgui_image_bmp));
if(d_bmp == RT_NULL)
if (d_bmp == RT_NULL)
{
rt_free(d_img);
rt_kprintf("Not enough memory allocation BMP!\n");
@ -1255,11 +1258,11 @@ static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, flo
d_bmp->pixel_offset = 54; /* insignificant parameter */
d_bmp->filerw = RT_NULL;
d_bmp->is_loaded = RT_TRUE; /* Don't want to loading */
d_bmp->pitch = d_bmp->w * nbytes;
d_bmp->pad = ((d_bmp->pitch % 4) ? (4 - (d_bmp->pitch%4)) : 0);
d_bmp->pitch = d_bmp->w *nbytes;
d_bmp->pad = ((d_bmp->pitch % 4) ? (4 - (d_bmp->pitch % 4)) : 0);
d_bmp->scale = 0;
d_bmp->pixels = rt_malloc(dest_buff_size);
if(d_bmp->pixels == RT_NULL)
if (d_bmp->pixels == RT_NULL)
{
rt_free(d_img);
rt_free(d_bmp);
@ -1270,21 +1273,22 @@ static struct rtgui_image* rtgui_image_bmp_rotate(struct rtgui_image* image, flo
/* use white fill empty pixel */
rt_memset(des_buf, 0xFF, dest_buff_size);
o.x = dw>>1;
o.y = dh>>1;
if(bitcount == 16 || bitcount == 24)
o.x = dw >> 1;
o.y = dh >> 1;
if (bitcount == 16 || bitcount == 24)
{
for (i = 0; i < dh; i++)
{
for (j = 0; j < dw; j++)
{
p.x = j; p.y = i;
p.x = j;
p.y = i;
cp = _rotate_pos(o, p, sina, cosa);
cp.x -= (dw-sw)>>1;
cp.y -= (dh-sh)>>1;
if(rtgui_rect_contains_point(&rect, cp.x, cp.y) != RT_EOK)
cp.x -= (dw - sw) >> 1;
cp.y -= (dh - sh) >> 1;
if (rtgui_rect_contains_point(&rect, cp.x, cp.y) != RT_EOK)
continue;
rt_memcpy (&des_buf[dest_line_size * i] + nbytes * j,
rt_memcpy(&des_buf[dest_line_size * i] + nbytes * j,
&src_buf[src_line_size * cp.y] + nbytes * cp.x, nbytes);
}
}

View File

@ -1,27 +1,27 @@
#include <rtgui/image_container.h>
#ifdef RTGUI_IMAGE_CONTAINER
typedef unsigned int (*rtgui_hash_func_t) (const void* key);
typedef unsigned int (*rtgui_hash_func_t)(const void *key);
typedef struct _rtgui_hash_table rtgui_hash_table_t;
typedef rt_bool_t (*rtgui_equal_func_t) (const void* a, const void* b);
typedef void (*rtgui_user_func_t) (const void* value, const void* data);
typedef rt_bool_t (*rtgui_equal_func_t)(const void *a, const void *b);
typedef void (*rtgui_user_func_t)(const void *value, const void *data);
/*
*Hash tables
*/
rtgui_hash_table_t* hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_func_t key_equal_func);
void hash_table_destroy (rtgui_hash_table_t* hash_table);
rtgui_hash_table_t *hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_func_t key_equal_func);
void hash_table_destroy(rtgui_hash_table_t *hash_table);
void* hash_table_find (rtgui_hash_table_t* hash_table, const void* key);
void hash_table_insert (rtgui_hash_table_t* hash_table, const void* key, void* value);
rt_bool_t hash_table_remove (rtgui_hash_table_t* hash_table, const void* key);
void *hash_table_find(rtgui_hash_table_t *hash_table, const void *key);
void hash_table_insert(rtgui_hash_table_t *hash_table, const void *key, void *value);
rt_bool_t hash_table_remove(rtgui_hash_table_t *hash_table, const void *key);
void hash_table_foreach(rtgui_hash_table_t* hash_table, rtgui_user_func_t user_func, void* data);
unsigned int hash_table_get_size (rtgui_hash_table_t* hash_table);
void hash_table_foreach(rtgui_hash_table_t *hash_table, rtgui_user_func_t user_func, void *data);
unsigned int hash_table_get_size(rtgui_hash_table_t *hash_table);
/* Hash Functions
*/
unsigned int direct_hash (const void* v);
unsigned int direct_hash(const void *v);
#define HASH_TABLE_MIN_SIZE 11
#define HASH_TABLE_MAX_SIZE 6247
@ -29,8 +29,8 @@ unsigned int direct_hash (const void* v);
typedef struct _gui_hash_node rtgui_hash_node_t;
struct _gui_hash_node
{
void* key;
void* value;
void *key;
void *value;
rtgui_hash_node_t *next;
};
@ -61,7 +61,7 @@ static const unsigned int primes[] =
2777,
4177,
6247,
/*
/*
9371,
14057,
21089,
@ -81,20 +81,20 @@ static const unsigned int primes[] =
6153409,
9230113,
13845163,
*/
*/
};
static const unsigned int nprimes = sizeof (primes) / sizeof (primes[0]);
static const unsigned int nprimes = sizeof(primes) / sizeof(primes[0]);
static void hash_table_resize (rtgui_hash_table_t *hash_table);
static rtgui_hash_node_t** hash_table_find_node (rtgui_hash_table_t *hash_table, const void* key);
static rtgui_hash_node_t* hash_node_create (const void* key, void* value);
static void hash_node_destroy (rtgui_hash_node_t *hash_node);
static void hash_nodes_destroy (rtgui_hash_node_t *hash_node);
static unsigned int primes_closest (unsigned int num);
static void hash_table_resize(rtgui_hash_table_t *hash_table);
static rtgui_hash_node_t **hash_table_find_node(rtgui_hash_table_t *hash_table, const void *key);
static rtgui_hash_node_t *hash_node_create(const void *key, void *value);
static void hash_node_destroy(rtgui_hash_node_t *hash_node);
static void hash_nodes_destroy(rtgui_hash_node_t *hash_node);
static unsigned int primes_closest(unsigned int num);
static void hash_table_needresize(rtgui_hash_table_t *hash_table);
rt_inline unsigned int primes_closest (unsigned int num)
rt_inline unsigned int primes_closest(unsigned int num)
{
int i;
@ -106,23 +106,23 @@ rt_inline unsigned int primes_closest (unsigned int num)
}
/* directly hash */
unsigned int direct_hash (const void* v)
unsigned int direct_hash(const void *v)
{
return (unsigned int)v;
}
rtgui_hash_table_t* hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_func_t key_equal_func)
rtgui_hash_table_t *hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_func_t key_equal_func)
{
rtgui_hash_table_t *hash_table;
hash_table = (rtgui_hash_table_t*) rtgui_malloc (sizeof(rtgui_hash_table_t));
hash_table = (rtgui_hash_table_t *) rtgui_malloc(sizeof(rtgui_hash_table_t));
if (hash_table != RT_NULL)
{
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
hash_table->hash_func = hash_func ? hash_func : direct_hash;
hash_table->key_equal_func = key_equal_func;
hash_table->nodes = (rtgui_hash_node_t **)rtgui_malloc ( sizeof(rtgui_hash_node_t*) * hash_table->size);
hash_table->nodes = (rtgui_hash_node_t **)rtgui_malloc(sizeof(rtgui_hash_node_t *) * hash_table->size);
if (hash_table->nodes == RT_NULL)
{
/* no memory yet */
@ -130,33 +130,33 @@ rtgui_hash_table_t* hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_f
return RT_NULL;
}
rt_memset(hash_table->nodes, 0, sizeof(rtgui_hash_node_t*) * hash_table->size);
rt_memset(hash_table->nodes, 0, sizeof(rtgui_hash_node_t *) * hash_table->size);
}
return hash_table;
}
void hash_table_destroy (rtgui_hash_table_t *hash_table)
void hash_table_destroy(rtgui_hash_table_t *hash_table)
{
unsigned int i;
RT_ASSERT(hash_table != RT_NULL);
for (i = 0; i < hash_table->size; i++)
hash_nodes_destroy (hash_table->nodes[i]);
hash_nodes_destroy(hash_table->nodes[i]);
rtgui_free (hash_table->nodes);
rtgui_free (hash_table);
rtgui_free(hash_table->nodes);
rtgui_free(hash_table);
}
static rtgui_hash_node_t** hash_table_find_node (rtgui_hash_table_t *hash_table, const void* key)
static rtgui_hash_node_t **hash_table_find_node(rtgui_hash_table_t *hash_table, const void *key)
{
rtgui_hash_node_t **node;
node = &hash_table->nodes [(* hash_table->hash_func) (key) % hash_table->size];
node = &hash_table->nodes [(* hash_table->hash_func)(key) % hash_table->size];
if (hash_table->key_equal_func)
while (*node && !(*hash_table->key_equal_func) ((*node)->key, key))
while (*node && !(*hash_table->key_equal_func)((*node)->key, key))
node = &(*node)->next;
else
while (*node && (*node)->key != key)
@ -165,53 +165,53 @@ static rtgui_hash_node_t** hash_table_find_node (rtgui_hash_table_t *hash_table,
return node;
}
void* hash_table_find (rtgui_hash_table_t* hash_table, const void* key)
void *hash_table_find(rtgui_hash_table_t *hash_table, const void *key)
{
rtgui_hash_node_t *node;
RT_ASSERT(hash_table != RT_NULL);
RT_ASSERT(key != RT_NULL);
node = *hash_table_find_node (hash_table, key);
node = *hash_table_find_node(hash_table, key);
if (node) return node->value;
else return RT_NULL;
}
void hash_table_insert (rtgui_hash_table_t *hash_table, const void* key, void* value)
void hash_table_insert(rtgui_hash_table_t *hash_table, const void *key, void *value)
{
rtgui_hash_node_t **node;
if (hash_table == RT_NULL)return;
node = hash_table_find_node (hash_table, key);
node = hash_table_find_node(hash_table, key);
if (*node)
{
(*node)->value = value;
}
else
{
*node = hash_node_create (key, value);
*node = hash_node_create(key, value);
hash_table->nnodes++;
hash_table_needresize (hash_table);
hash_table_needresize(hash_table);
}
}
rt_bool_t hash_table_remove (rtgui_hash_table_t *hash_table, const void* key)
rt_bool_t hash_table_remove(rtgui_hash_table_t *hash_table, const void *key)
{
rtgui_hash_node_t **node, *dest;
if (hash_table == RT_NULL) return RT_FALSE;
node = hash_table_find_node (hash_table, key);
node = hash_table_find_node(hash_table, key);
if (*node)
{
dest = *node;
(*node) = dest->next;
hash_node_destroy (dest);
hash_node_destroy(dest);
hash_table->nnodes--;
hash_table_needresize (hash_table);
hash_table_needresize(hash_table);
return RT_TRUE;
}
@ -219,7 +219,7 @@ rt_bool_t hash_table_remove (rtgui_hash_table_t *hash_table, const void* key)
return RT_FALSE;
}
void hash_table_foreach(rtgui_hash_table_t *hash_table, rtgui_user_func_t user_func, void* data)
void hash_table_foreach(rtgui_hash_table_t *hash_table, rtgui_user_func_t user_func, void *data)
{
rtgui_hash_node_t *node;
int i;
@ -229,24 +229,24 @@ void hash_table_foreach(rtgui_hash_table_t *hash_table, rtgui_user_func_t user_f
for (i = 0; i < hash_table->size; i++)
for (node = hash_table->nodes[i]; node; node = node->next)
(* user_func) (node->value, data);
(* user_func)(node->value, data);
}
unsigned int hash_table_get_size (rtgui_hash_table_t *hash_table)
unsigned int hash_table_get_size(rtgui_hash_table_t *hash_table)
{
if ( hash_table ==NULL ) return 0;
if (hash_table == NULL) return 0;
return hash_table->nnodes;
}
static void hash_table_needresize(rtgui_hash_table_t *hash_table)
{
if ((hash_table->size >= 3*hash_table->nnodes && hash_table->size > HASH_TABLE_MIN_SIZE) ||
if ((hash_table->size >= 3 * hash_table->nnodes && hash_table->size > HASH_TABLE_MIN_SIZE) ||
(3 * hash_table->size <= hash_table->nnodes && hash_table->size < HASH_TABLE_MAX_SIZE))
hash_table_resize (hash_table);
hash_table_resize(hash_table);
}
static void hash_table_resize (rtgui_hash_table_t *hash_table)
static void hash_table_resize(rtgui_hash_table_t *hash_table)
{
rtgui_hash_node_t **new_nodes;
rtgui_hash_node_t *node;
@ -258,9 +258,9 @@ static void hash_table_resize (rtgui_hash_table_t *hash_table)
i = primes_closest(hash_table->nnodes);
new_size = i > HASH_TABLE_MAX_SIZE ? HASH_TABLE_MAX_SIZE : i < HASH_TABLE_MIN_SIZE ? HASH_TABLE_MIN_SIZE : i ;
new_nodes = (rtgui_hash_node_t **)rtgui_malloc ( sizeof(rtgui_hash_node_t*) * new_size);
new_nodes = (rtgui_hash_node_t **)rtgui_malloc(sizeof(rtgui_hash_node_t *) * new_size);
if (new_nodes == RT_NULL) return; /* no memory yet */
rt_memset(new_nodes, 0, sizeof(rtgui_hash_node_t*) * new_size);
rt_memset(new_nodes, 0, sizeof(rtgui_hash_node_t *) * new_size);
for (i = 0; i < hash_table->size; i++)
{
@ -268,23 +268,23 @@ static void hash_table_resize (rtgui_hash_table_t *hash_table)
{
next = node->next;
hash_val = (* hash_table->hash_func) (node->key) % new_size;
hash_val = (* hash_table->hash_func)(node->key) % new_size;
node->next = new_nodes[hash_val];
new_nodes[hash_val] = node;
}
}
rtgui_free (hash_table->nodes);
rtgui_free(hash_table->nodes);
hash_table->nodes = new_nodes;
hash_table->size = new_size;
}
static rtgui_hash_node_t* hash_node_create (void* key, void* value)
static rtgui_hash_node_t *hash_node_create(void *key, void *value)
{
rtgui_hash_node_t *hash_node;
hash_node = (rtgui_hash_node_t*) rtgui_malloc ( sizeof(rtgui_hash_node_t) );
hash_node = (rtgui_hash_node_t *) rtgui_malloc(sizeof(rtgui_hash_node_t));
if (hash_node != RT_NULL)
{
/* set value and key */
@ -297,12 +297,12 @@ static rtgui_hash_node_t* hash_node_create (void* key, void* value)
return hash_node;
}
static void hash_node_destroy (rtgui_hash_node_t *hash_node)
static void hash_node_destroy(rtgui_hash_node_t *hash_node)
{
rtgui_free(hash_node);
}
static void hash_nodes_destroy (rtgui_hash_node_t *hash_node)
static void hash_nodes_destroy(rtgui_hash_node_t *hash_node)
{
if (hash_node)
{
@ -325,15 +325,15 @@ static void hash_nodes_destroy (rtgui_hash_node_t *hash_node)
}
}
unsigned int string_hash_func(const void* self)
unsigned int string_hash_func(const void *self)
{
const char *p;
int h=0, g;
int h = 0, g;
for(p = self; *p != '\0'; p += 1)
for (p = self; *p != '\0'; p += 1)
{
h = ( h << 4 ) + *p;
if ( ( g = h & 0xf0000000 ) )
h = (h << 4) + *p;
if ((g = h & 0xf0000000))
{
h = h ^ (g >> 24);
h = h ^ g;
@ -342,18 +342,18 @@ unsigned int string_hash_func(const void* self)
return h ;
}
rt_bool_t string_equal_func(const void* a, const void* b)
rt_bool_t string_equal_func(const void *a, const void *b)
{
const char *str1, *str2;
str1 = (const char*)a;
str2 = (const char*)b;
str1 = (const char *)a;
str2 = (const char *)b;
if (strcmp(str1, str2) == 0) return RT_TRUE;
return RT_FALSE;
}
static rtgui_hash_table_t* image_hash_table;
static rtgui_hash_table_t *image_hash_table;
static rt_bool_t load_image = RT_FALSE;
void rtgui_system_image_container_init(rt_bool_t load)
{
@ -366,14 +366,14 @@ void rtgui_system_image_container_init(rt_bool_t load)
}
#ifdef RTGUI_USING_DFS_FILERW
rtgui_image_item_t* rtgui_image_container_get(const char* filename)
rtgui_image_item_t *rtgui_image_container_get(const char *filename)
{
struct rtgui_image_item* item;
struct rtgui_image_item *item;
item = hash_table_find(image_hash_table, filename);
if (item == RT_NULL)
{
item = (struct rtgui_image_item*) rtgui_malloc (sizeof(struct rtgui_image_item));
item = (struct rtgui_image_item *) rtgui_malloc(sizeof(struct rtgui_image_item));
if (item == RT_NULL) return RT_NULL;
/* create a image object */
@ -397,10 +397,10 @@ rtgui_image_item_t* rtgui_image_container_get(const char* filename)
}
#endif
rtgui_image_item_t* rtgui_image_container_get_memref(const char* type, const rt_uint8_t* memory, rt_uint32_t length)
rtgui_image_item_t *rtgui_image_container_get_memref(const char *type, const rt_uint8_t *memory, rt_uint32_t length)
{
char filename[32];
struct rtgui_image_item* item;
struct rtgui_image_item *item;
/* create filename for image identification */
rt_snprintf(filename, sizeof(filename), "0x%08x_%s", memory, type);
@ -409,7 +409,7 @@ rtgui_image_item_t* rtgui_image_container_get_memref(const char* type, const rt_
item = hash_table_find(image_hash_table, filename);
if (item == RT_NULL)
{
item = (struct rtgui_image_item*) rtgui_malloc (sizeof(struct rtgui_image_item));
item = (struct rtgui_image_item *) rtgui_malloc(sizeof(struct rtgui_image_item));
if (item == RT_NULL) return RT_NULL;
/* create image object */
@ -429,7 +429,7 @@ rtgui_image_item_t* rtgui_image_container_get_memref(const char* type, const rt_
return item;
}
void rtgui_image_container_put(rtgui_image_item_t* item)
void rtgui_image_container_put(rtgui_image_item_t *item)
{
item->refcount --;
if (item->refcount == 0)

View File

@ -17,15 +17,15 @@ struct rtgui_image_hdc
rt_size_t pixel_offset;
rt_uint8_t *pixels;
struct rtgui_filerw* filerw;
const struct rtgui_graphic_driver* hw_driver;
struct rtgui_filerw *filerw;
const struct rtgui_graphic_driver *hw_driver;
};
static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw* file);
static rt_bool_t rtgui_image_hdc_load(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load);
static void rtgui_image_hdc_unload(struct rtgui_image* image);
static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect);
static void rtgui_image_hdcmm_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* dst_rect);
static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw *file);
static rt_bool_t rtgui_image_hdc_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load);
static void rtgui_image_hdc_unload(struct rtgui_image *image);
static void rtgui_image_hdc_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
static void rtgui_image_hdcmm_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *dst_rect);
struct rtgui_image_engine rtgui_image_hdc_engine =
{
@ -51,13 +51,13 @@ const struct rtgui_image_engine rtgui_image_hdcmm_engine =
RT_NULL
};
static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw* file)
static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw *file)
{
int start;
rt_bool_t is_HDC;
rt_uint8_t magic[4];
if ( !file ) return 0;
if (!file) return 0;
start = rtgui_filerw_tell(file);
@ -65,12 +65,12 @@ static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw* file)
rtgui_filerw_seek(file, 0, RTGUI_FILE_SEEK_SET);
is_HDC = RT_FALSE;
if ( rtgui_filerw_read(file, magic, 1, sizeof(magic)) == sizeof(magic) )
if (rtgui_filerw_read(file, magic, 1, sizeof(magic)) == sizeof(magic))
{
if ( magic[0] == 'H' &&
if (magic[0] == 'H' &&
magic[1] == 'D' &&
magic[2] == 'C' &&
magic[3] == '\0' )
magic[3] == '\0')
{
is_HDC = RT_TRUE;
}
@ -80,25 +80,30 @@ static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw* file)
return(is_HDC);
}
static rt_bool_t rtgui_image_hdc_load(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load)
static rt_bool_t rtgui_image_hdc_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load)
{
rt_uint32_t header[5];
struct rtgui_image_hdc* hdc;
struct rtgui_image_hdc *hdc;
hdc = (struct rtgui_image_hdc*) rtgui_malloc(sizeof(struct rtgui_image_hdc));
hdc = (struct rtgui_image_hdc *) rtgui_malloc(sizeof(struct rtgui_image_hdc));
if (hdc == RT_NULL) return RT_FALSE;
hdc->hw_driver = rtgui_graphic_driver_get_default();
if (hdc->hw_driver == RT_NULL) { rtgui_free(hdc); return RT_FALSE; }
if (hdc->hw_driver == RT_NULL)
{
rtgui_free(hdc);
return RT_FALSE;
}
rtgui_filerw_read(file, (char*)&header, 1, sizeof(header));
rtgui_filerw_read(file, (char *)&header, 1, sizeof(header));
/* set image information */
image->w = (rt_uint16_t)header[1]; image->h = (rt_uint16_t)header[2];
image->w = (rt_uint16_t)header[1];
image->h = (rt_uint16_t)header[2];
image->engine = &rtgui_image_hdc_engine;
image->data = hdc;
hdc->filerw = file;
hdc->byte_per_pixel = hdc->hw_driver->bits_per_pixel/8;
hdc->byte_per_pixel = hdc->hw_driver->bits_per_pixel / 8;
hdc->pitch = image->w * hdc->byte_per_pixel;
hdc->pixel_offset = rtgui_filerw_tell(file);
@ -126,13 +131,13 @@ static rt_bool_t rtgui_image_hdc_load(struct rtgui_image* image, struct rtgui_fi
return RT_TRUE;
}
static void rtgui_image_hdc_unload(struct rtgui_image* image)
static void rtgui_image_hdc_unload(struct rtgui_image *image)
{
struct rtgui_image_hdc* hdc;
struct rtgui_image_hdc *hdc;
if (image != RT_NULL)
{
hdc = (struct rtgui_image_hdc*) image->data;
hdc = (struct rtgui_image_hdc *) image->data;
if (hdc->pixels != RT_NULL) rtgui_free(hdc->pixels);
if (hdc->filerw != RT_NULL)
@ -146,17 +151,17 @@ static void rtgui_image_hdc_unload(struct rtgui_image* image)
}
}
static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* dst_rect)
static void rtgui_image_hdc_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *dst_rect)
{
rt_uint16_t y, w, h;
struct rtgui_image_hdc* hdc;
struct rtgui_image_hdc *hdc;
RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);
/* this dc is not visible */
if (rtgui_dc_get_visible(dc) != RT_TRUE) return;
hdc = (struct rtgui_image_hdc*) image->data;
hdc = (struct rtgui_image_hdc *) image->data;
RT_ASSERT(hdc != RT_NULL);
/* the minimum rect */
@ -167,7 +172,7 @@ static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc,
if (hdc->pixels != RT_NULL)
{
rt_uint8_t* ptr;
rt_uint8_t *ptr;
/* get pixel pointer */
ptr = hdc->pixels;
@ -180,7 +185,7 @@ static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc,
}
else
{
rt_uint8_t* ptr;
rt_uint8_t *ptr;
ptr = rtgui_malloc(hdc->pitch);
if (ptr == RT_NULL) return; /* no memory */
@ -200,18 +205,18 @@ static void rtgui_image_hdc_blit(struct rtgui_image* image, struct rtgui_dc* dc,
}
}
static void rtgui_image_hdcmm_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* dst_rect)
static void rtgui_image_hdcmm_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *dst_rect)
{
rt_uint8_t* ptr;
rt_uint8_t *ptr;
rt_uint16_t y, w, h;
struct rtgui_image_hdcmm* hdc;
struct rtgui_image_hdcmm *hdc;
RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);
/* this dc is not visible */
if (rtgui_dc_get_visible(dc) != RT_TRUE) return;
hdc = (struct rtgui_image_hdcmm*) image;
hdc = (struct rtgui_image_hdcmm *) image;
RT_ASSERT(hdc != RT_NULL);
/* the minimum rect */

View File

@ -634,11 +634,13 @@ static UINT tjpgd_out_func(JDEC *jdec, void *bitmap, JRECT *rect)
rt_uint16_t rectWidth; /* Width of source rectangular (bytes) */
rt_uint8_t *src, *dst;
#ifdef RTGUI_DEBUG_TJPGD
/* Put progress indicator */
if (rect->left == 0)
{
rt_kprintf("\r%lu%%", (rect->top << jpeg->scale) * 100UL / jdec->height);
}
#endif
/* Copy the decompressed RGB rectanglar to the frame buffer */
rectWidth = (rect->right - rect->left + 1) * jpeg->byte_per_pixel;
@ -747,7 +749,9 @@ static rt_bool_t rtgui_image_jpeg_check(struct rtgui_filerw *file)
is_JPG = RT_TRUE;
}
#ifdef RTGUI_DEBUG_TJPGD
rt_kprintf("TJPGD: check OK\n");
#endif
}
while (0);
@ -809,7 +813,9 @@ static rt_bool_t rtgui_image_jpeg_load(struct rtgui_image *image, struct rtgui_f
}
break;
}
#ifdef RTGUI_DEBUG_TJPGD
rt_kprintf("TJPGD: prepare OK\n");
#endif
image->w = (rt_uint16_t)jpeg->tjpgd.width >> jpeg->scale;
image->h = (rt_uint16_t)jpeg->tjpgd.height >> jpeg->scale;
@ -838,7 +844,9 @@ static rt_bool_t rtgui_image_jpeg_load(struct rtgui_image *image, struct rtgui_f
rtgui_filerw_close(jpeg->filerw);
jpeg->is_loaded = RT_TRUE;
#ifdef RTGUI_DEBUG_TJPGD
rt_kprintf("TJPGD: load to RAM\n");
#endif
}
res = RT_TRUE;
}
@ -886,7 +894,9 @@ static void rtgui_image_jpeg_unload(struct rtgui_image *image)
}
rt_free(jpeg);
}
#ifdef RTGUI_DEBUG_TJPGD
rt_kprintf("TJPGD: unload\n");
#endif
}
static void rtgui_image_jpeg_blit(struct rtgui_image *image,
@ -938,7 +948,9 @@ static void rtgui_image_jpeg_blit(struct rtgui_image *image,
{
break;
}
#ifdef RTGUI_DEBUG_TJPGD
rt_kprintf("TJPGD: load to display\n");
#endif
}
else
{

View File

@ -11,7 +11,7 @@ struct rtgui_image_png
{
rt_bool_t is_loaded;
struct rtgui_filerw* filerw;
struct rtgui_filerw *filerw;
/* png image information */
png_structp png_ptr;
@ -20,10 +20,10 @@ struct rtgui_image_png
rt_uint8_t *pixels;
};
static rt_bool_t rtgui_image_png_check(struct rtgui_filerw* file);
static rt_bool_t rtgui_image_png_load(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load);
static void rtgui_image_png_unload(struct rtgui_image* image);
static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect);
static rt_bool_t rtgui_image_png_check(struct rtgui_filerw *file);
static rt_bool_t rtgui_image_png_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load);
static void rtgui_image_png_unload(struct rtgui_image *image);
static void rtgui_image_png_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
struct rtgui_image_engine rtgui_image_png_engine =
{
@ -39,19 +39,19 @@ struct rtgui_image_engine rtgui_image_png_engine =
static void rtgui_image_png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
struct rtgui_filerw* filerw = (struct rtgui_filerw*)png_ptr->io_ptr;
struct rtgui_filerw *filerw = (struct rtgui_filerw *)png_ptr->io_ptr;
rtgui_filerw_read(filerw, data, length, 1);
}
static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr, struct rtgui_image_png* png)
static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr, struct rtgui_image_png *png)
{
rt_uint32_t x, y;
png_bytep row;
png_bytep data;
rtgui_color_t *ptr;
row = (png_bytep) rtgui_malloc (png_get_rowbytes(png_ptr, info_ptr));
row = (png_bytep) rtgui_malloc(png_get_rowbytes(png_ptr, info_ptr));
if (row == RT_NULL) return RT_FALSE;
ptr = (rtgui_color_t *)png->pixels;
@ -66,7 +66,7 @@ static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr
{
data = &(row[x * 3]);
ptr[x+y*info_ptr->width] = RTGUI_RGB(data[0], data[1], data[2]);
ptr[x + y * info_ptr->width] = RTGUI_RGB(data[0], data[1], data[2]);
}
}
break;
@ -79,7 +79,7 @@ static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr
{
data = &(row[x * 4]);
ptr[x+y*info_ptr->width] = RTGUI_ARGB((255 - data[3]), data[0], data[1], data[2]);
ptr[x + y * info_ptr->width] = RTGUI_ARGB((255 - data[3]), data[0], data[1], data[2]);
}
}
@ -108,13 +108,13 @@ static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr
return RT_TRUE;
}
static rt_bool_t rtgui_image_png_check(struct rtgui_filerw* file)
static rt_bool_t rtgui_image_png_check(struct rtgui_filerw *file)
{
int start;
rt_bool_t is_PNG;
rt_uint8_t magic[4];
if ( !file ) return 0;
if (!file) return 0;
start = rtgui_filerw_tell(file);
@ -122,12 +122,12 @@ static rt_bool_t rtgui_image_png_check(struct rtgui_filerw* file)
rtgui_filerw_seek(file, 0, SEEK_SET);
is_PNG = RT_FALSE;
if ( rtgui_filerw_read(file, magic, 1, sizeof(magic)) == sizeof(magic) )
if (rtgui_filerw_read(file, magic, 1, sizeof(magic)) == sizeof(magic))
{
if ( magic[0] == 0x89 &&
if (magic[0] == 0x89 &&
magic[1] == 'P' &&
magic[2] == 'N' &&
magic[3] == 'G' )
magic[3] == 'G')
{
is_PNG = RT_TRUE;
}
@ -137,16 +137,16 @@ static rt_bool_t rtgui_image_png_check(struct rtgui_filerw* file)
return(is_PNG);
}
static rt_bool_t rtgui_image_png_load(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load)
static rt_bool_t rtgui_image_png_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load)
{
png_uint_32 width;
png_uint_32 height;
int bit_depth;
int color_type;
double gamma;
struct rtgui_image_png* png;
struct rtgui_image_png *png;
png = (struct rtgui_image_png*) rtgui_malloc(sizeof(struct rtgui_image_png));
png = (struct rtgui_image_png *) rtgui_malloc(sizeof(struct rtgui_image_png));
png->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png->png_ptr == RT_NULL)
{
@ -163,14 +163,15 @@ static rt_bool_t rtgui_image_png_load(struct rtgui_image* image, struct rtgui_fi
}
png->filerw = file;
png_set_read_fn (png->png_ptr, png->filerw, rtgui_image_png_read_data);
png_set_read_fn(png->png_ptr, png->filerw, rtgui_image_png_read_data);
png_read_info(png->png_ptr, png->info_ptr);
png_get_IHDR(png->png_ptr, png->info_ptr, &width, &height, &bit_depth,
&color_type, NULL, NULL, NULL);
/* set image information */
image->w = width; image->h = height;
image->w = width;
image->h = height;
image->engine = &rtgui_image_png_engine;
image->data = png;
@ -221,13 +222,13 @@ static rt_bool_t rtgui_image_png_load(struct rtgui_image* image, struct rtgui_fi
return RT_TRUE;
}
static void rtgui_image_png_unload(struct rtgui_image* image)
static void rtgui_image_png_unload(struct rtgui_image *image)
{
struct rtgui_image_png* png;
struct rtgui_image_png *png;
if (image != RT_NULL)
{
png = (struct rtgui_image_png*) image->data;
png = (struct rtgui_image_png *) image->data;
png_read_end(png->png_ptr, RT_NULL);
@ -242,12 +243,12 @@ static void rtgui_image_png_unload(struct rtgui_image* image)
}
}
static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect)
static void rtgui_image_png_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect)
{
struct rtgui_graphic_driver* hwdev = rtgui_graphic_get_device();
struct rtgui_graphic_driver *hwdev = rtgui_graphic_get_device();
rt_uint16_t x, y, w, h;
rtgui_color_t* ptr;
struct rtgui_image_png* png;
rtgui_color_t *ptr;
struct rtgui_image_png *png;
int fg_maxsample;
int ialpha;
float alpha;
@ -258,7 +259,7 @@ static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc,
RT_ASSERT(image != RT_NULL && dc != RT_NULL && rect != RT_NULL);
RT_ASSERT(image->data != RT_NULL);
png = (struct rtgui_image_png*) image->data;
png = (struct rtgui_image_png *) image->data;
if (image->w < rtgui_rect_width(*rect)) w = image->w;
else w = rtgui_rect_width(*rect);
@ -269,7 +270,7 @@ static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc,
if (png->pixels != RT_NULL)
{
ptr = (rtgui_color_t*)png->pixels;
ptr = (rtgui_color_t *)png->pixels;
bgcolor = rtgui_color_from_565(RTGUI_DC_BC(dc));
bc[0] = RTGUI_RGB_R(bgcolor);
bc[1] = RTGUI_RGB_G(bgcolor);
@ -281,7 +282,7 @@ static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc,
{
c = *ptr;
ialpha = RTGUI_RGB_A(c);
if(ialpha == 0)
if (ialpha == 0)
{
/*
* Foreground image is transparent hear.
@ -297,7 +298,8 @@ static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc,
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1, c);
}
else
{ /* output = alpha * foreground + (1-alpha) * background */
{
/* output = alpha * foreground + (1-alpha) * background */
/*
* Compositing is necessary.
* Get floating-point alpha and its complement.
@ -309,9 +311,9 @@ static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc,
fc[2] = RTGUI_RGB_B(c);
alpha = (float) ialpha / fg_maxsample;
color = RTGUI_RGB( (rt_uint8_t)(fc[0]*alpha + bc[0]*(1-alpha)),
(rt_uint8_t)(fc[1]*alpha + bc[1]*(1-alpha)),
(rt_uint8_t)(fc[2]*alpha + bc[2]*(1-alpha)));
color = RTGUI_RGB((rt_uint8_t)(fc[0] * alpha + bc[0] * (1 - alpha)),
(rt_uint8_t)(fc[1] * alpha + bc[1] * (1 - alpha)),
(rt_uint8_t)(fc[2] * alpha + bc[2] * (1 - alpha)));
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1, color);
}
/* move to next color buffer */
@ -324,7 +326,7 @@ static void rtgui_image_png_blit(struct rtgui_image* image, struct rtgui_dc* dc,
png_bytep row;
png_bytep data;
row = (png_bytep) rtgui_malloc (png_get_rowbytes(png->png_ptr, png->info_ptr));
row = (png_bytep) rtgui_malloc(png_get_rowbytes(png->png_ptr, png->info_ptr));
if (row == RT_NULL) return ;
switch (png->info_ptr->color_type)

View File

@ -21,10 +21,10 @@
#ifdef RTGUI_IMAGE_XPM
#define XPM_MAGIC_LEN 9
static rt_bool_t rtgui_image_xpm_check(struct rtgui_filerw * file);
static rt_bool_t rtgui_image_xpm_load(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load);
static void rtgui_image_xpm_unload(struct rtgui_image* image);
static void rtgui_image_xpm_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect);
static rt_bool_t rtgui_image_xpm_check(struct rtgui_filerw *file);
static rt_bool_t rtgui_image_xpm_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load);
static void rtgui_image_xpm_unload(struct rtgui_image *image);
static void rtgui_image_xpm_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
struct rtgui_image_engine rtgui_image_xpm_engine =
{
@ -46,7 +46,8 @@ struct rgb_item
int b;
};
const struct rgb_item rgbRecord[234] = {
const struct rgb_item rgbRecord[234] =
{
{"AliceBlue", 240, 248, 255},
{"AntiqueWhite", 250, 235, 215},
{"Aquamarine", 50, 191, 193},
@ -307,7 +308,7 @@ static int hash_key(const char *key, int cpp, int size)
int hash;
hash = 0;
while ( cpp-- > 0 )
while (cpp-- > 0)
{
hash = hash * 33 + *key++;
}
@ -322,20 +323,20 @@ static struct color_hash *create_colorhash(int maxnum)
/* we know how many entries we need, so we can allocate
everything here */
hash = rtgui_malloc(sizeof *hash);
if(!hash) return RT_NULL;
if (!hash) return RT_NULL;
/* use power-of-2 sized hash table for decoding speed */
for(s = STARTING_HASH_SIZE; s < maxnum; s <<= 1) ;
for (s = STARTING_HASH_SIZE; s < maxnum; s <<= 1) ;
hash->size = s;
hash->maxnum = maxnum;
bytes = hash->size * sizeof(struct hash_entry **);
bytes = hash->size *sizeof(struct hash_entry **);
hash->entries = RT_NULL; /* in case rt_malloc fails */
hash->table = rtgui_malloc(bytes);
if(!hash->table) return RT_NULL;
if (!hash->table) return RT_NULL;
rt_memset(hash->table, 0, bytes);
hash->entries = rtgui_malloc(maxnum * sizeof(struct hash_entry));
if(!hash->entries) return RT_NULL;
hash->entries = rtgui_malloc(maxnum *sizeof(struct hash_entry));
if (!hash->entries) return RT_NULL;
hash->next_free = hash->entries;
return hash;
@ -356,12 +357,12 @@ static int add_colorhash(struct color_hash *hash,
return 1;
}
static void get_colorhash(struct color_hash *hash, const char *key, int cpp, rtgui_color_t* c)
static void get_colorhash(struct color_hash *hash, const char *key, int cpp, rtgui_color_t *c)
{
struct hash_entry *entry = hash->table[hash_key(key, cpp, hash->size)];
while(entry)
while (entry)
{
if(rt_memcmp(key, entry->key, cpp) == 0)
if (rt_memcmp(key, entry->key, cpp) == 0)
{
*c = entry->color;
@ -376,7 +377,7 @@ static void get_colorhash(struct color_hash *hash, const char *key, int cpp, rtg
static void free_colorhash(struct color_hash *hash)
{
if(hash && hash->table)
if (hash && hash->table)
{
rtgui_free(hash->table);
rtgui_free(hash->entries);
@ -385,18 +386,22 @@ static void free_colorhash(struct color_hash *hash)
}
#if defined(_MSC_VER) || defined(__CC_ARM)
int strcasecmp( const char* s1, const char* s2 )
int strcasecmp(const char *s1, const char *s2)
{
register unsigned int x2;
register unsigned int x1;
while (1) {
x2 = *s2 - 'A'; if (x2 < 26u) x2 += 32;
x1 = *s1 - 'A'; if (x1 < 26u) x1 += 32;
s1++; s2++;
while (1)
{
x2 = *s2 - 'A';
if (x2 < 26u) x2 += 32;
x1 = *s1 - 'A';
if (x1 < 26u) x1 += 32;
s1++;
s2++;
if (x2 != x1)
break;
if (x1 == (unsigned int)-'A')
if (x1 == (unsigned int) - 'A')
break;
}
@ -404,7 +409,7 @@ int strcasecmp( const char* s1, const char* s2 )
}
#endif
static int hex2int (char *str)
static int hex2int(char *str)
{
int i = 0;
int r = 0;
@ -427,7 +432,7 @@ void rtgui_image_xpm_init()
rtgui_image_register_engine(&rtgui_image_xpm_engine);
}
static rt_bool_t rtgui_image_xpm_check(struct rtgui_filerw* file)
static rt_bool_t rtgui_image_xpm_check(struct rtgui_filerw *file)
{
#if 0
rt_uint8_t buffer[XPM_MAGIC_LEN];
@ -454,7 +459,7 @@ static rt_bool_t rtgui_image_xpm_check(struct rtgui_filerw* file)
#endif
}
static rt_bool_t rtgui_image_xpm_load(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load)
static rt_bool_t rtgui_image_xpm_load(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load)
{
const char **xpm;
const char *buf;
@ -550,11 +555,11 @@ color_none:
}
/* build rgb pixel data */
image->data = (rt_uint8_t*) rtgui_malloc(image->w * image->h * sizeof(rtgui_color_t));
image->data = (rt_uint8_t *) rtgui_malloc(image->w * image->h * sizeof(rtgui_color_t));
memset(image->data, 0, image->w * image->h * sizeof(rtgui_color_t));
{
rtgui_color_t *ptr = (rtgui_color_t*) image->data;
rtgui_color_t *ptr = (rtgui_color_t *) image->data;
for (h = 0; h < image->h; h++)
{
@ -574,7 +579,7 @@ color_none:
return RT_TRUE;
}
static void rtgui_image_xpm_unload(struct rtgui_image* image)
static void rtgui_image_xpm_unload(struct rtgui_image *image)
{
if (image != RT_NULL)
{
@ -584,15 +589,15 @@ static void rtgui_image_xpm_unload(struct rtgui_image* image)
}
}
static void rtgui_image_xpm_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect)
static void rtgui_image_xpm_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect)
{
rt_uint16_t x, y;
rtgui_color_t* ptr;
rtgui_color_t *ptr;
RT_ASSERT(image != RT_NULL && dc != RT_NULL && rect != RT_NULL);
RT_ASSERT(image->data != RT_NULL);
ptr = (rtgui_color_t*) image->data;
ptr = (rtgui_color_t *) image->data;
/* draw each point within dc */
for (y = 0; y < image->h; y ++)

View File

@ -14,7 +14,7 @@ static void _pixel_mono_set_pixel(rtgui_color_t *c, int x, int y)
rt_uint8_t pixel;
pixel = rtgui_color_to_mono(*c);
gfx_device_ops->set_pixel((char*)&pixel, x, y);
gfx_device_ops->set_pixel((char *)&pixel, x, y);
}
static void _pixel_rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
@ -22,7 +22,7 @@ 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);
gfx_device_ops->set_pixel((char *)&pixel, x, y);
}
static void _pixel_rgb565_set_pixel(rtgui_color_t *c, int x, int y)
@ -30,7 +30,7 @@ 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);
gfx_device_ops->set_pixel((char *)&pixel, x, y);
}
static void _pixel_rgb888_set_pixel(rtgui_color_t *c, int x, int y)
@ -38,14 +38,14 @@ 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);
gfx_device_ops->set_pixel((char *)&pixel, x, y);
}
static void _pixel_mono_get_pixel(rtgui_color_t *c, int x, int y)
{
rt_uint8_t pixel;
gfx_device_ops->get_pixel((char*)&pixel, x, y);
gfx_device_ops->get_pixel((char *)&pixel, x, y);
*c = rtgui_color_from_mono(pixel);
}
@ -53,7 +53,7 @@ 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);
gfx_device_ops->get_pixel((char *)&pixel, x, y);
*c = rtgui_color_from_565p(pixel);
}
@ -61,7 +61,7 @@ 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);
gfx_device_ops->get_pixel((char *)&pixel, x, y);
*c = rtgui_color_from_565(pixel);
}
@ -69,7 +69,7 @@ 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);
gfx_device_ops->get_pixel((char *)&pixel, x, y);
*c = rtgui_color_from_888(pixel);
}
@ -78,7 +78,7 @@ static void _pixel_mono_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
rt_uint8_t pixel;
pixel = rtgui_color_to_mono(*c);
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
gfx_device_ops->draw_hline((char *)&pixel, x1, x2, y);
}
static void _pixel_rgb565p_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
@ -86,7 +86,7 @@ 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);
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)
@ -94,7 +94,7 @@ 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);
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)
@ -102,7 +102,7 @@ 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);
gfx_device_ops->draw_hline((char *)&pixel, x1, x2, y);
}
static void _pixel_mono_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
@ -110,7 +110,7 @@ static void _pixel_mono_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
rt_uint8_t pixel;
pixel = rtgui_color_to_mono(*c);
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
gfx_device_ops->draw_vline((char *)&pixel, x, y1, y2);
}
static void _pixel_rgb565p_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
@ -118,7 +118,7 @@ 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);
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)
@ -126,7 +126,7 @@ 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);
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)
@ -134,15 +134,15 @@ 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);
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));
gfx_device_ops->blit_line((char *)pixels, x1, y, (x2 - x1));
else
gfx_device_ops->blit_line((char*)pixels, x2, y, (x1 - x2));
gfx_device_ops->blit_line((char *)pixels, x2, y, (x1 - x2));
}
/* pixel device */

View File

@ -187,31 +187,31 @@ void rtgui_region_init_with_extents(rtgui_region_t *region, const rtgui_rect_t *
region->data = RT_NULL;
}
void rtgui_region_fini (rtgui_region_t *region)
void rtgui_region_fini(rtgui_region_t *region)
{
good (region);
freeData (region);
good(region);
freeData(region);
}
int rtgui_region_num_rects (rtgui_region_t *region)
int rtgui_region_num_rects(rtgui_region_t *region)
{
return PIXREGION_NUM_RECTS (region);
return PIXREGION_NUM_RECTS(region);
}
rtgui_rect_t *rtgui_region_rects (rtgui_region_t *region)
rtgui_rect_t *rtgui_region_rects(rtgui_region_t *region)
{
return PIXREGION_RECTS (region);
return PIXREGION_RECTS(region);
}
static rtgui_region_status_t rtgui_break (rtgui_region_t *region)
static rtgui_region_status_t rtgui_break(rtgui_region_t *region)
{
freeData (region);
freeData(region);
region->extents = rtgui_empty_rect;
region->data = &rtgui_brokendata;
return RTGUI_REGION_STATUS_FAILURE;
}
static rtgui_region_status_t rtgui_rect_alloc(rtgui_region_t * region, int n)
static rtgui_region_status_t rtgui_rect_alloc(rtgui_region_t *region, int n)
{
rtgui_region_data_t *data;
@ -219,14 +219,14 @@ static rtgui_region_status_t rtgui_rect_alloc(rtgui_region_t * region, int n)
{
n++;
region->data = allocData(n);
if (!region->data) return rtgui_break (region);
if (!region->data) return rtgui_break(region);
region->data->numRects = 1;
*PIXREGION_BOXPTR(region) = region->extents;
}
else if (!region->data->size)
{
region->data = allocData(n);
if (!region->data) return rtgui_break (region);
if (!region->data) return rtgui_break(region);
region->data->numRects = 0;
}
else
@ -239,7 +239,7 @@ static rtgui_region_status_t rtgui_rect_alloc(rtgui_region_t * region, int n)
}
n += region->data->numRects;
data = (rtgui_region_data_t *)rt_realloc(region->data, PIXREGION_SZOF(n));
if (!data) return rtgui_break (region);
if (!data) return rtgui_break(region);
region->data = data;
}
region->data->size = n;
@ -263,11 +263,11 @@ rtgui_region_status_t rtgui_region_copy(rtgui_region_t *dst, rtgui_region_t *src
{
freeData(dst);
dst->data = allocData(src->data->numRects);
if (!dst->data) return rtgui_break (dst);
if (!dst->data) return rtgui_break(dst);
dst->data->size = src->data->numRects;
}
dst->data->numRects = src->data->numRects;
rt_memmove((char *)PIXREGION_BOXPTR(dst),(char *)PIXREGION_BOXPTR(src),
rt_memmove((char *)PIXREGION_BOXPTR(dst), (char *)PIXREGION_BOXPTR(src),
dst->data->numRects * sizeof(rtgui_rect_t));
return RTGUI_REGION_STATUS_SUCCESS;
}
@ -295,13 +295,13 @@ rtgui_region_status_t rtgui_region_copy(rtgui_region_t *dst, rtgui_region_t *src
*-----------------------------------------------------------------------
*/
rt_inline int
rtgui_coalesce (
rtgui_coalesce(
rtgui_region_t *region, /* Region to coalesce */
int prevStart, /* Index of start of previous band */
int curStart) /* Index of start of current band */
{
rtgui_rect_t * pPrevBox; /* Current box in previous band */
rtgui_rect_t * pCurBox; /* Current box in current band */
rtgui_rect_t *pPrevBox; /* Current box in previous band */
rtgui_rect_t *pCurBox; /* Current box in current band */
int numRects; /* Number rectangles in both bands */
int y2; /* Bottom of current band */
/*
@ -383,14 +383,14 @@ rtgui_coalesce (
*/
rt_inline rtgui_region_status_t
rtgui_region_appendNonO (
rtgui_region_appendNonO(
rtgui_region_t *region,
rtgui_rect_t *r,
rtgui_rect_t *rEnd,
int y1,
int y2)
{
rtgui_rect_t * pNextRect;
rtgui_rect_t *pNextRect;
int newRects;
newRects = rEnd - r;
@ -485,19 +485,19 @@ rtgui_op(
/* in region 2 ? */
int *pOverlap)
{
rtgui_rect_t * r1; /* Pointer into first region */
rtgui_rect_t * r2; /* Pointer into 2d region */
rtgui_rect_t * r1End; /* End of 1st region */
rtgui_rect_t * r2End; /* End of 2d region */
rtgui_rect_t *r1; /* Pointer into first region */
rtgui_rect_t *r2; /* Pointer into 2d region */
rtgui_rect_t *r1End; /* End of 1st region */
rtgui_rect_t *r2End; /* End of 2d region */
short ybot; /* Bottom of intersection */
short ytop; /* Top of intersection */
rtgui_region_data_t * oldData; /* Old data for newReg */
rtgui_region_data_t *oldData; /* Old data for newReg */
int prevBand; /* Index of start of
* previous band in newReg */
int curBand; /* Index of start of current
* band in newReg */
rtgui_rect_t * r1BandEnd; /* End of current band in r1 */
rtgui_rect_t * r2BandEnd; /* End of current band in r2 */
rtgui_rect_t *r1BandEnd; /* End of current band in r1 */
rtgui_rect_t *r2BandEnd; /* End of current band in r2 */
short top; /* Top of non-overlapping band */
short bot; /* Bottom of non-overlapping band*/
int r1y1; /* Temps for r1->y1 and r2->y1 */
@ -508,8 +508,8 @@ rtgui_op(
/*
* Break any region computed from a broken region
*/
if (PIXREGION_NAR (reg1) || PIXREGION_NAR(reg2))
return rtgui_break (newReg);
if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2))
return rtgui_break(newReg);
/*
* Initialization:
@ -724,7 +724,7 @@ rtgui_op(
*-----------------------------------------------------------------------
*/
static void
rtgui_set_extents (rtgui_region_t *region)
rtgui_set_extents(rtgui_region_t *region)
{
rtgui_rect_t *box, *boxEnd;
@ -783,7 +783,7 @@ rtgui_set_extents (rtgui_region_t *region)
*/
/*ARGSUSED*/
static rtgui_region_status_t
rtgui_region_intersectO (
rtgui_region_intersectO(
rtgui_region_t *region,
rtgui_rect_t *r1,
rtgui_rect_t *r1End,
@ -795,7 +795,7 @@ rtgui_region_intersectO (
{
int x1;
int x2;
rtgui_rect_t * pNextRect;
rtgui_rect_t *pNextRect;
pNextRect = PIXREGION_TOP(region);
@ -945,7 +945,7 @@ rtgui_region_intersect_rect(rtgui_region_t *newReg,
*-----------------------------------------------------------------------
*/
static rtgui_region_status_t
rtgui_region_unionO (
rtgui_region_unionO(
rtgui_region_t *region,
rtgui_rect_t *r1,
rtgui_rect_t *r1End,
@ -955,11 +955,11 @@ rtgui_region_unionO (
short y2,
int *pOverlap)
{
rtgui_rect_t * pNextRect;
rtgui_rect_t *pNextRect;
int x1; /* left and right side of current union */
int x2;
RT_ASSERT (y1 < y2);
RT_ASSERT(y1 < y2);
RT_ASSERT(r1 != r1End && r2 != r2End);
pNextRect = PIXREGION_TOP(region);
@ -1008,7 +1008,7 @@ rtgui_region_unionO (
/* Convenience function for perforRTGUI_MINg union of region with a single rectangle */
rtgui_region_status_t
rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect_t* rect)
rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect_t *rect)
{
rtgui_region_t region;
@ -1018,7 +1018,7 @@ rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect
region.extents.x2 = rect->x2;
region.extents.y2 = rect->y2;
return rtgui_region_union (dest, source, &region);
return rtgui_region_union(dest, source, &region);
}
rtgui_region_status_t
@ -1045,7 +1045,7 @@ rtgui_region_union(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t
*/
if (PIXREGION_NIL(reg1))
{
if (PIXREGION_NAR(reg1)) return rtgui_break (newReg);
if (PIXREGION_NAR(reg1)) return rtgui_break(newReg);
if (newReg != reg2)
return rtgui_region_copy(newReg, reg2);
return RTGUI_REGION_STATUS_SUCCESS;
@ -1056,7 +1056,7 @@ rtgui_region_union(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t
*/
if (PIXREGION_NIL(reg2))
{
if (PIXREGION_NAR(reg2)) return rtgui_break (newReg);
if (PIXREGION_NAR(reg2)) return rtgui_break(newReg);
if (newReg != reg1)
return rtgui_region_copy(newReg, reg1);
return RTGUI_REGION_STATUS_SUCCESS;
@ -1122,7 +1122,7 @@ rtgui_region_append(rtgui_region_t *dstrgn,
rtgui_rect_t *new, *old;
int prepend;
if (PIXREGION_NAR(rgn)) return rtgui_break (dstrgn);
if (PIXREGION_NAR(rgn)) return rtgui_break(dstrgn);
if (!rgn->data && (dstrgn->data == &rtgui_region_emptydata))
{
@ -1184,7 +1184,7 @@ rtgui_region_append(rtgui_region_t *dstrgn,
if (dnumRects == 1)
*new = *PIXREGION_BOXPTR(dstrgn);
else
rt_memmove((char *)new,(char *)PIXREGION_BOXPTR(dstrgn),
rt_memmove((char *)new, (char *)PIXREGION_BOXPTR(dstrgn),
dnumRects * sizeof(rtgui_rect_t));
new = PIXREGION_BOXPTR(dstrgn);
}
@ -1259,8 +1259,8 @@ static void QuickSortRects(rtgui_rect_t rects[], int numRects)
ExchangeRects(0, j);
/* Recurse */
if (numRects-j-1 > 1)
QuickSortRects(&rects[j+1], numRects-j-1);
if (numRects - j - 1 > 1)
QuickSortRects(&rects[j + 1], numRects - j - 1);
numRects = j;
}
while (numRects > 1);
@ -1297,7 +1297,7 @@ static void QuickSortRects(rtgui_rect_t rects[], int numRects)
*
*-----------------------------------------------------------------------
*/
rtgui_region_status_t rtgui_region_validate(rtgui_region_t * badreg,
rtgui_region_status_t rtgui_region_validate(rtgui_region_t *badreg,
int *pOverlap)
{
/* Descriptor for regions under construction in Step 2. */
@ -1316,10 +1316,10 @@ rtgui_region_status_t rtgui_region_validate(rtgui_region_t * badreg,
int i; /* Index into rects */
int j; /* Index into ri */
RegionInfo *rit; /* &ri[j] */
rtgui_region_t * reg; /* ri[j].reg */
rtgui_rect_t * box; /* Current box in rects */
rtgui_rect_t * riBox; /* Last box in ri[j].reg */
rtgui_region_t * hreg; /* ri[j_half].reg */
rtgui_region_t *reg; /* ri[j].reg */
rtgui_rect_t *box; /* Current box in rects */
rtgui_rect_t *riBox; /* Last box in ri[j].reg */
rtgui_region_t *hreg; /* ri[j_half].reg */
rtgui_region_status_t ret = RTGUI_REGION_STATUS_SUCCESS;
*pOverlap = RTGUI_REGION_STATUS_FAILURE;
@ -1359,7 +1359,7 @@ rtgui_region_status_t rtgui_region_validate(rtgui_region_t * badreg,
/* Set up the first region to be the first rectangle in badreg */
/* Note that step 2 code will never overflow the ri[0].reg rects array */
ri = (RegionInfo *) rtgui_malloc(4 * sizeof(RegionInfo));
if (!ri) return rtgui_break (badreg);
if (!ri) return rtgui_break(badreg);
sizeRI = 4;
numRI = 1;
ri[0].prevBand = 0;
@ -1432,7 +1432,7 @@ rtgui_region_status_t rtgui_region_validate(rtgui_region_t * badreg,
rit->curBand = 0;
rit->reg.extents = *box;
rit->reg.data = (rtgui_region_data_t *)RT_NULL;
if (!rtgui_rect_alloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
if (!rtgui_rect_alloc(&rit->reg, (i + numRI) / numRI)) /* MUST force allocation */
goto bail;
NextRect:
;
@ -1458,11 +1458,11 @@ NextRect:
/* Step 3: Union all regions into a single region */
while (numRI > 1)
{
int half = numRI/2;
int half = numRI / 2;
for (j = numRI & 1; j < (half + (numRI & 1)); j++)
{
reg = &ri[j].reg;
hreg = &ri[j+half].reg;
hreg = &ri[j + half].reg;
if (!rtgui_op(reg, reg, hreg, rtgui_region_unionO, RTGUI_REGION_STATUS_SUCCESS, RTGUI_REGION_STATUS_SUCCESS, pOverlap))
ret = RTGUI_REGION_STATUS_FAILURE;
if (hreg->extents.x1 < reg->extents.x1)
@ -1485,9 +1485,9 @@ NextRect:
bail:
for (i = 0; i < numRI; i++)
freeData(&ri[i].reg);
rtgui_free (ri);
rtgui_free(ri);
return rtgui_break (badreg);
return rtgui_break(badreg);
}
/*======================================================================
@ -1510,7 +1510,7 @@ bail:
*/
/*ARGSUSED*/
static rtgui_region_status_t
rtgui_region_subtractO (
rtgui_region_subtractO(
rtgui_region_t *region,
rtgui_rect_t *r1,
rtgui_rect_t *r1End,
@ -1520,12 +1520,12 @@ rtgui_region_subtractO (
short y2,
int *pOverlap)
{
rtgui_rect_t * pNextRect;
rtgui_rect_t *pNextRect;
int x1;
x1 = r1->x1;
RT_ASSERT(y1<y2);
RT_ASSERT(y1 < y2);
RT_ASSERT(r1 != r1End && r2 != r2End);
pNextRect = PIXREGION_TOP(region);
@ -1570,7 +1570,7 @@ rtgui_region_subtractO (
* Left part of subtrahend covers part of minuend: add uncovered
* part of minuend to region and skip to next subtrahend.
*/
RT_ASSERT(x1<r2->x1);
RT_ASSERT(x1 < r2->x1);
NEWRECT(region, pNextRect, x1, y1, r2->x1, y2);
x1 = r2->x2;
@ -1610,7 +1610,7 @@ rtgui_region_subtractO (
*/
while (r1 != r1End)
{
RT_ASSERT(x1<r1->x2);
RT_ASSERT(x1 < r1->x2);
NEWRECT(region, pNextRect, x1, y1, r1->x2, y2);
r1++;
if (r1 != r1End)
@ -1647,7 +1647,7 @@ rtgui_region_subtract(rtgui_region_t *regD,
if (PIXREGION_NIL(regM) || PIXREGION_NIL(regS) ||
!EXTENTCHECK(&regM->extents, &regS->extents))
{
if (PIXREGION_NAR (regS)) return rtgui_break (regD);
if (PIXREGION_NAR(regS)) return rtgui_break(regD);
return rtgui_region_copy(regD, regM);
}
else if (regM == regS)
@ -1678,7 +1678,7 @@ rtgui_region_subtract(rtgui_region_t *regD,
}
rtgui_region_status_t
rtgui_region_subtract_rect (rtgui_region_t *regD, rtgui_region_t *regM, rtgui_rect_t* rect)
rtgui_region_subtract_rect(rtgui_region_t *regD, rtgui_region_t *regM, rtgui_rect_t *rect)
{
rtgui_region_t region;
@ -1724,7 +1724,7 @@ rtgui_region_inverse(rtgui_region_t *newReg, /* Destination region */
/* check for trivial rejects */
if (PIXREGION_NIL(reg1) || !EXTENTCHECK(invRect, &reg1->extents))
{
if (PIXREGION_NAR(reg1)) return rtgui_break (newReg);
if (PIXREGION_NAR(reg1)) return rtgui_break(newReg);
newReg->extents = *invRect;
freeData(newReg);
newReg->data = (rtgui_region_data_t *)RT_NULL;
@ -1772,8 +1772,8 @@ int rtgui_region_contains_rectangle(rtgui_region_t *region, rtgui_rect_t *prect)
{
int x;
int y;
rtgui_rect_t * pbox;
rtgui_rect_t * pboxEnd;
rtgui_rect_t *pbox;
rtgui_rect_t *pboxEnd;
int partIn, partOut;
int numRects;
@ -1860,18 +1860,18 @@ int rtgui_region_contains_rectangle(rtgui_region_t *region, rtgui_rect_t *prect)
/* rtgui_region_translate (region, x, y)
translates in place
*/
void rtgui_region_translate (rtgui_region_t *region, int x, int y)
void rtgui_region_translate(rtgui_region_t *region, int x, int y)
{
int x1, x2, y1, y2;
int nbox;
rtgui_rect_t * pbox;
rtgui_rect_t *pbox;
good(region);
region->extents.x1 = x1 = region->extents.x1 + x;
region->extents.y1 = y1 = region->extents.y1 + y;
region->extents.x2 = x2 = region->extents.x2 + x;
region->extents.y2 = y2 = region->extents.y2 + y;
if (((x1 - RTGUI_SHRT_MIN)|(y1 - RTGUI_SHRT_MIN)|(RTGUI_SHRT_MAX - x2)|(RTGUI_SHRT_MAX - y2)) >= 0)
if (((x1 - RTGUI_SHRT_MIN) | (y1 - RTGUI_SHRT_MIN) | (RTGUI_SHRT_MAX - x2) | (RTGUI_SHRT_MAX - y2)) >= 0)
{
nbox = region->data->numRects;
if (region->data && nbox)
@ -1886,7 +1886,7 @@ void rtgui_region_translate (rtgui_region_t *region, int x, int y)
}
return;
}
if (((x2 - RTGUI_SHRT_MIN)|(y2 - RTGUI_SHRT_MIN)|(RTGUI_SHRT_MAX - x1)|(RTGUI_SHRT_MAX - y1)) <= 0)
if (((x2 - RTGUI_SHRT_MIN) | (y2 - RTGUI_SHRT_MIN) | (RTGUI_SHRT_MAX - x1) | (RTGUI_SHRT_MAX - y1)) <= 0)
{
region->extents.x2 = region->extents.x1;
region->extents.y2 = region->extents.y1;
@ -1906,7 +1906,7 @@ void rtgui_region_translate (rtgui_region_t *region, int x, int y)
nbox = region->data->numRects;
if (region->data && nbox)
{
rtgui_rect_t * pboxout;
rtgui_rect_t *pboxout;
for (pboxout = pbox = PIXREGION_BOXPTR(region); nbox--; pbox++)
{
@ -1914,8 +1914,8 @@ void rtgui_region_translate (rtgui_region_t *region, int x, int y)
pboxout->y1 = y1 = pbox->y1 + y;
pboxout->x2 = x2 = pbox->x2 + x;
pboxout->y2 = y2 = pbox->y2 + y;
if (((x2 - RTGUI_SHRT_MIN)|(y2 - RTGUI_SHRT_MIN)|
(RTGUI_SHRT_MAX - x1)|(RTGUI_SHRT_MAX - y1)) <= 0)
if (((x2 - RTGUI_SHRT_MIN) | (y2 - RTGUI_SHRT_MIN) |
(RTGUI_SHRT_MAX - x1) | (RTGUI_SHRT_MAX - y1)) <= 0)
{
region->data->numRects--;
continue;
@ -1944,7 +1944,7 @@ void rtgui_region_translate (rtgui_region_t *region, int x, int y)
}
}
void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t* rect)
void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t *rect)
{
good(region);
freeData(region);
@ -1953,9 +1953,9 @@ void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t* rect)
}
/* box is "return" value */
int rtgui_region_contains_point(rtgui_region_t * region,
int rtgui_region_contains_point(rtgui_region_t *region,
int x, int y,
rtgui_rect_t * box)
rtgui_rect_t *box)
{
rtgui_rect_t *pbox, *pboxEnd;
int numRects;
@ -1988,14 +1988,14 @@ int rtgui_region_contains_point(rtgui_region_t * region,
return -RT_ERROR;
}
int rtgui_region_not_empty(rtgui_region_t * region)
int rtgui_region_not_empty(rtgui_region_t *region)
{
good(region);
return(!PIXREGION_NIL(region));
}
void rtgui_region_empty(rtgui_region_t * region)
void rtgui_region_empty(rtgui_region_t *region)
{
good(region);
freeData(region);
@ -2004,7 +2004,7 @@ void rtgui_region_empty(rtgui_region_t * region)
region->data = &rtgui_region_emptydata;
}
rtgui_rect_t *rtgui_region_extents(rtgui_region_t * region)
rtgui_rect_t *rtgui_region_extents(rtgui_region_t *region)
{
good(region);
return(&region->extents);
@ -2046,7 +2046,8 @@ static void QuickSortSpans(
yprev = spans[0].y;
i = 1;
do
{ /* while i != numSpans */
{
/* while i != numSpans */
y = spans[i].y;
if (yprev > y)
{
@ -2060,8 +2061,8 @@ static void QuickSortSpans(
tw = widths[i];
for (k = i; k != j; k--)
{
spans[k] = spans[k-1];
widths[k] = widths[k-1];
spans[k] = spans[k - 1];
widths[k] = widths[k - 1];
}
spans[j] = tpt;
widths[j] = tw;
@ -2077,7 +2078,7 @@ static void QuickSortSpans(
/* Choose partition element, stick in location 0 */
m = numSpans / 2;
if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1);
if (spans[m].y > spans[numSpans - 1].y) ExchangeSpans(m, numSpans - 1);
if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
y = spans[0].y;
@ -2109,18 +2110,18 @@ static void QuickSortSpans(
ExchangeSpans(0, j);
/* Recurse */
if (numSpans-j-1 > 1)
QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1);
if (numSpans - j - 1 > 1)
QuickSortSpans(&spans[j + 1], &widths[j + 1], numSpans - j - 1);
numSpans = j;
}
while (numSpans > 1);
}
void rtgui_region_dump(rtgui_region_t* region)
void rtgui_region_dump(rtgui_region_t *region)
{
int num;
int i;
rtgui_rect_t * rects;
rtgui_rect_t *rects;
num = PIXREGION_NUM_RECTS(region);
rects = PIXREGION_RECTS(region);
@ -2137,7 +2138,7 @@ void rtgui_region_dump(rtgui_region_t* region)
}
int rtgui_region_is_flat(rtgui_region_t* region)
int rtgui_region_is_flat(rtgui_region_t *region)
{
int num;
@ -2244,11 +2245,11 @@ int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2
{
return RT_EOK;
}
else if (CROSS(rect1,rect2))
else if (CROSS(rect1, rect2))
{
return RT_EOK;
}
else if (CROSS(rect2,rect1))
else if (CROSS(rect2, rect1))
{
return RT_EOK;
}
@ -2258,8 +2259,8 @@ int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2)
{
if (*((rt_uint32_t*)(rect1)) == *((rt_uint32_t*)(rect2)) &&
*(((rt_uint32_t*)(rect1)) + 1) == *(((rt_uint32_t*)(rect2)) + 1))
if (*((rt_uint32_t *)(rect1)) == *((rt_uint32_t *)(rect2)) &&
*(((rt_uint32_t *)(rect1)) + 1) == *(((rt_uint32_t *)(rect2)) + 1))
{
return RT_EOK;
}

View File

@ -51,7 +51,7 @@ DEFINE_CLASS_TYPE(application, "application",
_rtgui_app_destructor,
sizeof(struct rtgui_app));
struct rtgui_app* rtgui_app_create(
struct rtgui_app *rtgui_app_create(
rt_thread_t tid,
const char *title)
{
@ -81,7 +81,7 @@ struct rtgui_app* rtgui_app_create(
}
/* set application title */
app->name = (unsigned char*)rt_strdup((char*)title);
app->name = (unsigned char *)rt_strdup((char *)title);
if (app->name == RT_NULL)
goto __err;
@ -155,14 +155,14 @@ void rtgui_app_destroy(struct rtgui_app *app)
}
RTM_EXPORT(rtgui_app_destroy);
struct rtgui_app* rtgui_app_self(void)
struct rtgui_app *rtgui_app_self(void)
{
struct rtgui_app *app;
rt_thread_t self;
/* get current thread */
self = rt_thread_self();
app = (struct rtgui_app*)(self->user_data);
app = (struct rtgui_app *)(self->user_data);
return app;
}
@ -194,9 +194,9 @@ rt_inline rt_bool_t _rtgui_application_dest_handle(
struct rtgui_app *app,
struct rtgui_event *event)
{
struct rtgui_event_win* wevent = (struct rtgui_event_win*)event;
struct rtgui_event_win *wevent = (struct rtgui_event_win *)event;
struct rtgui_object* dest_object = RTGUI_OBJECT(wevent->wid);
struct rtgui_object *dest_object = RTGUI_OBJECT(wevent->wid);
if (dest_object != RT_NULL)
{
@ -212,9 +212,9 @@ rt_inline rt_bool_t _rtgui_application_dest_handle(
}
}
rt_bool_t rtgui_app_event_handler(struct rtgui_object* object, rtgui_event_t* event)
rt_bool_t rtgui_app_event_handler(struct rtgui_object *object, rtgui_event_t *event)
{
struct rtgui_app* app;
struct rtgui_app *app;
RT_ASSERT(object != RT_NULL);
RT_ASSERT(event != RT_NULL);
@ -253,8 +253,8 @@ rt_bool_t rtgui_app_event_handler(struct rtgui_object* object, rtgui_event_t* ev
case RTGUI_EVENT_MOUSE_BUTTON:
case RTGUI_EVENT_MOUSE_MOTION:
{
struct rtgui_event_win* wevent = (struct rtgui_event_win*)event;
struct rtgui_object* dest_object = RTGUI_OBJECT(wevent->wid);
struct rtgui_event_win *wevent = (struct rtgui_event_win *)event;
struct rtgui_object *dest_object = RTGUI_OBJECT(wevent->wid);
// FIXME: let application determine the dest_wiget but not in sever
// so we can combine this handler with above one
@ -273,8 +273,8 @@ rt_bool_t rtgui_app_event_handler(struct rtgui_object* object, rtgui_event_t* ev
case RTGUI_EVENT_TIMER:
{
struct rtgui_timer* timer;
struct rtgui_event_timer* etimer = (struct rtgui_event_timer*) event;
struct rtgui_timer *timer;
struct rtgui_event_timer *etimer = (struct rtgui_event_timer *) event;
timer = etimer->timer;
if (timer->timeout != RT_NULL)
@ -285,16 +285,25 @@ rt_bool_t rtgui_app_event_handler(struct rtgui_object* object, rtgui_event_t* ev
}
break;
case RTGUI_EVENT_MV_MODEL:
{
struct rtgui_event_mv_model *emodel = (struct rtgui_event_mv_model *)event;
RT_ASSERT(emodel->view);
return rtgui_object_handle(RTGUI_OBJECT(emodel->view), event);
}
case RTGUI_EVENT_COMMAND:
{
struct rtgui_event_command *ecmd = (struct rtgui_event_command*)event;
struct rtgui_event_command *ecmd = (struct rtgui_event_command *)event;
if (ecmd->wid != RT_NULL)
return _rtgui_application_dest_handle(app, event);
}
default:
return rtgui_object_event_handler(object, event);
}
return rtgui_object_event_handler(object, event);
return RT_TRUE;
}
rt_inline void _rtgui_application_event_loop(struct rtgui_app *app)
@ -306,7 +315,7 @@ rt_inline void _rtgui_application_event_loop(struct rtgui_app *app)
_rtgui_application_check(app);
/* point to event buffer */
event = (struct rtgui_event*)app->event_buffer;
event = (struct rtgui_event *)app->event_buffer;
current_ref = ++app->ref_count;
@ -346,7 +355,7 @@ rt_base_t rtgui_app_run(struct rtgui_app *app)
}
RTM_EXPORT(rtgui_app_run);
void rtgui_app_exit(struct rtgui_app* app, rt_uint16_t code)
void rtgui_app_exit(struct rtgui_app *app, rt_uint16_t code)
{
--app->ref_count;
app->exit_code = code;
@ -382,7 +391,7 @@ rt_err_t rtgui_app_set_as_wm(void)
{
rt_thread_t srv_tid;
struct rtgui_event_set_wm event;
struct rtgui_app* app;
struct rtgui_app *app;
srv_tid = rtgui_get_server();
app = rtgui_app_self();
@ -400,7 +409,7 @@ rt_err_t rtgui_app_set_as_wm(void)
}
RTM_EXPORT(rtgui_app_set_as_wm);
void rtgui_app_set_main_win(struct rtgui_win* win)
void rtgui_app_set_main_win(struct rtgui_win *win)
{
struct rtgui_app *app;

View File

@ -0,0 +1,454 @@
/*
* File : rtgui_mv_model.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, 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
* 2012-09-15 Grissiom first version
*/
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/rtgui_object.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_mv_model.h>
#include <rtgui/widgets/mv_view.h>
#include <rtgui/widgets/window.h>
static void _rtgui_mv_model_bare_remove(struct rtgui_mv_model *model, struct rtgui_mv_view *view);
static void _rtgui_mv_view_bare_remove(struct rtgui_mv_view *view, struct rtgui_mv_model *model);
static rt_bool_t _rtgui_mv_model_notify_view(struct rtgui_mv_model *model,
struct rtgui_mv_view *view,
struct rtgui_event_mv_model *emodel);
static void _rtgui_mv_model_constructor(struct rtgui_mv_model *model)
{
model->dimension = 0;
model->length = 0;
model->data = RT_NULL;
model->view_number = 0;
model->view = RT_NULL;
/* currently not interested in any event */
rtgui_object_set_event_handler(RTGUI_OBJECT(model), RT_NULL);
}
static void _rtgui_mv_model_destructor(struct rtgui_mv_model *model)
{
if (model->view_number == 1)
{
rtgui_mv_model_remove_view(model, model->view);
}
else if (model->view_number > 1)
{
int i;
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
for (i = 0; i < model->view_number; i++)
{
rtgui_mv_model_remove_view(model, view_arr[i]);
}
}
if (model->dimension > 1)
rtgui_free(model->data);
}
DEFINE_CLASS_TYPE(mv_model, "mv_model",
RTGUI_OBJECT_TYPE,
_rtgui_mv_model_constructor,
_rtgui_mv_model_destructor,
sizeof(struct rtgui_mv_model));
struct rtgui_mv_model *rtgui_mv_model_create(rt_uint16_t dimension)
{
struct rtgui_mv_model *model;
RT_ASSERT(dimension);
model = RTGUI_MV_MODEL(rtgui_object_create(RTGUI_MV_MODEL_TYPE));
if (model == RT_NULL)
return RT_NULL;
if (rtgui_mv_model_set_dimension(model, dimension) != RT_EOK)
{
rtgui_object_destroy(RTGUI_OBJECT(model));
return RT_NULL;
}
return model;
}
RTM_EXPORT(rtgui_mv_model_create);
rt_err_t rtgui_mv_model_set_dimension(struct rtgui_mv_model *model, rt_uint16_t dimension)
{
if (dimension == 1)
{
if (model->dimension > 1)
rtgui_free(model->data);
model->data = RT_NULL;
}
else
{
void *data;
if (model->dimension > 1)
rtgui_free(model->data);
data = rtgui_malloc(sizeof(void *)*dimension);
if (data == RT_NULL)
{
return -RT_ENOMEM;
}
rt_memset(data, 0, sizeof(void *)*dimension);
model->data = data;
}
model->dimension = dimension;
return RT_EOK;
}
RTM_EXPORT(rtgui_mv_model_set_dimension);
void rtgui_mv_model_destroy(struct rtgui_mv_model *model)
{
rtgui_object_destroy(RTGUI_OBJECT(model));
}
RTM_EXPORT(rtgui_mv_model_destroy);
rt_err_t rtgui_mv_model_add_view(struct rtgui_mv_model *model, struct rtgui_mv_view *view)
{
RT_ASSERT(model);
if (view == RT_NULL)
return RT_EOK;
/* add view to model */
if (model->view_number == 0)
{
model->view = view;
}
else if (model->view_number == 1)
{
/* create the array of view pointers */
struct rtgui_mv_view **new_view;
if (view == model->view)
return RT_EOK;
new_view = rtgui_malloc(2 * sizeof(struct rtgui_mv_view *));
if (new_view == RT_NULL)
return -RT_ENOMEM;
new_view[0] = model->view;
new_view[1] = view;
model->view = new_view;
}
else
{
int i;
struct rtgui_mv_view **new_view;
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
for (i = 0; i < model->view_number; i++)
{
if (view == view_arr[i])
return RT_EOK;
}
new_view = rtgui_realloc(model->view,
(model->view_number + 1) * sizeof(struct rtgui_mv_view *));
if (new_view == RT_NULL)
return -RT_ENOMEM;
new_view[model->view_number] = view;
model->view = new_view;
}
model->view_number++;
/* add model to view. Roll back previous action on fail. */
if (view->model_number == 0)
{
view->model = model;
}
else if (view->model_number == 1)
{
struct rtgui_mv_model **new_arr = rtgui_malloc(2 * sizeof(struct rtgui_mv_model *));
if (new_arr == RT_NULL)
{
_rtgui_mv_model_bare_remove(model, view);
return -RT_ENOMEM;
}
new_arr[0] = view->model;
new_arr[1] = model;
view->model = new_arr;
}
else
{
struct rtgui_mv_model **new_arr = rtgui_realloc(view->model,
(view->model_number + 1) * sizeof(struct rtgui_mv_model *));
if (new_arr == RT_NULL)
{
_rtgui_mv_model_bare_remove(model, view);
return -RT_ENOMEM;
}
new_arr[view->model_number] = model;
view->model = new_arr;
}
view->model_number++;
return RT_EOK;
}
RTM_EXPORT(rtgui_mv_model_add_view);
static void _rtgui_mv_model_bare_remove(struct rtgui_mv_model *model, struct rtgui_mv_view *view)
{
int i;
if (model->view_number == 1)
{
if (model->view == view)
{
model->view_number--;
model->view = RT_NULL;
}
return;
}
for (i = 0; i < model->view_number; i++)
{
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
if (view == view_arr[i])
break;
}
/* no match */
if (i == model->view_number)
{
return;
}
else if (model->view_number == 2)
{
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
struct rtgui_mv_view *the_view = view_arr[(i + 1) % 2];
rtgui_free(model->view);
model->view = the_view;
model->view_number--;
return;
}
else
{
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
void *new_view;
for (; i < model->view_number - 1; i++)
{
view_arr[i] = view_arr[i + 1];
}
new_view = rtgui_realloc(model->view,
(model->view_number - 1) * sizeof(struct rtgui_mv_view *));
/* no need to be panic on OOM error. The original array is still there
* and we can operate it safely. So just ignore the NULL value returned
* by realloc. */
if (new_view != RT_NULL)
model->view = new_view;
model->view_number--;
return;
}
}
static void _rtgui_mv_view_bare_remove(struct rtgui_mv_view *view, struct rtgui_mv_model *model)
{
int i;
struct rtgui_mv_model **model_arr = (struct rtgui_mv_model **)(view)->model;
if (view->model_number == 1)
{
if (view->model == model)
{
view->model_number--;
view->model = RT_NULL;
}
return;
}
for (i = 0; i < view->model_number; i++)
{
if (model == model_arr[i])
break;
}
/* no match */
if (i == view->model_number)
{
return;
}
else if (view->model_number == 2)
{
struct rtgui_mv_model **model_arr = (struct rtgui_mv_model **)(view)->model;
struct rtgui_mv_model *the_model = model_arr[(i + 1) % 2];
rtgui_free(view->model);
view->model = the_model;
view->model_number--;
return;
}
else
{
struct rtgui_mv_model **model_arr = (struct rtgui_mv_model **)(view)->model;
void *new_model;
for (; i < view->model_number - 1; i++)
{
model_arr[i] = model_arr[i + 1];
}
new_model = rtgui_realloc(view->model,
(view->model_number - 1) * sizeof(struct rtgui_mv_model *));
/* no need to be panic on OOM error. The original array is still there
* and we can operate it safely. So just ignore the NULL value returned
* by realloc. */
if (new_model != RT_NULL)
view->model = new_model;
view->model_number--;
return;
}
}
void rtgui_mv_model_remove_view(struct rtgui_mv_model *model, struct rtgui_mv_view *view)
{
RT_ASSERT(model);
if (view == RT_NULL)
return;
if (model->length > 0)
{
struct rtgui_event_mv_model emodel;
RTGUI_EVENT_MV_MODEL_DELETED_INIT(&emodel);
emodel.first_data_changed_idx = 0;
emodel.last_data_changed_idx = model->length;
/* rtgui_mv_model_remove_view is to be called in thread context.
* Besides, it is called by _rtgui_mv_view_destructor which means the
* view will be invalid in the future. So we should call the event
* handler immediately. */
RTGUI_OBJECT(view)->event_handler(RTGUI_OBJECT(view), (struct rtgui_event *)&emodel);
}
_rtgui_mv_model_bare_remove(model, view);
_rtgui_mv_view_bare_remove(view, model);
}
RTM_EXPORT(rtgui_mv_model_remove_view);
rt_bool_t rtgui_mv_model_has_view(struct rtgui_mv_model *model, struct rtgui_mv_view *view)
{
RT_ASSERT(model);
if (view == RT_NULL || model->view_number == 0)
return RT_FALSE;
if (model->view_number == 1)
{
return model->view == view;
}
else
{
int i;
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
for (i = 0; i < model->view_number; i++)
{
if (view == view_arr[i])
return RT_TRUE;
}
return RT_FALSE;
}
}
RTM_EXPORT(rtgui_mv_model_has_view);
void rtgui_mv_model_set_data(struct rtgui_mv_model *model, rt_uint16_t dim, void *p)
{
RT_ASSERT(model);
RT_ASSERT(dim < model->dimension);
if (model->dimension == 1)
{
model->data = p;
return;
}
else
{
void **d_arr = (void **)model->data;
d_arr[dim] = p;
}
}
RTM_EXPORT(rtgui_mv_model_set_data);
void *rtgui_mv_model_get_data(struct rtgui_mv_model *model, rt_uint16_t dim)
{
RT_ASSERT(model);
RT_ASSERT(dim < model->dimension);
if (model->dimension == 1)
{
return model->data;
}
else
{
void **d_arr = (void **)model->data;
return d_arr[dim];
}
}
RTM_EXPORT(rtgui_mv_model_get_data);
static rt_bool_t _rtgui_mv_model_notify_view(struct rtgui_mv_model *model,
struct rtgui_mv_view *view,
struct rtgui_event_mv_model *emodel)
{
rt_thread_t target = RTGUI_WIDGET(view)->toplevel->app->tid;
emodel->model = model;
emodel->view = view;
return rtgui_send(target, (struct rtgui_event *)emodel, sizeof(*emodel));
}
void rtgui_mv_model_notify(struct rtgui_mv_model *model,
struct rtgui_event_mv_model *em)
{
/* model and view may not be in the same thread. Actually, model may not
* belong to any RTGUI thread. So we have to notify the views by sending
* events to the thread directly. */
if (model->view_number == 1)
{
struct rtgui_mv_view *view = (struct rtgui_mv_view *)model->view;
_rtgui_mv_model_notify_view(model, view, em);
}
else
{
int i;
struct rtgui_mv_view **view_arr = (struct rtgui_mv_view **)(model)->view;
for (i = 0; i < model->view_number; i++)
{
_rtgui_mv_model_notify_view(model, view_arr[i], em);
}
}
}
RTM_EXPORT(rtgui_mv_model_notify);

View File

@ -94,10 +94,12 @@ struct rtgui_object_information obj_info = {0, 0, 0};
#endif
/**
* @brief Creates a new object: it calls the corresponding constructors (from the constructor of the base class to the
* constructor of the more derived class) and then sets the values of the given properties
* @brief Creates a new object: it calls the corresponding constructors
* (from the constructor of the base class to the constructor of the more
* derived class) and then sets the values of the given properties
*
* @param object_type the type of object to create
* @return Returns the new Etk_Object of type @a object_type
* @return the created object
*/
rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
{
@ -125,11 +127,11 @@ rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
RTM_EXPORT(rtgui_object_create);
/**
* @brief Destroys the object: it first sets the weak-pointers to RT_NULL, emits the "destroyed" signal, and then
* queues the object in the list of objects to free. Thus, the destructors will only be called at the beginning of the
* next main loop iteration (from the destructor of the more derived class to the destructor of the ultimate base class).
* @brief Destroys the object.
*
* The object destructors will be called in inherited type order.
*
* @param object the object to destroy
* @warning You should not assume that this function will call directly the destructors of the object!
*/
void rtgui_object_destroy(rtgui_object_t *object)
{
@ -151,20 +153,23 @@ void rtgui_object_destroy(rtgui_object_t *object)
RTM_EXPORT(rtgui_object_destroy);
/**
* @brief Checks if @a object can be cast to @a type.
* If @a object doesn't inherit from @a type, a warning is displayed in the console but the object is returned anyway.
* @brief Checks if the object can be cast to the specified type.
*
* If the object doesn't inherit from the specified type, a warning
* is displayed in the console but the object is returned anyway.
*
* @param object the object to cast
* @param type the type to which we cast the object
* @return Returns the object
* @note You usually do not need to call this function, use specific macros instead (ETK_IS_WIDGET() for example)
*/
rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *obj, rtgui_type_t *obj_type, const char* func, int line)
rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *obj, rtgui_type_t *obj_type, const char *func, int line)
{
if (!obj) return RT_NULL;
if (!rtgui_type_inherits_from(obj->type, obj_type))
{
rt_kprintf("%s[%d]: Invalid cast from \"%s\" to \"%s\"\n", func, line, rtgui_type_name_get(obj->type), rtgui_type_name_get(obj_type));
rt_kprintf("%s[%d]: Invalid cast from \"%s\" to \"%s\"\n", func, line,
rtgui_type_name_get(obj->type), rtgui_type_name_get(obj_type));
}
return obj;
@ -174,8 +179,9 @@ RTM_EXPORT(rtgui_object_check_cast);
/**
* @brief Gets the type of the object
*
* @param object an object
* @return Returns the type of @a object (RT_NULL on failure)
* @return the type of the object (RT_NULL on failure)
*/
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object)
{
@ -193,7 +199,7 @@ void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_han
}
RTM_EXPORT(rtgui_object_set_event_handler);
rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event* event)
rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event *event)
{
return RT_FALSE;
}

View File

@ -22,7 +22,7 @@
#include <rtgui/widgets/window.h>
#include <rtgui/rtgui_theme.h>
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#define RTGUI_MEM_TRACE
#endif
@ -55,11 +55,11 @@ void rtgui_system_server_init()
/************************************************************************/
/* RTGUI Timer */
/************************************************************************/
static void rtgui_time_out(void* parameter)
static void rtgui_time_out(void *parameter)
{
rtgui_timer_t* timer;
rtgui_timer_t *timer;
rtgui_event_timer_t event;
timer = (rtgui_timer_t*)parameter;
timer = (rtgui_timer_t *)parameter;
/*
* Note: event_timer can not use RTGUI_EVENT_TIMER_INIT to init, for there is no
@ -73,11 +73,11 @@ static void rtgui_time_out(void* parameter)
rtgui_send(timer->tid, &(event.parent), sizeof(rtgui_event_timer_t));
}
rtgui_timer_t* rtgui_timer_create(rt_int32_t time, rt_int32_t flag, rtgui_timeout_func timeout, void* parameter)
rtgui_timer_t *rtgui_timer_create(rt_int32_t time, rt_int32_t flag, rtgui_timeout_func timeout, void *parameter)
{
rtgui_timer_t* timer;
rtgui_timer_t *timer;
timer = (rtgui_timer_t*) rtgui_malloc(sizeof(rtgui_timer_t));
timer = (rtgui_timer_t *) rtgui_malloc(sizeof(rtgui_timer_t));
timer->tid = rt_thread_self();
timer->timeout = timeout;
timer->user_data = parameter;
@ -89,7 +89,7 @@ rtgui_timer_t* rtgui_timer_create(rt_int32_t time, rt_int32_t flag, rtgui_timeou
}
RTM_EXPORT(rtgui_timer_create);
void rtgui_timer_destory(rtgui_timer_t* timer)
void rtgui_timer_destory(rtgui_timer_t *timer)
{
RT_ASSERT(timer != RT_NULL);
@ -103,7 +103,7 @@ void rtgui_timer_destory(rtgui_timer_t* timer)
}
RTM_EXPORT(rtgui_timer_destory);
void rtgui_timer_start(rtgui_timer_t* timer)
void rtgui_timer_start(rtgui_timer_t *timer)
{
RT_ASSERT(timer != RT_NULL);
@ -112,7 +112,7 @@ void rtgui_timer_start(rtgui_timer_t* timer)
}
RTM_EXPORT(rtgui_timer_start);
void rtgui_timer_stop (rtgui_timer_t* timer)
void rtgui_timer_stop(rtgui_timer_t *timer)
{
RT_ASSERT(timer != RT_NULL);
@ -137,10 +137,10 @@ struct rtgui_mem_info mem_info;
struct rti_memtrace_item
{
void* mb_ptr; /* memory block pointer */
void *mb_ptr; /* memory block pointer */
rt_uint32_t mb_len; /* memory block length */
struct rti_memtrace_item* next;
struct rti_memtrace_item *next;
};
struct rti_memtrace_item trace_list[MEMTRACE_MAX];
struct rti_memtrace_item *item_hash[MEMTRACE_HASH_SIZE];
@ -167,10 +167,10 @@ void rti_memtrace_init()
item->next = RT_NULL;
}
void rti_malloc_hook(void* ptr, rt_uint32_t len)
void rti_malloc_hook(void *ptr, rt_uint32_t len)
{
rt_uint32_t index;
struct rti_memtrace_item* item;
struct rti_memtrace_item *item;
if (item_free == RT_NULL) return;
@ -202,7 +202,7 @@ void rti_malloc_hook(void* ptr, rt_uint32_t len)
/* unlock context */
}
void rti_free_hook(void* ptr)
void rti_free_hook(void *ptr)
{
rt_uint32_t index;
struct rti_memtrace_item *item;
@ -226,7 +226,7 @@ void rti_free_hook(void* ptr)
/* delete item from list */
if (item->next != RT_NULL)
{
struct rti_memtrace_item* i;
struct rti_memtrace_item *i;
i = item->next;
item->next = item->next->next;
@ -253,9 +253,9 @@ void rti_free_hook(void* ptr)
}
#endif
void* rtgui_malloc(rt_size_t size)
void *rtgui_malloc(rt_size_t size)
{
void* ptr;
void *ptr;
ptr = rt_malloc(size);
#ifdef RTGUI_MEM_TRACE
@ -273,9 +273,9 @@ void* rtgui_malloc(rt_size_t size)
}
RTM_EXPORT(rtgui_malloc);
void* rtgui_realloc(void* ptr, rt_size_t size)
void *rtgui_realloc(void *ptr, rt_size_t size)
{
void* new_ptr;
void *new_ptr;
#ifdef RTGUI_MEM_TRACE
new_ptr = rtgui_malloc(size);
@ -292,7 +292,7 @@ void* rtgui_realloc(void* ptr, rt_size_t size)
}
RTM_EXPORT(rtgui_realloc);
void rtgui_free(void* ptr)
void rtgui_free(void *ptr)
{
#ifdef RTGUI_MEM_TRACE
if (ptr != RT_NULL)
@ -316,7 +316,7 @@ FINSH_FUNCTION_EXPORT(list_guimem, display memory information);
/* RTGUI Event Dump */
/************************************************************************/
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#define RTGUI_EVENT_DEBUG
#endif
@ -371,9 +371,9 @@ const char *event_string[] =
#define DBG_MSG(x) rt_kprintf x
static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t *event)
{
char* sender = "(unknown)";
char *sender = "(unknown)";
if ((event->type == RTGUI_EVENT_TIMER) ||
(event->type == RTGUI_EVENT_UPDATE_BEGIN) ||
@ -387,7 +387,16 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
if (event->sender != RT_NULL)
sender = event->sender->name;
if (event->type >= RTGUI_EVENT_COMMAND)
{
rt_kprintf("%s -- USER EVENT --> %s \n", sender, tid->name);
return ;
}
else
{
rt_kprintf("%s -- %s --> %s ", sender, event_string[event->type], tid->name);
}
switch (event->type)
{
case RTGUI_EVENT_APP_CREATE:
@ -404,14 +413,14 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
{
struct rtgui_event_paint *paint = (struct rtgui_event_paint *)event;
if(paint->wid != RT_NULL)
if (paint->wid != RT_NULL)
rt_kprintf("win: %s", paint->wid->title);
}
break;
case RTGUI_EVENT_KBD:
{
struct rtgui_event_kbd *ekbd = (struct rtgui_event_kbd*) event;
struct rtgui_event_kbd *ekbd = (struct rtgui_event_kbd *) event;
if (ekbd->wid != RT_NULL)
rt_kprintf("win: %s", ekbd->wid->title);
if (RTGUI_KBD_IS_UP(ekbd)) rt_kprintf(", up");
@ -423,14 +432,14 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
{
struct rtgui_event_clip_info *info = (struct rtgui_event_clip_info *)event;
if(info->wid != RT_NULL)
if (info->wid != RT_NULL)
rt_kprintf("win: %s", info->wid->title);
}
break;
case RTGUI_EVENT_WIN_CREATE:
{
struct rtgui_event_win_create *create = (struct rtgui_event_win_create*)event;
struct rtgui_event_win_create *create = (struct rtgui_event_win_create *)event;
rt_kprintf(" win: %s at (x1:%d, y1:%d, x2:%d, y2:%d), addr: %p",
#ifdef RTGUI_USING_SMALL_SIZE
@ -453,7 +462,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
case RTGUI_EVENT_UPDATE_END:
{
struct rtgui_event_update_end* update_end = (struct rtgui_event_update_end*)event;
struct rtgui_event_update_end *update_end = (struct rtgui_event_update_end *)event;
rt_kprintf("(x:%d, y1:%d, x2:%d, y2:%d)", update_end->rect.x1,
update_end->rect.y1,
update_end->rect.x2,
@ -468,7 +477,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
{
struct rtgui_event_win *win = (struct rtgui_event_win *)event;
if(win->wid != RT_NULL)
if (win->wid != RT_NULL)
rt_kprintf("win: %s", win->wid->title);
}
break;
@ -477,7 +486,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
{
struct rtgui_event_win_move *win = (struct rtgui_event_win_move *)event;
if(win->wid != RT_NULL)
if (win->wid != RT_NULL)
{
rt_kprintf("win: %s", win->wid->title);
rt_kprintf(" to (x:%d, y:%d)", win->x, win->y);
@ -487,7 +496,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
case RTGUI_EVENT_WIN_RESIZE:
{
struct rtgui_event_win_resize* win = (struct rtgui_event_win_resize *)event;
struct rtgui_event_win_resize *win = (struct rtgui_event_win_resize *)event;
if (win->wid != RT_NULL)
{
@ -503,7 +512,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
case RTGUI_EVENT_MOUSE_BUTTON:
case RTGUI_EVENT_MOUSE_MOTION:
{
struct rtgui_event_mouse *mouse = (struct rtgui_event_mouse*)event;
struct rtgui_event_mouse *mouse = (struct rtgui_event_mouse *)event;
if (mouse->button & RTGUI_MOUSE_BUTTON_LEFT) rt_kprintf("left ");
else rt_kprintf("right ");
@ -521,7 +530,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
case RTGUI_EVENT_MONITOR_ADD:
{
struct rtgui_event_monitor *monitor = (struct rtgui_event_monitor*)event;
struct rtgui_event_monitor *monitor = (struct rtgui_event_monitor *)event;
if (monitor->wid != RT_NULL)
{
rt_kprintf("win: %s, the rect is:(%d, %d) - (%d, %d)", monitor->wid->title,
@ -542,7 +551,7 @@ static void rtgui_event_dump(rt_thread_t tid, rtgui_event_t* event)
/************************************************************************/
/* RTGUI IPC APIs */
/************************************************************************/
rt_err_t rtgui_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
rt_err_t rtgui_send(rt_thread_t tid, rtgui_event_t *event, rt_size_t event_size)
{
rt_err_t result;
struct rtgui_app *app;
@ -554,7 +563,7 @@ rt_err_t rtgui_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
rtgui_event_dump(tid, event);
/* find struct rtgui_application */
app = (struct rtgui_app*) (tid->user_data);
app = (struct rtgui_app *)(tid->user_data);
if (app == RT_NULL)
return -RT_ERROR;
@ -569,7 +578,7 @@ rt_err_t rtgui_send(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
}
RTM_EXPORT(rtgui_send);
rt_err_t rtgui_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
rt_err_t rtgui_send_urgent(rt_thread_t tid, rtgui_event_t *event, rt_size_t event_size)
{
rt_err_t result;
struct rtgui_app *app;
@ -581,7 +590,7 @@ rt_err_t rtgui_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size_t even
rtgui_event_dump(tid, event);
/* find rtgui_application */
app = (struct rtgui_app*) (tid->user_data);
app = (struct rtgui_app *)(tid->user_data);
if (app == RT_NULL)
return -RT_ERROR;
@ -593,7 +602,7 @@ rt_err_t rtgui_send_urgent(rt_thread_t tid, rtgui_event_t* event, rt_size_t even
}
RTM_EXPORT(rtgui_send_urgent);
rt_err_t rtgui_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_size)
rt_err_t rtgui_send_sync(rt_thread_t tid, rtgui_event_t *event, rt_size_t event_size)
{
rt_err_t r;
struct rtgui_app *app;
@ -608,10 +617,10 @@ rt_err_t rtgui_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_
/* init ack mailbox */
r = rt_mb_init(&ack_mb, "ack", &ack_buffer, 1, 0);
if (r!= RT_EOK)
if (r != RT_EOK)
goto __return;
app = (struct rtgui_app*) (tid->user_data);
app = (struct rtgui_app *)(tid->user_data);
if (app == RT_NULL)
{
r = -RT_ERROR;
@ -626,8 +635,8 @@ rt_err_t rtgui_send_sync(rt_thread_t tid, rtgui_event_t* event, rt_size_t event_
goto __return;
}
r = rt_mb_recv(&ack_mb, (rt_uint32_t*)&ack_status, RT_WAITING_FOREVER);
if (r!= RT_EOK)
r = rt_mb_recv(&ack_mb, (rt_uint32_t *)&ack_status, RT_WAITING_FOREVER);
if (r != RT_EOK)
goto __return;
if (ack_status != RTGUI_STATUS_OK)
@ -642,7 +651,7 @@ __return:
}
RTM_EXPORT(rtgui_send_sync);
rt_err_t rtgui_ack(rtgui_event_t* event, rt_int32_t status)
rt_err_t rtgui_ack(rtgui_event_t *event, rt_int32_t status)
{
RT_ASSERT(event != RT_NULL);
RT_ASSERT(event->ack != RT_NULL);
@ -653,15 +662,15 @@ rt_err_t rtgui_ack(rtgui_event_t* event, rt_int32_t status)
}
RTM_EXPORT(rtgui_ack);
rt_err_t rtgui_recv(rtgui_event_t* event, rt_size_t event_size)
rt_err_t rtgui_recv(rtgui_event_t *event, rt_size_t event_size)
{
struct rtgui_app* app;
struct rtgui_app *app;
rt_err_t r;
RT_ASSERT(event != RT_NULL);
RT_ASSERT(event_size != 0);
app = (struct rtgui_app*) (rt_thread_self()->user_data);
app = (struct rtgui_app *)(rt_thread_self()->user_data);
if (app == RT_NULL)
return -RT_ERROR;
@ -671,7 +680,7 @@ rt_err_t rtgui_recv(rtgui_event_t* event, rt_size_t event_size)
}
RTM_EXPORT(rtgui_recv);
rt_err_t rtgui_recv_nosuspend(rtgui_event_t* event, rt_size_t event_size)
rt_err_t rtgui_recv_nosuspend(rtgui_event_t *event, rt_size_t event_size)
{
struct rtgui_app *app;
rt_err_t r;
@ -679,7 +688,7 @@ rt_err_t rtgui_recv_nosuspend(rtgui_event_t* event, rt_size_t event_size)
RT_ASSERT(event != RT_NULL);
RT_ASSERT(event != 0);
app = (struct rtgui_app*) (rt_thread_self()->user_data);
app = (struct rtgui_app *)(rt_thread_self()->user_data);
if (app == RT_NULL)
return -RT_ERROR;
@ -689,14 +698,14 @@ rt_err_t rtgui_recv_nosuspend(rtgui_event_t* event, rt_size_t event_size)
}
RTM_EXPORT(rtgui_recv_nosuspend);
rt_err_t rtgui_recv_filter(rt_uint32_t type, rtgui_event_t* event, rt_size_t event_size)
rt_err_t rtgui_recv_filter(rt_uint32_t type, rtgui_event_t *event, rt_size_t event_size)
{
struct rtgui_app *app;
RT_ASSERT(event != RT_NULL);
RT_ASSERT(event_size != 0);
app = (struct rtgui_app*) (rt_thread_self()->user_data);
app = (struct rtgui_app *)(rt_thread_self()->user_data);
if (app == RT_NULL)
return -RT_ERROR;

View File

@ -50,12 +50,12 @@ void rtgui_system_theme_init()
static const rt_uint8_t close_byte[14] = {0x06, 0x18, 0x03, 0x30, 0x01, 0xE0, 0x00,
0xC0, 0x01, 0xE0, 0x03, 0x30, 0x06, 0x18
};
};
/* window drawing */
void rtgui_theme_draw_win(struct rtgui_topwin* win)
void rtgui_theme_draw_win(struct rtgui_topwin *win)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
rtgui_rect_t rect;
if (win->title == RT_NULL) return; /* no title and no board */
@ -70,7 +70,8 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
/* draw border */
if (win->flag & WINTITLE_BORDER)
{
rect.x2 -= 1; rect.y2 -= 1;
rect.x2 -= 1;
rect.y2 -= 1;
RTGUI_WIDGET_FOREGROUND(win->title) = RTGUI_RGB(212, 208, 200);
rtgui_dc_draw_hline(dc, rect.x1, rect.x2, rect.y1);
rtgui_dc_draw_vline(dc, rect.x1, rect.y1, rect.y2);
@ -99,12 +100,16 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
if (win->flag & WINTITLE_ACTIVATE)
{
r = 10; g = 36; b = 106;
r = 10;
g = 36;
b = 106;
delta = 150 / (float)(rect.x2 - rect.x1);
}
else
{
r = 128; g = 128; b = 128;
r = 128;
g = 128;
b = 128;
delta = 64 / (float)(rect.x2 - rect.x1);
}
@ -112,7 +117,9 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
for (index = rect.x1; index < rect.x2 + 1; index ++)
{
rtgui_dc_draw_vline(dc, index, rect.y1, rect.y2);
r += delta; g += delta; b += delta;
r += delta;
g += delta;
b += delta;
}
if (win->flag & WINTITLE_ACTIVATE)
@ -125,7 +132,8 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
}
rect.x1 += 4;
rect.y1 += 2; rect.y2 = rect.y1 + WINTITLE_CB_HEIGHT;
rect.y1 += 2;
rect.y2 = rect.y1 + WINTITLE_CB_HEIGHT;
rtgui_dc_draw_text(dc, rtgui_wintitle_get_title(win->title), &rect);
if (win->flag & WINTITLE_CLOSEBOX)
@ -133,7 +141,8 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
/* get close button rect */
rtgui_rect_t box_rect = {0, 0, WINTITLE_CB_WIDTH, WINTITLE_CB_HEIGHT};
rtgui_rect_moveto_align(&rect, &box_rect, RTGUI_ALIGN_CENTER_VERTICAL | RTGUI_ALIGN_RIGHT);
box_rect.x1 -= 3; box_rect.x2 -= 3;
box_rect.x1 -= 3;
box_rect.x2 -= 3;
rtgui_dc_fill_rect(dc, &box_rect);
/* draw close box */
@ -156,10 +165,10 @@ void rtgui_theme_draw_win(struct rtgui_topwin* win)
}
/* widget drawing */
void rtgui_theme_draw_button(rtgui_button_t* btn)
void rtgui_theme_draw_button(rtgui_button_t *btn)
{
/* draw button */
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
rtgui_color_t bc, fc;
@ -182,7 +191,8 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
if (btn->pressed_image != RT_NULL)
{
rtgui_rect_t image_rect;
image_rect.x1 = 0; image_rect.y1 = 0;
image_rect.x1 = 0;
image_rect.y1 = 0;
image_rect.x2 = btn->unpressed_image->w;
image_rect.y2 = btn->unpressed_image->h;
rtgui_rect_moveto_align(&rect, &image_rect, RTGUI_ALIGN_CENTER);
@ -202,7 +212,8 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
if (btn->unpressed_image != RT_NULL)
{
rtgui_rect_t image_rect;
image_rect.x1 = 0; image_rect.y1 = 0;
image_rect.x1 = 0;
image_rect.y1 = 0;
image_rect.x2 = btn->unpressed_image->w;
image_rect.y2 = btn->unpressed_image->h;
rtgui_rect_moveto_align(&rect, &image_rect, RTGUI_ALIGN_CENTER);
@ -245,10 +256,10 @@ void rtgui_theme_draw_button(rtgui_button_t* btn)
rtgui_dc_end_drawing(dc);
}
void rtgui_theme_draw_label(rtgui_label_t* label)
void rtgui_theme_draw_label(rtgui_label_t *label)
{
/* draw label */
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
/* begin drawing */
@ -266,10 +277,10 @@ void rtgui_theme_draw_label(rtgui_label_t* label)
}
#define RTGUI_TEXTBOX_MARGIN 3
void rtgui_theme_draw_textbox(rtgui_textbox_t* box)
void rtgui_theme_draw_textbox(rtgui_textbox_t *box)
{
/* draw button */
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
rtgui_color_t fc;
@ -331,9 +342,9 @@ void rtgui_theme_draw_textbox(rtgui_textbox_t* box)
rtgui_dc_end_drawing(dc);
}
void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox)
void rtgui_theme_draw_iconbox(rtgui_iconbox_t *iconbox)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
struct rtgui_rect text_rect;
@ -368,9 +379,9 @@ void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox)
}
static const rt_uint8_t checked_byte[7] = {0x02, 0x06, 0x8E, 0xDC, 0xF8, 0x70, 0x20};
void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox)
void rtgui_theme_draw_checkbox(struct rtgui_checkbox *checkbox)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect, box_rect;
rtgui_color_t bc, fc;
@ -404,7 +415,8 @@ void rtgui_theme_draw_checkbox(struct rtgui_checkbox* checkbox)
box_rect.x2 = CHECK_BOX_W;
box_rect.y2 = CHECK_BOX_H;
rtgui_rect_moveto_align(&rect, &box_rect, RTGUI_ALIGN_CENTER_VERTICAL);
box_rect.x1 += 2; box_rect.x2 += 2;
box_rect.x1 += 2;
box_rect.x2 += 2;
rtgui_dc_draw_border(dc, &box_rect, RTGUI_BORDER_BOX);
rtgui_rect_inflate(&box_rect, -1);
@ -445,9 +457,9 @@ static const rt_uint8_t radio_checked_byte[] =
0x40, 0x20, 0x30, 0xc0, 0x0f, 0x00,
};
void rtgui_theme_draw_radiobutton(struct rtgui_radiobox* radiobox, rt_uint16_t item)
void rtgui_theme_draw_radiobutton(struct rtgui_radiobox *radiobox, rt_uint16_t item)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect, item_rect;
int item_size, bord_size;
@ -486,9 +498,11 @@ void rtgui_theme_draw_radiobutton(struct rtgui_radiobox* radiobox, rt_uint16_t i
}
else
{
item_rect.x2 += 1; item_rect.y2 += 1;
item_rect.x2 += 1;
item_rect.y2 += 1;
rtgui_dc_fill_rect(dc, &item_rect);
item_rect.x2 -= 1; item_rect.y2 -= 1;
item_rect.x2 -= 1;
item_rect.y2 -= 1;
rtgui_dc_draw_word(dc, item_rect.x1, item_rect.y1 + (item_size - RADIO_BOX_H) / 2,
RADIO_BOX_H, radio_unchecked_byte);
}
@ -514,9 +528,11 @@ void rtgui_theme_draw_radiobutton(struct rtgui_radiobox* radiobox, rt_uint16_t i
}
else
{
item_rect.x2 += 1; item_rect.y2 += 1;
item_rect.x2 += 1;
item_rect.y2 += 1;
rtgui_dc_fill_rect(dc, &item_rect);
item_rect.x2 -= 1; item_rect.y2 -= 1;
item_rect.x2 -= 1;
item_rect.y2 -= 1;
rtgui_dc_draw_word(dc, item_rect.x1, item_rect.y1, RADIO_BOX_H, radio_unchecked_byte);
}
@ -529,9 +545,9 @@ void rtgui_theme_draw_radiobutton(struct rtgui_radiobox* radiobox, rt_uint16_t i
rtgui_dc_end_drawing(dc);
}
void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
void rtgui_theme_draw_radiobox(struct rtgui_radiobox *radiobox)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect, item_rect;
int item_size, bord_size, index;
rtgui_color_t fc;
@ -555,20 +571,26 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
}
/* draw box */
rtgui_rect_inflate(&rect, -bord_size/2);
rtgui_rect_inflate(&rect, -bord_size / 2);
fc = RTGUI_WIDGET_FOREGROUND(radiobox);
RTGUI_WIDGET_FOREGROUND(radiobox) = white;
rect.x1 ++; rect.y1 ++; rect.x2 ++; rect.y2 ++;
rect.x1 ++;
rect.y1 ++;
rect.x2 ++;
rect.y2 ++;
rtgui_dc_draw_rect(dc, &rect);
RTGUI_WIDGET_FOREGROUND(radiobox) = RTGUI_RGB(128, 128, 128);
rect.x1 --; rect.y1 --; rect.x2 --; rect.y2 --;
rect.x1 --;
rect.y1 --;
rect.x2 --;
rect.y2 --;
rtgui_dc_draw_rect(dc, &rect);
RTGUI_WIDGET_FOREGROUND(radiobox) = fc;
rtgui_rect_inflate(&rect, bord_size/2);
rtgui_rect_inflate(&rect, bord_size / 2);
if (radiobox->text != RT_NULL)
{
struct rtgui_rect text_rect;
@ -576,9 +598,11 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
/* draw group text */
rtgui_font_get_metrics(RTGUI_DC_FONT(dc), radiobox->text, &text_rect);
rtgui_rect_moveto(&text_rect, rect.x1 + bord_size + 5, rect.y1);
rect.x1 -= 5; rect.x2 += 5;
rect.x1 -= 5;
rect.x2 += 5;
rtgui_dc_fill_rect(dc, &text_rect);
rect.x1 += 5; rect.x2 -= 5;
rect.x1 += 5;
rect.x2 -= 5;
rtgui_dc_draw_text(dc, radiobox->text, &text_rect);
}
@ -658,10 +682,10 @@ void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox)
rtgui_dc_end_drawing(dc);
}
void rtgui_theme_draw_slider(struct rtgui_slider* slider)
void rtgui_theme_draw_slider(struct rtgui_slider *slider)
{
/* draw button */
struct rtgui_dc* dc;
struct rtgui_dc *dc;
int i, xsize, x0;
rtgui_rect_t r, focus_rect, slider_rect, slot_rect;
@ -684,14 +708,14 @@ void rtgui_theme_draw_slider(struct rtgui_slider* slider)
/* calculate thumb position */
slider_rect = r;
slider_rect.x1 = 5;
slider_rect.y1 = x0 + xsize * (slider->value - slider->min) / (slider->max - slider->min) - slider->thumb_width/2;
slider_rect.y1 = x0 + xsize * (slider->value - slider->min) / (slider->max - slider->min) - slider->thumb_width / 2;
slider_rect.y2 = slider_rect.y1 + slider->thumb_width;
/* calculate slot position */
slot_rect.y1 = x0;
slot_rect.y2 = x0 + xsize;
slot_rect.x1 = (slider_rect.x1 + slider_rect.x2) /2 -1;
slot_rect.x2 = slot_rect.x1 +3;
slot_rect.x1 = (slider_rect.x1 + slider_rect.x2) / 2 - 1;
slot_rect.x2 = slot_rect.x1 + 3;
/* draw slot */
rtgui_dc_draw_border(dc, &slot_rect, RTGUI_BORDER_RAISE);
@ -715,14 +739,14 @@ void rtgui_theme_draw_slider(struct rtgui_slider* slider)
/* calculate thumb position */
slider_rect = r;
slider_rect.y1 = 5;
slider_rect.x1 = x0 + xsize * (slider->value - slider->min) / (slider->max - slider->min) - slider->thumb_width/2;
slider_rect.x1 = x0 + xsize * (slider->value - slider->min) / (slider->max - slider->min) - slider->thumb_width / 2;
slider_rect.x2 = slider_rect.x1 + slider->thumb_width;
/* calculate slot position */
slot_rect.x1 = x0;
slot_rect.x2 = x0 + xsize;
slot_rect.y1 = (slider_rect.y1 + slider_rect.y2) /2 -1;
slot_rect.y2 = slot_rect.y1 +3;
slot_rect.y1 = (slider_rect.y1 + slider_rect.y2) / 2 - 1;
slot_rect.y2 = slot_rect.y1 + 3;
/* draw slot */
rtgui_dc_draw_border(dc, &slot_rect, RTGUI_BORDER_RAISE);
@ -749,131 +773,10 @@ void rtgui_theme_draw_slider(struct rtgui_slider* slider)
return;
}
const static rt_uint8_t _up_arrow[] = {0x10, 0x38, 0x7C, 0xFE};
const static rt_uint8_t _down_arrow[] = {0xFE,0x7C, 0x38, 0x10};
const static rt_uint8_t _left_arrow[] = {0x10, 0x30, 0x70, 0xF0, 0x70, 0x30, 0x10};
const static rt_uint8_t _right_arrow[] = {0x80, 0xC0, 0xE0, 0xF0, 0xE0, 0xC0, 0x80};
void rtgui_theme_draw_scrollbar(struct rtgui_scrollbar* bar)
{
/* draw scroll bar */
struct rtgui_dc* dc;
rtgui_rect_t rect, btn_rect, thum_rect, arrow_rect;
rtgui_color_t bc, fc;
/* begin drawing */
dc = rtgui_dc_begin_drawing(&(bar->parent));
if (dc == RT_NULL) return;
rtgui_widget_get_rect(RTGUI_WIDGET(bar), &rect);
/* draw background */
fc = RTGUI_WIDGET_FOREGROUND(bar);
if (!RTGUI_WIDGET_IS_ENABLE(bar))
RTGUI_WIDGET_FOREGROUND(bar) = RTGUI_RGB(128, 128, 128);
bc = RTGUI_WIDGET_BACKGROUND(bar);
RTGUI_WIDGET_BACKGROUND(bar) = white;
rtgui_dc_fill_rect(dc, &rect);
RTGUI_WIDGET_BACKGROUND(bar) = bc;
if (bar->orient == RTGUI_VERTICAL)
{
btn_rect = rect;
btn_rect.y2 = btn_rect.y1 + (rect.x2 - rect.x1);
/* draw up button */
rtgui_dc_fill_rect(dc, &btn_rect);
if (bar->status & SBS_UPARROW) rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_SUNKEN);
else rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_RAISE);
/* draw arrow */
arrow_rect.x1 = 0; arrow_rect.y1 = 0;
arrow_rect.x2 = 7; arrow_rect.y2 = 4;
rtgui_rect_moveto_align(&btn_rect, &arrow_rect,
RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, arrow_rect.x1, arrow_rect.y1,
rtgui_rect_height(arrow_rect), _up_arrow);
/* draw thumb */
if (RTGUI_WIDGET_IS_ENABLE(bar))
{
rtgui_scrollbar_get_thumb_rect(bar, &thum_rect);
rtgui_dc_fill_rect(dc, &thum_rect);
rtgui_dc_draw_border(dc, &thum_rect, RTGUI_BORDER_RAISE);
}
/* draw down button */
btn_rect.y1 = rect.y2 - (rect.x2 - rect.x1);
btn_rect.y2 = rect.y2;
rtgui_dc_fill_rect(dc, &btn_rect);
if (bar->status & SBS_DOWNARROW) rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_SUNKEN);
else rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_RAISE);
arrow_rect.x1 = 0; arrow_rect.y1 = 0;
arrow_rect.x2 = 7; arrow_rect.y2 = 4;
rtgui_rect_moveto_align(&btn_rect, &arrow_rect,
RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, arrow_rect.x1, arrow_rect.y1,
rtgui_rect_height(arrow_rect), _down_arrow);
}
else
{
btn_rect.x1 = rect.x1;
btn_rect.y1 = rect.y1;
btn_rect.x2 = rect.y2;
btn_rect.y2 = rect.y2;
/* draw left button */
rtgui_dc_fill_rect(dc, &btn_rect);
if (bar->status & SBS_LEFTARROW) rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_SUNKEN);
else rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_RAISE);
arrow_rect.x1 = 0; arrow_rect.y1 = 0;
arrow_rect.x2 = 4; arrow_rect.y2 = 7;
rtgui_rect_moveto_align(&btn_rect, &arrow_rect,
RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, arrow_rect.x1, arrow_rect.y1,
rtgui_rect_height(arrow_rect), _left_arrow);
/* draw thumb */
if (RTGUI_WIDGET_IS_ENABLE(bar))
{
rtgui_scrollbar_get_thumb_rect(bar, &thum_rect);
rtgui_dc_fill_rect(dc, &thum_rect);
rtgui_dc_draw_border(dc, &thum_rect, RTGUI_BORDER_RAISE);
}
btn_rect.x1 = rect.x2 - rect.y2;
btn_rect.x2 = rect.x2;
/* draw right button */
rtgui_dc_fill_rect(dc, &btn_rect);
if (bar->status & SBS_RIGHTARROW) rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_SUNKEN);
else rtgui_dc_draw_border(dc, &btn_rect, RTGUI_BORDER_RAISE);
arrow_rect.x1 = 0; arrow_rect.y1 = 0;
arrow_rect.x2 = 4; arrow_rect.y2 = 7;
rtgui_rect_moveto_align(&btn_rect, &arrow_rect,
RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, arrow_rect.x1, arrow_rect.y1,
rtgui_rect_height(arrow_rect), _right_arrow);
}
/* end drawing */
rtgui_dc_end_drawing(dc);
RTGUI_WIDGET_FOREGROUND(bar) = fc;
return;
}
void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar)
void rtgui_theme_draw_progressbar(struct rtgui_progressbar *bar)
{
/* draw progress bar */
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
int max = bar->range;
int pos = bar->position;
@ -900,11 +803,13 @@ void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar)
return;
}
rect.x2 ++; rect.y2 ++;
rect.x2 ++;
rect.y2 ++;
left = max - pos;
rtgui_rect_inflate(&rect, -2);
RTGUI_WIDGET_BACKGROUND(bar) = RTGUI_RGB(0, 0, 255);
rect.y2 --; rect.x2 --;
rect.y2 --;
rect.x2 --;
if (bar->orient == RTGUI_VERTICAL)
{
@ -914,7 +819,8 @@ void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar)
rtgui_dc_fill_rect(dc, &rect);
RTGUI_DC_BC(dc) = bc;
rect.y1 -= dy; rect.y2 = dy;
rect.y1 -= dy;
rect.y2 = dy;
rtgui_dc_fill_rect(dc, &rect);
}
else
@ -925,7 +831,8 @@ void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar)
rtgui_dc_fill_rect(dc, &rect);
RTGUI_DC_BC(dc) = bc;
rect.x1 = rect.x2; rect.x2 += dx;
rect.x1 = rect.x2;
rect.x2 += dx;
rtgui_dc_fill_rect(dc, &rect);
}
@ -934,9 +841,9 @@ void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar)
return;
}
void rtgui_theme_draw_staticline(struct rtgui_staticline* staticline)
void rtgui_theme_draw_staticline(struct rtgui_staticline *staticline)
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
/* begin drawing */
@ -963,7 +870,7 @@ rt_uint16_t rtgui_theme_get_selected_height()
return SELECTED_HEIGHT;
}
void rtgui_theme_draw_selected(struct rtgui_dc* dc, rtgui_rect_t *rect)
void rtgui_theme_draw_selected(struct rtgui_dc *dc, rtgui_rect_t *rect)
{
rtgui_color_t bc;
rt_uint16_t index;

View File

@ -2,7 +2,8 @@
#include <rtgui/rtgui_system.h>
/* Internal states that the parser can be in at any given time. */
enum {
enum
{
STAT_START = 0, /* starting base state, default state */
STAT_TEXT, /* text state */
STAT_START_TAG, /* start tag state */
@ -22,7 +23,8 @@ enum {
/* character classes that we will match against; This could be expanded if
need be, however, we are aiming for simple. */
enum {
enum
{
CLASS_TYPE_NONE = 0, /* matches nothing, a base state */
CLASS_TYPE_LEFT_ANGLE, /* matches start tag '<' */
CLASS_TYPE_SLASH, /* matches forward slash */
@ -45,7 +47,8 @@ struct rtgui_xml_state
};
/* Note: States must be grouped in match order AND grouped together! */
static const struct rtgui_xml_state RTGUI_XML_STATES [] = {
static const struct rtgui_xml_state RTGUI_XML_STATES [] =
{
/* [0-2] starting state, which also serves as the default state in case
of error */
{ STAT_START, CLASS_TYPE_SPACE, STAT_SPACE, EVENT_NONE },
@ -96,7 +99,7 @@ static const struct rtgui_xml_state RTGUI_XML_STATES [] = {
/* [22] handle ending of end tag name */
{ STAT_END_TAGNAME_END, CLASS_TYPE_SPACE, STAT_END_TAGNAME_END, EVENT_NONE },
{ STAT_END_TAGNAME_END, CLASS_TYPE_RIGHT_ANGLE,STAT_START, EVENT_NONE },
{ STAT_END_TAGNAME_END, CLASS_TYPE_RIGHT_ANGLE, STAT_START, EVENT_NONE },
/* [23-25] handle text */
{ STAT_TEXT, CLASS_TYPE_SPACE, STAT_SPACE, EVENT_NONE },
@ -133,9 +136,9 @@ struct rtgui_xml
{
/* event handler */
rtgui_xml_event_handler_t event_handler;
void* user;
void *user;
char* buffer; /* xml buffer */
char *buffer; /* xml buffer */
rt_size_t buffer_size; /* buffer size */
rt_size_t position; /* current position in buffer */
rt_uint16_t state, event; /* current state and event */
@ -144,10 +147,10 @@ struct rtgui_xml
rt_bool_t halt; /* halt parsing of document */
};
rtgui_xml_t* rtgui_xml_create(rt_size_t buffer_size, rtgui_xml_event_handler_t handler,
void* user)
rtgui_xml_t *rtgui_xml_create(rt_size_t buffer_size, rtgui_xml_event_handler_t handler,
void *user)
{
rtgui_xml_t* xml = (rtgui_xml_t*) rtgui_malloc(sizeof(struct rtgui_xml));
rtgui_xml_t *xml = (rtgui_xml_t *) rtgui_malloc(sizeof(struct rtgui_xml));
rt_memset(xml, 0, sizeof(rtgui_xml_t));
xml->event_handler = handler;
@ -155,22 +158,22 @@ rtgui_xml_t* rtgui_xml_create(rt_size_t buffer_size, rtgui_xml_event_handler_t h
/* create buffer */
xml->buffer_size = buffer_size;
xml->buffer = (char*)rtgui_malloc(xml->buffer_size);
xml->buffer = (char *)rtgui_malloc(xml->buffer_size);
return xml;
}
void rtgui_xml_destroy(rtgui_xml_t* xml)
void rtgui_xml_destroy(rtgui_xml_t *xml)
{
if(xml)
if (xml)
{
rtgui_free(xml->buffer);
rtgui_free(xml);
}
}
const char* rtgui_xml_event_str(rt_uint8_t event)
const char *rtgui_xml_event_str(rt_uint8_t event)
{
switch(event)
switch (event)
{
case EVENT_START:
return "start tag";
@ -190,7 +193,7 @@ const char* rtgui_xml_event_str(rt_uint8_t event)
return "err";
}
int rtgui_xml_parse(rtgui_xml_t* xml, const char* buf, rt_size_t len)
int rtgui_xml_parse(rtgui_xml_t *xml, const char *buf, rt_size_t len)
{
int i, j, c, match;
@ -203,19 +206,19 @@ int rtgui_xml_parse(rtgui_xml_t* xml, const char* buf, rt_size_t len)
#define is_letters(ch) \
(is_alpha(ch) || is_digit(ch) || (ch == '.'))
for(i=0; i<len; i++)
for (i = 0; i < len; i++)
{
if(xml->halt) break;
if (xml->halt) break;
c = buf[i] & 0xff;
/* search in state table */
for(j=0, match = 0; RTGUI_XML_STATES[j].state != STAT_ERROR; j++)
for (j = 0, match = 0; RTGUI_XML_STATES[j].state != STAT_ERROR; j++)
{
if(RTGUI_XML_STATES[j].state != xml->state)
if (RTGUI_XML_STATES[j].state != xml->state)
continue;
switch(RTGUI_XML_STATES[j].class_type)
switch (RTGUI_XML_STATES[j].class_type)
{
case CLASS_TYPE_LETTERS:
match = is_letters(c);
@ -246,22 +249,22 @@ int rtgui_xml_parse(rtgui_xml_t* xml, const char* buf, rt_size_t len)
}
/* we matched a character class */
if(match)
if (match)
{
if(RTGUI_XML_STATES[j].event == EVENT_COPY)
if (RTGUI_XML_STATES[j].event == EVENT_COPY)
{
xml->copy = RT_TRUE;
}
else if(RTGUI_XML_STATES[j].event != EVENT_NONE)
else if (RTGUI_XML_STATES[j].event != EVENT_NONE)
{
if(xml->copy == RT_TRUE)
if (xml->copy == RT_TRUE)
{
/* basically we are guaranteed never to have an event of
type EVENT_COPY or EVENT_NONE here. */
xml->event = RTGUI_XML_STATES[j].event;
xml->buffer[xml->position] = 0; /* make a string */
if(!xml->event_handler(RTGUI_XML_STATES[j].event,
if (!xml->event_handler(RTGUI_XML_STATES[j].event,
xml->buffer, xml->position ,
xml->user))
{
@ -271,11 +274,11 @@ int rtgui_xml_parse(rtgui_xml_t* xml, const char* buf, rt_size_t len)
xml->copy = RT_FALSE;
}
}
if(xml->copy == RT_TRUE)
if (xml->copy == RT_TRUE)
{
/* check to see if we have room; one less for trailing
nul */
if(xml->position < xml->buffer_size-1)
if (xml->position < xml->buffer_size - 1)
{
xml->buffer[xml->position] = buf[i];
xml->position++;

View File

@ -3,7 +3,7 @@
#include <rtgui/rtgui.h>
typedef void (*rtgui_blit_line_func)(rt_uint8_t* dst, rt_uint8_t* src, int line);
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);

View File

@ -75,7 +75,7 @@ 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));
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
return pixel;
}
@ -99,7 +99,7 @@ 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));
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c) >> 3));
return pixel;
}

View File

@ -29,25 +29,25 @@ enum rtgui_dc_type
struct rtgui_dc_engine
{
/* interface */
void (*draw_point)(struct rtgui_dc* dc, int x, int y);
void (*draw_color_point)(struct rtgui_dc* dc, int x, int y, rtgui_color_t color);
void (*draw_vline)(struct rtgui_dc* dc, int x, int y1, int y2);
void (*draw_hline)(struct rtgui_dc* dc, int x1, int x2, int y);
void (*fill_rect )(struct rtgui_dc* dc, rtgui_rect_t* rect);
void (*blit_line) (struct rtgui_dc* dc, int x1, int x2, int y, rt_uint8_t* line_data);
void (*blit )(struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect);
void (*draw_point)(struct rtgui_dc *dc, int x, int y);
void (*draw_color_point)(struct rtgui_dc *dc, int x, int y, rtgui_color_t color);
void (*draw_vline)(struct rtgui_dc *dc, int x, int y1, int y2);
void (*draw_hline)(struct rtgui_dc *dc, int x1, int x2, int y);
void (*fill_rect)(struct rtgui_dc *dc, rtgui_rect_t *rect);
void (*blit_line)(struct rtgui_dc *dc, int x1, int x2, int y, rt_uint8_t *line_data);
void (*blit)(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect);
/* set and get graphic context */
void (*set_gc)(struct rtgui_dc* dc, struct rtgui_gc *gc);
struct rtgui_gc* (*get_gc)(struct rtgui_dc* dc);
void (*set_gc)(struct rtgui_dc *dc, struct rtgui_gc *gc);
struct rtgui_gc *(*get_gc)(struct rtgui_dc *dc);
/* get dc visible */
rt_bool_t (*get_visible)(struct rtgui_dc* dc);
rt_bool_t (*get_visible)(struct rtgui_dc *dc);
/* get dc rect */
void (*get_rect )(struct rtgui_dc* dc, rtgui_rect_t* rect);
void (*get_rect)(struct rtgui_dc *dc, rtgui_rect_t *rect);
rt_bool_t (*fini )(struct rtgui_dc* dc);
rt_bool_t (*fini)(struct rtgui_dc *dc);
};
/* the abstract device context */
@ -57,7 +57,7 @@ struct rtgui_dc
rt_uint32_t type;
/* dc engine */
const struct rtgui_dc_engine* engine;
const struct rtgui_dc_engine *engine;
};
#define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(dc)->foreground)
@ -66,46 +66,46 @@ struct rtgui_dc
#define RTGUI_DC_TEXTALIGN(dc) (rtgui_dc_get_gc(dc)->textalign)
/* create a buffer dc */
struct rtgui_dc* rtgui_dc_buffer_create(int width, int height);
rt_uint8_t* rtgui_dc_buffer_get_pixel(struct rtgui_dc* dc);
struct rtgui_dc *rtgui_dc_buffer_create(int width, int height);
rt_uint8_t *rtgui_dc_buffer_get_pixel(struct rtgui_dc *dc);
/* begin and end a drawing */
struct rtgui_dc* rtgui_dc_begin_drawing(rtgui_widget_t* owner);
void rtgui_dc_end_drawing(struct rtgui_dc* dc);
struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner);
void rtgui_dc_end_drawing(struct rtgui_dc *dc);
/* destroy a dc */
void rtgui_dc_destory(struct rtgui_dc* dc);
void rtgui_dc_destory(struct rtgui_dc *dc);
void rtgui_dc_draw_line (struct rtgui_dc* dc, int x1, int y1, int x2, int y2);
void rtgui_dc_draw_rect (struct rtgui_dc* dc, struct rtgui_rect* rect);
void rtgui_dc_fill_rect_forecolor(struct rtgui_dc* dc, struct rtgui_rect* rect);
void rtgui_dc_draw_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect, int r);
void rtgui_dc_fill_round_rect(struct rtgui_dc* dc, struct rtgui_rect* rect, int r);
void rtgui_dc_draw_line(struct rtgui_dc *dc, int x1, int y1, int x2, int y2);
void rtgui_dc_draw_rect(struct rtgui_dc *dc, struct rtgui_rect *rect);
void rtgui_dc_fill_rect_forecolor(struct rtgui_dc *dc, struct rtgui_rect *rect);
void rtgui_dc_draw_round_rect(struct rtgui_dc *dc, struct rtgui_rect *rect, int r);
void rtgui_dc_fill_round_rect(struct rtgui_dc *dc, struct rtgui_rect *rect, int r);
void rtgui_dc_draw_annulus(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r1, rt_int16_t r2, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_sector(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_fill_sector(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_text (struct rtgui_dc* dc, const char* text, struct rtgui_rect* rect);
void rtgui_dc_draw_text_stroke (struct rtgui_dc* dc, const char* text, struct rtgui_rect* rect,
void rtgui_dc_draw_text(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect);
void rtgui_dc_draw_text_stroke(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect,
rtgui_color_t color_stroke, rtgui_color_t color_core);
void rtgui_dc_draw_mono_bmp(struct rtgui_dc* dc, int x, int y, int w, int h, const rt_uint8_t* data);
void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data);
void rtgui_dc_draw_word(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data);
void rtgui_dc_draw_mono_bmp(struct rtgui_dc *dc, int x, int y, int w, int h, const rt_uint8_t *data);
void rtgui_dc_draw_byte(struct rtgui_dc *dc, int x, int y, int h, const rt_uint8_t *data);
void rtgui_dc_draw_word(struct rtgui_dc *dc, int x, int y, int h, const rt_uint8_t *data);
void rtgui_dc_draw_border(struct rtgui_dc* dc, rtgui_rect_t* rect, int flag);
void rtgui_dc_draw_horizontal_line(struct rtgui_dc* dc, int x1, int x2, int y);
void rtgui_dc_draw_vertical_line(struct rtgui_dc* dc, int x, int y1, int y2);
void rtgui_dc_draw_focus_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
void rtgui_dc_draw_border(struct rtgui_dc *dc, rtgui_rect_t *rect, int flag);
void rtgui_dc_draw_horizontal_line(struct rtgui_dc *dc, int x1, int x2, int y);
void rtgui_dc_draw_vertical_line(struct rtgui_dc *dc, int x, int y1, int y2);
void rtgui_dc_draw_focus_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
void rtgui_dc_draw_polygon(struct rtgui_dc* dc, const int *vx, const int *vy, int count);
void rtgui_dc_fill_polygon(struct rtgui_dc* dc, const int* vx, const int* vy, int count);
void rtgui_dc_draw_polygon(struct rtgui_dc *dc, const int *vx, const int *vy, int count);
void rtgui_dc_fill_polygon(struct rtgui_dc *dc, const int *vx, const int *vy, int count);
void rtgui_dc_draw_circle(struct rtgui_dc* dc, int x, int y, int r);
void rtgui_dc_fill_circle(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_int16_t r);
void rtgui_dc_draw_circle(struct rtgui_dc *dc, int x, int y, int r);
void rtgui_dc_fill_circle(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r);
void rtgui_dc_draw_arc(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_ellipse(struct rtgui_dc* dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
void rtgui_dc_draw_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
void rtgui_dc_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
/*
@ -118,7 +118,7 @@ void rtgui_dc_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_i
/*
* draw a point on dc
*/
rt_inline void rtgui_dc_draw_point(struct rtgui_dc* dc, int x, int y)
rt_inline void rtgui_dc_draw_point(struct rtgui_dc *dc, int x, int y)
{
dc->engine->draw_point(dc, x, y);
}
@ -126,7 +126,7 @@ rt_inline void rtgui_dc_draw_point(struct rtgui_dc* dc, int x, int y)
/*
* draw a color point on dc
*/
rt_inline void rtgui_dc_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgui_color_t color)
rt_inline void rtgui_dc_draw_color_point(struct rtgui_dc *dc, int x, int y, rtgui_color_t color)
{
dc->engine->draw_color_point(dc, x, y, color);
}
@ -134,7 +134,7 @@ rt_inline void rtgui_dc_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgu
/*
* draw a vertical line on dc
*/
rt_inline void rtgui_dc_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2)
rt_inline void rtgui_dc_draw_vline(struct rtgui_dc *dc, int x, int y1, int y2)
{
dc->engine->draw_vline(dc, x, y1, y2);
}
@ -142,7 +142,7 @@ rt_inline void rtgui_dc_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2)
/*
* draw a horizontal line on dc
*/
rt_inline void rtgui_dc_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y)
rt_inline void rtgui_dc_draw_hline(struct rtgui_dc *dc, int x1, int x2, int y)
{
dc->engine->draw_hline(dc, x1, x2, y);
}
@ -150,7 +150,7 @@ rt_inline void rtgui_dc_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y)
/*
* fill a rect with background color
*/
rt_inline void rtgui_dc_fill_rect (struct rtgui_dc* dc, struct rtgui_rect* rect)
rt_inline void rtgui_dc_fill_rect(struct rtgui_dc *dc, struct rtgui_rect *rect)
{
dc->engine->fill_rect(dc, rect);
}
@ -158,7 +158,7 @@ rt_inline void rtgui_dc_fill_rect (struct rtgui_dc* dc, struct rtgui_rect* rect)
/*
* blit a dc on hardware dc
*/
rt_inline void rtgui_dc_blit(struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect)
rt_inline void rtgui_dc_blit(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect)
{
dc->engine->blit(dc, dc_point, dest, rect);
}
@ -166,7 +166,7 @@ rt_inline void rtgui_dc_blit(struct rtgui_dc* dc, struct rtgui_point* dc_point,
/*
* set gc of dc
*/
rt_inline void rtgui_dc_set_gc(struct rtgui_dc* dc, rtgui_gc_t* gc)
rt_inline void rtgui_dc_set_gc(struct rtgui_dc *dc, rtgui_gc_t *gc)
{
dc->engine->set_gc(dc, gc);
}
@ -174,7 +174,7 @@ rt_inline void rtgui_dc_set_gc(struct rtgui_dc* dc, rtgui_gc_t* gc)
/*
* get gc of dc
*/
rt_inline rtgui_gc_t *rtgui_dc_get_gc(struct rtgui_dc* dc)
rt_inline rtgui_gc_t *rtgui_dc_get_gc(struct rtgui_dc *dc)
{
return dc->engine->get_gc(dc);
}
@ -182,7 +182,7 @@ rt_inline rtgui_gc_t *rtgui_dc_get_gc(struct rtgui_dc* dc)
/*
* get visible status of dc
*/
rt_inline rt_bool_t rtgui_dc_get_visible(struct rtgui_dc* dc)
rt_inline rt_bool_t rtgui_dc_get_visible(struct rtgui_dc *dc)
{
return dc->engine->get_visible(dc);
}
@ -190,7 +190,7 @@ rt_inline rt_bool_t rtgui_dc_get_visible(struct rtgui_dc* dc)
/*
* get rect of dc
*/
rt_inline void rtgui_dc_get_rect(struct rtgui_dc*dc, rtgui_rect_t* rect)
rt_inline void rtgui_dc_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect)
{
dc->engine->get_rect(dc, rect);
}

View File

@ -20,8 +20,8 @@
#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);
struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner);
void rtgui_dc_client_init(rtgui_widget_t *owner);
#endif

View File

@ -18,7 +18,7 @@
#include <rtgui/dc.h>
/* create a hardware dc */
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner);
struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner);
#endif

View File

@ -30,74 +30,74 @@
extern "C" {
#endif
struct rtgui_dlist_node
{
struct rtgui_dlist_node
{
struct rtgui_dlist_node *next; /* point to next node. */
struct rtgui_dlist_node *prev; /* point to prev node. */
};
};
/**
/**
* @brief initialize a list
*
* @param l list to be initialized
*/
rt_inline void rtgui_dlist_init(struct rtgui_dlist_node *l)
{
rt_inline void rtgui_dlist_init(struct rtgui_dlist_node *l)
{
l->next = l->prev = l;
}
}
/**
/**
* @brief insert a node after a list
*
* @param l list to insert it
* @param n new node to be inserted
*/
rt_inline void rtgui_dlist_insert_after(struct rtgui_dlist_node *l, struct rtgui_dlist_node *n)
{
rt_inline void rtgui_dlist_insert_after(struct rtgui_dlist_node *l, struct rtgui_dlist_node *n)
{
l->next->prev = n;
n->next = l->next;
l->next = n;
n->prev = l;
}
}
/**
/**
* @brief insert a node before a list
*
* @param n new node to be inserted
* @param l list to insert it
*/
rt_inline void rtgui_dlist_insert_before(struct rtgui_dlist_node *l, struct rtgui_dlist_node *n)
{
rt_inline void rtgui_dlist_insert_before(struct rtgui_dlist_node *l, struct rtgui_dlist_node *n)
{
l->prev->next = n;
n->prev = l->prev;
l->prev = n;
n->next = l;
}
}
/**
/**
* @brief remove node from list.
* @param n the node to remove from the list.
*/
rt_inline void rtgui_dlist_remove(struct rtgui_dlist_node *n)
{
rt_inline void rtgui_dlist_remove(struct rtgui_dlist_node *n)
{
n->next->prev = n->prev;
n->prev->next = n->next;
rtgui_dlist_init(n);
}
}
/**
/**
* @brief tests whether a list is empty
* @param l the list to test.
*/
rt_inline int rtgui_dlist_isempty(const struct rtgui_dlist_node *l)
{
rt_inline int rtgui_dlist_isempty(const struct rtgui_dlist_node *l)
{
return l->next == l;
}
}
/**
/**
* @brief get the struct for this entry
* @param node the entry point
* @param type the type of structure
@ -106,7 +106,7 @@ rt_inline int rtgui_dlist_isempty(const struct rtgui_dlist_node *l)
#define rtgui_dlist_entry(node, type, member) \
((type *)((char *)(node) - (unsigned long)(&((type *)0)->member)))
/* the direction can only be next or prev. If you want to iterate the list in
/* the direction can only be next or prev. If you want to iterate the list in
* normal order, use next. If you want to iterate the list with reverse order,
* use prev.*/
#define rtgui_dlist_foreach(node, list, direction) \

View File

@ -20,8 +20,8 @@
struct rtgui_graphic_driver_ops
{
/* set and get pixel in (x, y) */
void (*set_pixel) (rtgui_color_t *c, int x, int y);
void (*get_pixel) (rtgui_color_t *c, int x, int y);
void (*set_pixel)(rtgui_color_t *c, int x, int y);
void (*get_pixel)(rtgui_color_t *c, int x, int y);
void (*draw_hline)(rtgui_color_t *c, int x1, int x2, int y);
void (*draw_vline)(rtgui_color_t *c, int x , int y1, int y2);
@ -47,18 +47,18 @@ struct rtgui_graphic_driver
const struct rtgui_graphic_driver_ops *ops;
};
void rtgui_graphic_driver_add(const struct rtgui_graphic_driver* driver);
void rtgui_graphic_driver_add(const struct rtgui_graphic_driver *driver);
struct rtgui_graphic_driver* rtgui_graphic_driver_get_default(void);
struct rtgui_graphic_driver *rtgui_graphic_driver_get_default(void);
void rtgui_graphic_driver_get_rect(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver* driver, rtgui_rect_t *rect);
rt_uint8_t* rtgui_graphic_driver_get_framebuffer(const struct rtgui_graphic_driver* driver);
rt_uint8_t* rtgui_graphic_driver_get_default_framebuffer(void);
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
rt_uint8_t *rtgui_graphic_driver_get_framebuffer(const struct rtgui_graphic_driver *driver);
rt_uint8_t *rtgui_graphic_driver_get_default_framebuffer(void);
rt_err_t rtgui_graphic_set_device(rt_device_t device);
rt_inline struct rtgui_graphic_driver* rtgui_graphic_get_device()
rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device()
{
extern struct rtgui_graphic_driver _driver;
return &_driver;

View File

@ -62,19 +62,21 @@ enum _rtgui_event_type
RTGUI_EVENT_MOUSE_BUTTON, /* mouse button info */
RTGUI_EVENT_KBD, /* keyboard info */
/* user command event */
RTGUI_EVENT_COMMAND=0x0100, /* user command */
/* widget event */
RTGUI_EVENT_FOCUSED, /* widget focused */
RTGUI_EVENT_SCROLLED, /* scroll bar scrolled */
RTGUI_EVENT_RESIZE, /* widget resize */
RTGUI_EVENT_SELECTED, /* widget selected */
RTGUI_EVENT_UNSELECTED, /* widget un-selected */
RTGUI_EVENT_MV_MODEL, /* data of a model has been changed */
/* user command event. It should always be the last command type. */
RTGUI_EVENT_COMMAND = 0x0100, /* user command */
};
typedef enum _rtgui_event_type rtgui_event_type;
enum {
enum
{
RTGUI_STATUS_OK = 0, /* status ok */
RTGUI_STATUS_ERROR, /* generic error */
RTGUI_STATUS_NRC, /* no resource */
@ -83,7 +85,7 @@ enum {
struct rtgui_event
{
/* the event type */
rt_uint16_t type;
enum _rtgui_event_type type;
/* user field of event */
rt_uint16_t user;
@ -111,7 +113,7 @@ struct rtgui_event_application
{
struct rtgui_event parent;
struct rtgui_app* app;
struct rtgui_app *app;
};
/* gui application init */
@ -361,7 +363,7 @@ struct rtgui_event_focused
{
struct rtgui_event parent;
struct rtgui_widget* widget;
struct rtgui_widget *widget;
};
#define RTGUI_EVENT_FOCUSED_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_FOCUSED)
@ -376,6 +378,52 @@ struct rtgui_event_resize
};
#define RTGUI_EVENT_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_RESIZE)
/*
* RTGUI Model/View Event
*/
enum rtgui_event_model_mode
{
RTGUI_MV_DATA_ADDED,
RTGUI_MV_DATA_CHANGED,
RTGUI_MV_DATA_DELETED,
};
struct rtgui_event_mv_model
{
struct rtgui_event parent;
struct rtgui_mv_model *model;
struct rtgui_mv_view *view;
rt_size_t first_data_changed_idx;
rt_size_t last_data_changed_idx;
};
#define _RTGUI_EVENT_MV_INIT_TYPE(T) \
rt_inline void RTGUI_EVENT_MV_MODEL_##T##_INIT(struct rtgui_event_mv_model *e) \
{ \
RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MV_MODEL); \
(e)->parent.user = RTGUI_MV_DATA_##T; \
} \
/* useless struct to allow trailing semicolon */ \
struct dummy
_RTGUI_EVENT_MV_INIT_TYPE(ADDED);
_RTGUI_EVENT_MV_INIT_TYPE(CHANGED);
_RTGUI_EVENT_MV_INIT_TYPE(DELETED);
#undef _RTGUI_EVENT_MV_INIT_TYPE
#define _RTGUI_EVENT_MV_IS_TYPE(T) \
rt_inline rt_bool_t RTGUI_EVENT_MV_MODEL_IS_##T(struct rtgui_event_mv_model *e) \
{ \
return e->parent.user == RTGUI_MV_DATA_##T; \
} \
/* useless struct to allow trailing semicolon */ \
struct dummy
_RTGUI_EVENT_MV_IS_TYPE(ADDED);
_RTGUI_EVENT_MV_IS_TYPE(CHANGED);
_RTGUI_EVENT_MV_IS_TYPE(DELETED);
#undef _RTGUI_EVENT_MV_IS_TYPE
#undef _RTGUI_EVENT_WIN_ELEMENTS
union rtgui_event_generic
@ -407,9 +455,10 @@ union rtgui_event_generic
struct rtgui_event_clip_info clip_info;
struct rtgui_event_mouse mouse;
struct rtgui_event_kbd kbd;
struct rtgui_event_command command;
struct rtgui_event_scrollbar scrollbar;
struct rtgui_event_focused focused;
struct rtgui_event_resize resize;
struct rtgui_event_mv_model model;
struct rtgui_event_command command;
};
#endif

View File

@ -15,7 +15,7 @@
#define __RTGUI_FILERW_H__
#ifdef RTGUI_USING_DFS_FILERW
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#pragma warning(disable: 4996)
#include <fcntl.h>
#include <sys/types.h>
@ -34,27 +34,27 @@
struct rtgui_filerw
{
int (*seek) (struct rtgui_filerw *context, rt_off_t offset, int whence);
int (*read) (struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int (*seek)(struct rtgui_filerw *context, rt_off_t offset, int whence);
int (*read)(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int (*write)(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count);
int (*tell) (struct rtgui_filerw *context);
int (*eof) (struct rtgui_filerw *context);
int (*tell)(struct rtgui_filerw *context);
int (*eof)(struct rtgui_filerw *context);
int (*close)(struct rtgui_filerw *context);
};
typedef struct rtgui_filerw rtgui_filerw_t;
struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char* mode);
struct rtgui_filerw* rtgui_filerw_create_mem(const rt_uint8_t* mem, rt_size_t size);
struct rtgui_filerw *rtgui_filerw_create_file(const char *filename, const char *mode);
struct rtgui_filerw *rtgui_filerw_create_mem(const rt_uint8_t *mem, rt_size_t size);
int rtgui_filerw_seek (struct rtgui_filerw* context, rt_off_t offset, int whence);
int rtgui_filerw_read (struct rtgui_filerw* context, void* buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_write(struct rtgui_filerw* context, const void* buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_tell (struct rtgui_filerw* context);
int rtgui_filerw_eof (struct rtgui_filerw* context);
int rtgui_filerw_close(struct rtgui_filerw* context);
int rtgui_filerw_seek(struct rtgui_filerw *context, rt_off_t offset, int whence);
int rtgui_filerw_read(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_write(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_tell(struct rtgui_filerw *context);
int rtgui_filerw_eof(struct rtgui_filerw *context);
int rtgui_filerw_close(struct rtgui_filerw *context);
int rtgui_filerw_unlink(const char *filename);
/* get memory data from filerw memory object */
const rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context);
const rt_uint8_t *rtgui_filerw_mem_getdata(struct rtgui_filerw *context);
#endif

View File

@ -24,12 +24,12 @@ struct rtgui_rect;
struct rtgui_font_engine
{
/* font engine function */
void (*font_init)(struct rtgui_font* font);
void (*font_load)(struct rtgui_font* font);
void (*font_init)(struct rtgui_font *font);
void (*font_load)(struct rtgui_font *font);
void (*font_draw_text)(struct rtgui_font* font, struct rtgui_dc* dc, const char* text,
rt_ubase_t len, struct rtgui_rect* rect);
void (*font_get_metrics)(struct rtgui_font* font, const char* text, struct rtgui_rect* rect);
void (*font_draw_text)(struct rtgui_font *font, struct rtgui_dc *dc, const char *text,
rt_ubase_t len, struct rtgui_rect *rect);
void (*font_get_metrics)(struct rtgui_font *font, const char *text, struct rtgui_rect *rect);
};
/*
@ -37,9 +37,9 @@ struct rtgui_font_engine
*/
struct rtgui_font_bitmap
{
const rt_uint8_t* bmp; /* bitmap font data */
const rt_uint8_t* char_width; /* each character width, NULL for fixed font */
const rt_uint32_t* offset; /* offset for each character */
const rt_uint8_t *bmp; /* bitmap font data */
const rt_uint8_t *char_width; /* each character width, NULL for fixed font */
const rt_uint32_t *offset; /* offset for each character */
rt_uint16_t width; /* font width */
rt_uint16_t height; /* font height */
@ -71,14 +71,14 @@ struct rtgui_hz_file_font
int fd;
/* font file name */
const char* font_fn;
const char *font_fn;
};
extern const struct rtgui_font_engine rtgui_hz_file_font_engine;
struct rtgui_font
{
/* font name */
char* family;
char *family;
/* font height */
rt_uint16_t height;
@ -87,10 +87,10 @@ struct rtgui_font
rt_uint32_t refer_count;
/* font engine */
const struct rtgui_font_engine* engine;
const struct rtgui_font_engine *engine;
/* font private data */
void* data;
void *data;
/* the font list */
rtgui_list_t list;
@ -98,17 +98,21 @@ struct rtgui_font
typedef struct rtgui_font rtgui_font_t;
void rtgui_font_system_init(void);
void rtgui_font_system_add_font(struct rtgui_font* font);
void rtgui_font_system_remove_font(struct rtgui_font* font);
struct rtgui_font* rtgui_font_default(void);
void rtgui_font_set_defaut(struct rtgui_font* font);
void rtgui_font_system_add_font(struct rtgui_font *font);
void rtgui_font_system_remove_font(struct rtgui_font *font);
struct rtgui_font *rtgui_font_default(void);
void rtgui_font_set_defaut(struct rtgui_font *font);
struct rtgui_font* rtgui_font_refer(const rt_uint8_t* family, rt_uint16_t height);
void rtgui_font_derefer(struct rtgui_font* font);
struct rtgui_font *rtgui_font_refer(const char *family, rt_uint16_t height);
void rtgui_font_derefer(struct rtgui_font *font);
/* draw a text */
void rtgui_font_draw(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect);
int rtgui_font_get_string_width(struct rtgui_font* font, const char* text);
void rtgui_font_get_metrics(struct rtgui_font* font, const char* text, struct rtgui_rect* rect);
void rtgui_font_draw(struct rtgui_font *font, struct rtgui_dc *dc, const char *text, rt_ubase_t len, struct rtgui_rect *rect);
int rtgui_font_get_string_width(struct rtgui_font *font, const char *text);
void rtgui_font_get_metrics(struct rtgui_font *font, const char *text, struct rtgui_rect *rect);
/* used by stract font */
#define FONT_BMP_DATA_BEGIN
#define FONT_BMP_DATA_END
#endif

View File

@ -4,7 +4,7 @@
#include <rtgui/dc.h>
#include <rtgui/font.h>
rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int italic, rt_size_t size);
void rtgui_freetype_font_destroy(rtgui_font_t* font);
rtgui_font_t *rtgui_freetype_font_create(const char *filename, int bold, int italic, rt_size_t size);
void rtgui_freetype_font_destroy(rtgui_font_t *font);
#endif

View File

@ -27,23 +27,23 @@ enum rtgui_img_zoom
struct rtgui_image;
struct rtgui_image_engine
{
const char* name;
const char *name;
struct rtgui_list_node list;
/* image engine function */
rt_bool_t (*image_check)(struct rtgui_filerw* file);
rt_bool_t (*image_check)(struct rtgui_filerw *file);
rt_bool_t (*image_load)(struct rtgui_image* image, struct rtgui_filerw* file, rt_bool_t load);
void (*image_unload)(struct rtgui_image* image);
rt_bool_t (*image_load)(struct rtgui_image *image, struct rtgui_filerw *file, rt_bool_t load);
void (*image_unload)(struct rtgui_image *image);
void (*image_blit)(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect);
struct rtgui_image* (*image_zoom)(struct rtgui_image* image, float scalew, float scaleh, rt_uint32_t mode);
struct rtgui_image* (*image_rotate)(struct rtgui_image* image, float angle);
void (*image_blit)(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
struct rtgui_image *(*image_zoom)(struct rtgui_image *image, float scalew, float scaleh, rt_uint32_t mode);
struct rtgui_image *(*image_rotate)(struct rtgui_image *image, float angle);
};
struct rtgui_image_palette
{
rtgui_color_t* colors;
rtgui_color_t *colors;
rt_uint32_t ncolors;
};
typedef struct rtgui_image_palette rtgui_image_palette_t;
@ -54,13 +54,13 @@ struct rtgui_image
rt_uint16_t w, h;
/* image engine */
const struct rtgui_image_engine* engine;
const struct rtgui_image_engine *engine;
/* image palette */
rtgui_image_palette_t* palette;
rtgui_image_palette_t *palette;
/* image private data */
void* data;
void *data;
};
typedef struct rtgui_image rtgui_image_t;
@ -68,24 +68,24 @@ typedef struct rtgui_image rtgui_image_t;
void rtgui_system_image_init(void);
#if defined(RTGUI_USING_DFS_FILERW)
struct rtgui_image_engine* rtgui_image_get_engine_by_filename(const char* fn);
struct rtgui_image* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load);
struct rtgui_image* rtgui_image_create(const char* filename, rt_bool_t load);
struct rtgui_image_engine *rtgui_image_get_engine_by_filename(const char *fn);
struct rtgui_image *rtgui_image_create_from_file(const char *type, const char *filename, rt_bool_t load);
struct rtgui_image *rtgui_image_create(const char *filename, rt_bool_t load);
#endif
struct rtgui_image* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length, rt_bool_t load);
void rtgui_image_destroy(struct rtgui_image* image);
struct rtgui_image *rtgui_image_create_from_mem(const char *type, const rt_uint8_t *data, rt_size_t length, rt_bool_t load);
void rtgui_image_destroy(struct rtgui_image *image);
/* get image's rect */
void rtgui_image_get_rect(struct rtgui_image* image, struct rtgui_rect* rect);
void rtgui_image_get_rect(struct rtgui_image *image, struct rtgui_rect *rect);
/* register an image engine */
void rtgui_image_register_engine(struct rtgui_image_engine* engine);
void rtgui_image_register_engine(struct rtgui_image_engine *engine);
/* blit an image on DC */
void rtgui_image_blit(struct rtgui_image* image, struct rtgui_dc* dc, struct rtgui_rect* rect);
struct rtgui_image_palette* rtgui_image_palette_create(rt_uint32_t ncolors);
rtgui_image_t* rtgui_image_zoom(rtgui_image_t* image, float scalew, float scaleh, rt_uint32_t mode);
rtgui_image_t* rtgui_image_rotate(rtgui_image_t* image, float angle);
void rtgui_image_blit(struct rtgui_image *image, struct rtgui_dc *dc, struct rtgui_rect *rect);
struct rtgui_image_palette *rtgui_image_palette_create(rt_uint32_t ncolors);
rtgui_image_t *rtgui_image_zoom(rtgui_image_t *image, float scalew, float scaleh, rt_uint32_t mode);
rtgui_image_t *rtgui_image_rotate(rtgui_image_t *image, float angle);
#endif

View File

@ -38,7 +38,7 @@ struct rtgui_image_bmp_header
rt_uint32_t biClrUsed;
rt_uint32_t biClrImportant;
};
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#pragma warning(disable : 4103)
#endif
void rtgui_image_bmp_init(void);

View File

@ -17,11 +17,11 @@ typedef struct rtgui_image_item rtgui_image_item_t;
void rtgui_system_image_container_init(rt_bool_t load);
#ifdef RTGUI_USING_DFS_FILERW
rtgui_image_item_t* rtgui_image_container_get(const char* filename);
rtgui_image_item_t *rtgui_image_container_get(const char *filename);
#endif
rtgui_image_item_t* rtgui_image_container_get_from_mem(const rt_uint8_t* mem, const char* type, rt_uint32_t len);
rtgui_image_item_t *rtgui_image_container_get_from_mem(const rt_uint8_t *mem, const char *type, rt_uint32_t len);
void rtgui_image_container_put(rtgui_image_item_t* item);
void rtgui_image_container_put(rtgui_image_item_t *item);
#endif
#endif

View File

@ -269,7 +269,8 @@ typedef enum
} RTGUI_KBD_KEY;
/* Enumeration of valid key mods (possibly OR'd together) */
typedef enum {
typedef enum
{
RTGUI_KMOD_NONE = 0x0000,
RTGUI_KMOD_LSHIFT = 0x0001,
RTGUI_KMOD_RSHIFT = 0x0002,
@ -285,7 +286,8 @@ typedef enum {
RTGUI_KMOD_RESERVED = 0x8000
} RTGUI_KBD_MOD;
typedef enum {
typedef enum
{
RTGUI_KEYDOWN, /* Keys pressed */
RTGUI_KEYUP, /* Keys released */
} RTGUI_KBD_TYPE;

View File

@ -18,7 +18,7 @@
struct rtgui_list_node
{
struct rtgui_list_node* next;
struct rtgui_list_node *next;
};
typedef struct rtgui_list_node rtgui_list_t;
@ -29,14 +29,14 @@ rt_inline void rtgui_list_init(rtgui_list_t *l)
rt_inline void rtgui_list_append(rtgui_list_t *l, rtgui_list_t *n)
{
struct rtgui_list_node* node;
struct rtgui_list_node *node;
node = l;
while (node->next) node = node->next;
/* append the node to the tail */
node->next = n;
n->next = (struct rtgui_list_node*) 0;
n->next = (struct rtgui_list_node *) 0;
}
rt_inline void rtgui_list_insert(rtgui_list_t *l, rtgui_list_t *n)
@ -45,10 +45,10 @@ rt_inline void rtgui_list_insert(rtgui_list_t *l, rtgui_list_t *n)
l->next = n;
}
rt_inline rtgui_list_t* rtgui_list_remove(rtgui_list_t *l, rtgui_list_t *n)
rt_inline rtgui_list_t *rtgui_list_remove(rtgui_list_t *l, rtgui_list_t *n)
{
/* remove slist head */
struct rtgui_list_node* node = l;
struct rtgui_list_node *node = l;
while (node->next && node->next != n) node = node->next;
/* remove node */

View File

@ -20,81 +20,81 @@
extern "C" {
#endif
typedef struct rtgui_region_data rtgui_region_data_t;
typedef struct rtgui_region_data rtgui_region_data_t;
struct rtgui_region_data
{
struct rtgui_region_data
{
rt_uint32_t size;
rt_uint32_t numRects;
/* XXX: And why, exactly, do we have this bogus struct definition? */
/* rtgui_rect_t rects[size]; in memory but not explicitly declared */
};
};
typedef struct rtgui_region
{
typedef struct rtgui_region
{
rtgui_rect_t extents;
rtgui_region_data_t *data;
}rtgui_region_t;
} rtgui_region_t;
typedef enum
{
typedef enum
{
RTGUI_REGION_STATUS_FAILURE,
RTGUI_REGION_STATUS_SUCCESS
}rtgui_region_status_t;
} rtgui_region_status_t;
/* creation/destruction */
/* creation/destruction */
void rtgui_region_init(rtgui_region_t *region);
void rtgui_region_init_rect(rtgui_region_t *region,
void rtgui_region_init(rtgui_region_t *region);
void rtgui_region_init_rect(rtgui_region_t *region,
int x, int y, unsigned int width, unsigned int height);
void rtgui_region_init_with_extents(rtgui_region_t *region, const rtgui_rect_t *extents);
void rtgui_region_fini (rtgui_region_t *region);
void rtgui_region_init_with_extents(rtgui_region_t *region, const rtgui_rect_t *extents);
void rtgui_region_fini(rtgui_region_t *region);
void rtgui_region_translate (rtgui_region_t *region, int x, int y);
void rtgui_region_translate(rtgui_region_t *region, int x, int y);
rtgui_region_status_t rtgui_region_copy (rtgui_region_t *dest, rtgui_region_t *source);
rtgui_region_status_t rtgui_region_copy(rtgui_region_t *dest, rtgui_region_t *source);
rtgui_region_status_t rtgui_region_intersect (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
rtgui_region_status_t rtgui_region_intersect_rect (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_union (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
rtgui_region_status_t rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect_t* rect);
rtgui_region_status_t rtgui_region_subtract (rtgui_region_t *regD, rtgui_region_t *regM, rtgui_region_t *regS);
rtgui_region_status_t rtgui_region_subtract_rect (rtgui_region_t *regD, rtgui_region_t *regM, rtgui_rect_t* rect);
rtgui_region_status_t rtgui_region_inverse (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *invRect);
rtgui_region_status_t rtgui_region_intersect(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
rtgui_region_status_t rtgui_region_intersect_rect(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_union(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
rtgui_region_status_t rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_subtract(rtgui_region_t *regD, rtgui_region_t *regM, rtgui_region_t *regS);
rtgui_region_status_t rtgui_region_subtract_rect(rtgui_region_t *regD, rtgui_region_t *regM, rtgui_rect_t *rect);
rtgui_region_status_t rtgui_region_inverse(rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *invRect);
int rtgui_region_num_rects (rtgui_region_t *region);
int rtgui_region_num_rects(rtgui_region_t *region);
rtgui_rect_t* rtgui_region_rects (rtgui_region_t *region);
rtgui_rect_t *rtgui_region_rects(rtgui_region_t *region);
#define RTGUI_REGION_OUT 0
#define RTGUI_REGION_IN 1
#define RTGUI_REGION_PART 2
int rtgui_region_contains_point (rtgui_region_t *region, int x, int y, rtgui_rect_t *box);
int rtgui_region_contains_rectangle (rtgui_region_t *rtgui_region_t, rtgui_rect_t *prect);
int rtgui_region_contains_point(rtgui_region_t *region, int x, int y, rtgui_rect_t *box);
int rtgui_region_contains_rectangle(rtgui_region_t *rtgui_region_t, rtgui_rect_t *prect);
int rtgui_region_not_empty (rtgui_region_t *region);
rtgui_rect_t *rtgui_region_extents (rtgui_region_t *region);
int rtgui_region_not_empty(rtgui_region_t *region);
rtgui_rect_t *rtgui_region_extents(rtgui_region_t *region);
rtgui_region_status_t rtgui_region_append (rtgui_region_t *dest, rtgui_region_t *region);
rtgui_region_status_t rtgui_region_validate (rtgui_region_t *badreg, int *pOverlap);
rtgui_region_status_t rtgui_region_append(rtgui_region_t *dest, rtgui_region_t *region);
rtgui_region_status_t rtgui_region_validate(rtgui_region_t *badreg, int *pOverlap);
void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t* rect);
void rtgui_region_empty (rtgui_region_t *region);
void rtgui_region_dump(rtgui_region_t* region);
int rtgui_region_is_flat(rtgui_region_t* region);
void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t *rect);
void rtgui_region_empty(rtgui_region_t *region);
void rtgui_region_dump(rtgui_region_t *region);
int rtgui_region_is_flat(rtgui_region_t *region);
/* rect functions */
extern rtgui_rect_t rtgui_empty_rect;
/* rect functions */
extern rtgui_rect_t rtgui_empty_rect;
void rtgui_rect_moveto(rtgui_rect_t *rect, int x, int y);
void rtgui_rect_moveto_align(rtgui_rect_t *rect, rtgui_rect_t *to, int align);
void rtgui_rect_inflate(rtgui_rect_t *rect, int d);
void rtgui_rect_intersect(rtgui_rect_t *src, rtgui_rect_t *dest);
int rtgui_rect_contains_point(const rtgui_rect_t *rect, int x, int y);
int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
rt_bool_t rtgui_rect_is_empty(const rtgui_rect_t *rect);
void rtgui_rect_moveto(rtgui_rect_t *rect, int x, int y);
void rtgui_rect_moveto_align(rtgui_rect_t *rect, rtgui_rect_t *to, int align);
void rtgui_rect_inflate(rtgui_rect_t *rect, int d);
void rtgui_rect_intersect(rtgui_rect_t *src, rtgui_rect_t *dest);
int rtgui_rect_contains_point(const rtgui_rect_t *rect, int x, int y);
int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
rt_bool_t rtgui_rect_is_empty(const rtgui_rect_t *rect);
#if defined(__cplusplus) || defined(c_plusplus)
}

View File

@ -29,8 +29,8 @@ struct rtgui_win;
struct rtgui_font;
typedef struct rtgui_win rtgui_win_t;
typedef rt_bool_t (*rtgui_event_handler_ptr)(struct rtgui_object* object, struct rtgui_event* event);
typedef void (*rtgui_onbutton_func_t)(struct rtgui_object* object, struct rtgui_event* event);
typedef rt_bool_t (*rtgui_event_handler_ptr)(struct rtgui_object *object, struct rtgui_event *event);
typedef void (*rtgui_onbutton_func_t)(struct rtgui_object *object, struct rtgui_event *event);
/**
* Coordinate point
@ -69,7 +69,7 @@ struct rtgui_gc
rt_uint16_t textalign;
/* font */
struct rtgui_font* font;
struct rtgui_font *font;
};
typedef struct rtgui_gc rtgui_gc_t;

View File

@ -43,7 +43,7 @@ struct rtgui_app
/* application name */
unsigned char *name;
struct rtgui_image* icon;
struct rtgui_image *icon;
enum rtgui_app_flag state_flag;

View File

@ -18,42 +18,9 @@
/* RTGUI options */
#ifdef _WIN32
/* name length of RTGUI object */
#define RTGUI_NAME_MAX 12
/* support 16 weight font */
#define RTGUI_USING_FONT16
/* support Chinese font */
#define RTGUI_USING_FONTHZ
/* support FreeType TTF font */
//#define RTGUI_USING_TTF
/* use small size in RTGUI */
#define RTGUI_USING_SMALL_SIZE
/* use mouse cursor */
/* #define RTGUI_USING_MOUSE_CURSOR */
/* default font size in RTGUI */
#define RTGUI_DEFAULT_FONT_SIZE 12
#define RTGUI_USING_STDIO_FILERW
#define RTGUI_USING_DFS_FILERW
#define RTGUI_IMAGE_CONTAINER
#define RTGUI_IMAGE_XPM
#define RTGUI_IMAGE_BMP
#define RTGUI_IMAGE_PNG
// #define RTGUI_IMAGE_JPEG
// #define RTGUI_IMAGE_TJPGD
#define RTGUI_USING_FONT12
#define RTGUI_USING_HZ_BMP
#define RTGUI_MEM_TRACE
#define RTGUI_USING_WINMOVE
#define RTGUI_USING_NOTEBOOK_IMAGE
// #define RTGUI_USING_HZ_FILE
#else
/* native running under RT-Thread */
#ifndef RT_USING_DFS
#undef RTGUI_USING_DFS_FILERW
#undef RTGUI_USING_HZ_FILE
#endif
#ifndef RT_USING_DFS
#undef RTGUI_USING_DFS_FILERW
#undef RTGUI_USING_HZ_FILE
#endif
#if RTGUI_DEFAULT_FONT_SIZE == 0
@ -79,6 +46,6 @@
#define RTGUI_USING_CAST_CHECK
//#define RTGUI_USING_DESKTOP_WINDOW
#undef RTGUI_USING_SMALL_SIZE
//#undef RTGUI_USING_SMALL_SIZE
#endif

View File

@ -0,0 +1,58 @@
/*
* File : rtgui_mv_model.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, 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
* 2012-09-15 Grissiom first version
*/
#ifndef __RTGUI_MV_MODEL_H__
#define __RTGUI_MV_MODEL_H__
#include <rtgui/rtgui.h>
#include <rtgui/widgets/mv_view.h>
DECLARE_CLASS_TYPE(mv_model);
/** Gets the type of a mv_model */
#define RTGUI_MV_MODEL_TYPE (RTGUI_TYPE(mv_model))
/** Casts the object to an mv_model */
#define RTGUI_MV_MODEL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MV_MODEL_TYPE, struct rtgui_mv_model))
/** Checks if the object is an mv_model */
#define RTGUI_IS_MV_MODEL(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_MV_MODEL_TYPE))
struct rtgui_mv_model
{
struct rtgui_object parent;
rt_uint16_t dimension;
rt_uint16_t view_number;
/* the length of data */
rt_uint16_t length;
/* if the dimension is 1, the data is the pointer to the data. If the
* dimension is more than 1, data is a pointer to a array of pointers to
* data. */
void *data;
/* the content of view is like the content of data. If a model has more
* then one view, view is pointed to an array of pointers to views. */
void *view;
};
struct rtgui_mv_model *rtgui_mv_model_create(rt_uint16_t dimension);
void rtgui_mv_model_destroy(struct rtgui_mv_model *model);
rt_err_t rtgui_mv_model_set_dimension(struct rtgui_mv_model *model, rt_uint16_t dimension);
rt_err_t rtgui_mv_model_add_view(struct rtgui_mv_model *, struct rtgui_mv_view *);
void rtgui_mv_model_remove_view(struct rtgui_mv_model *, struct rtgui_mv_view *);
rt_bool_t rtgui_mv_model_has_view(struct rtgui_mv_model *model, struct rtgui_mv_view *view);
void rtgui_mv_model_set_data(struct rtgui_mv_model *model, rt_uint16_t dim, void *p);
void *rtgui_mv_model_get_data(struct rtgui_mv_model *model, rt_uint16_t dim);
void rtgui_mv_model_notify(struct rtgui_mv_model *model, struct rtgui_event_mv_model *em);
#endif /* end of include guard: __RTGUI_MV_MODEL_H__ */

View File

@ -22,26 +22,26 @@
extern "C" {
#endif
/* rtgui object type */
/* rtgui object type */
#define RTGUI_CONTAINER_OF(obj, type, member) \
((type *)((char *)(obj) - (unsigned long)(&((type *)0)->member)))
/** Casts the function pointer to an rtgui_constructor */
/** Casts the function pointer to an rtgui_constructor */
#define RTGUI_CONSTRUCTOR(constructor) ((rtgui_constructor_t)(constructor))
/** Casts the function pointer to an rtgui_constructor */
/** Casts the function pointer to an rtgui_constructor */
#define RTGUI_DESTRUCTOR(destructor) ((rtgui_destructor_t)(destructor))
/* pre-definition */
struct rtgui_object;
typedef struct rtgui_object rtgui_object_t;
typedef void (*rtgui_constructor_t)(rtgui_object_t *object);
typedef void (*rtgui_destructor_t)(rtgui_object_t *object);
/* pre-definition */
struct rtgui_object;
typedef struct rtgui_object rtgui_object_t;
typedef void (*rtgui_constructor_t)(rtgui_object_t *object);
typedef void (*rtgui_destructor_t)(rtgui_object_t *object);
/* rtgui type structure */
struct rtgui_type
{
/* rtgui type structure */
struct rtgui_type
{
/* type name */
char* name;
char *name;
/* parent type link */
struct rtgui_type *parent;
@ -52,8 +52,8 @@ struct rtgui_type
/* size of type */
int size;
};
typedef struct rtgui_type rtgui_type_t;
};
typedef struct rtgui_type rtgui_type_t;
#define RTGUI_TYPE(type) (struct rtgui_type*)&(_rtgui_##type)
#define DECLARE_CLASS_TYPE(type) extern const struct rtgui_type _rtgui_##type
@ -65,58 +65,58 @@ typedef struct rtgui_type rtgui_type_t;
RTGUI_DESTRUCTOR(destructor), \
size }
void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object);
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object);
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent);
const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type);
const char *rtgui_type_name_get(const rtgui_type_t *type);
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object);
void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object);
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object);
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent);
const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type);
const char *rtgui_type_name_get(const rtgui_type_t *type);
const rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object);
#ifdef RTGUI_USING_CAST_CHECK
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) \
((c_type *)rtgui_object_check_cast((rtgui_object_t *)(obj), (obj_type), __FUNCTION__, __LINE__))
#else
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj))
#define RTGUI_OBJECT_CAST(obj, obj_type, c_type) ((c_type *)(obj))
#endif
#define RTGUI_OBJECT_CHECK_TYPE(_obj, _type) \
(rtgui_type_inherits_from(((rtgui_object_t *)(_obj))->type, (_type)))
DECLARE_CLASS_TYPE(object);
/** Gets the type of an object */
DECLARE_CLASS_TYPE(object);
/** Gets the type of an object */
#define RTGUI_OBJECT_TYPE RTGUI_TYPE(object)
/** Casts the object to an rtgui_object_t */
/** Casts the object to an rtgui_object_t */
#define RTGUI_OBJECT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_OBJECT_TYPE, struct rtgui_object))
/** Checks if the object is an rtgui_Object */
/** Checks if the object is an rtgui_Object */
#define RTGUI_IS_OBJECT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_OBJECT_TYPE))
enum rtgui_object_flag
{
enum rtgui_object_flag
{
RTGUI_OBJECT_FLAG_NONE = 0x00,
RTGUI_OBJECT_FLAG_STATIC = 0x01,
RTGUI_OBJECT_FLAG_DISABLED = 0x02
};
};
/* rtgui base object */
struct rtgui_object
{
/* rtgui base object */
struct rtgui_object
{
/* object type */
const rtgui_type_t* type;
const rtgui_type_t *type;
/* the event handler */
rtgui_event_handler_ptr event_handler;
enum rtgui_object_flag flag;
};
};
rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type);
void rtgui_object_destroy(rtgui_object_t *object);
rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type);
void rtgui_object_destroy(rtgui_object_t *object);
/* set the event handler of object */
void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_handler_ptr handler);
/* object default event handler */
rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event* event);
/* helper micro. widget event handlers could use this. */
/* set the event handler of object */
void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_handler_ptr handler);
/* object default event handler */
rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_event *event);
/* helper micro. widget event handlers could use this. */
#define RTGUI_WIDGET_EVENT_HANDLER_PREPARE \
struct rtgui_widget *widget; \
RT_ASSERT(object != RT_NULL); \
@ -125,21 +125,21 @@ rt_bool_t rtgui_object_event_handler(struct rtgui_object *object, struct rtgui_e
/* supress compiler warning */ \
widget = widget;
/** handle @param event on @param object's own event handler
/** handle @param event on @param object's own event handler
*
* If the @param object does not have an event handler, which means the object
* does not interested in any event, it will return RT_FALSE. Otherwise, the
* return code of that handler is returned.
*/
rt_inline rt_bool_t rtgui_object_handle(struct rtgui_object *object, struct rtgui_event *event)
{
rt_inline rt_bool_t rtgui_object_handle(struct rtgui_object *object, struct rtgui_event *event)
{
if (object->event_handler)
return object->event_handler(object, event);
return RT_FALSE;
}
}
rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *object, rtgui_type_t *type, const char* func, int line);
rtgui_type_t *rtk_object_object_type_get(rtgui_object_t *object);
rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *object, rtgui_type_t *type, const char *func, int line);
rtgui_type_t *rtk_object_object_type_get(rtgui_object_t *object);
#ifdef __cplusplus
}

View File

@ -51,10 +51,10 @@ struct rtgui_topwin
/* event mask */
rt_uint32_t mask;
struct rtgui_wintitle* title;
struct rtgui_wintitle *title;
/* the window id */
struct rtgui_win* wid;
struct rtgui_win *wid;
/* the thread id */
rt_thread_t tid;
@ -79,8 +79,8 @@ void rtgui_topwin_init(void);
void rtgui_server_init(void);
/* post an event to server */
void rtgui_server_post_event(struct rtgui_event* event, rt_size_t size);
rt_err_t rtgui_server_post_event_sync(struct rtgui_event* event, rt_size_t size);
void rtgui_server_post_event(struct rtgui_event *event, rt_size_t size);
rt_err_t rtgui_server_post_event_sync(struct rtgui_event *event, rt_size_t size);
#endif

View File

@ -22,7 +22,7 @@ struct rtgui_event;
struct rtgui_widget;
struct rtgui_timer;
typedef void (*rtgui_timeout_func)(struct rtgui_timer* timer, void* parameter);
typedef void (*rtgui_timeout_func)(struct rtgui_timer *timer, void *parameter);
struct rtgui_timer
{
@ -33,24 +33,24 @@ struct rtgui_timer
/* timeout function and user data */
rtgui_timeout_func timeout;
void* user_data;
void *user_data;
};
typedef struct rtgui_timer rtgui_timer_t;
rtgui_timer_t* rtgui_timer_create(rt_int32_t time, rt_base_t flag, rtgui_timeout_func timeout, void* parameter);
void rtgui_timer_destory(rtgui_timer_t* timer);
rtgui_timer_t *rtgui_timer_create(rt_int32_t time, rt_base_t flag, rtgui_timeout_func timeout, void *parameter);
void rtgui_timer_destory(rtgui_timer_t *timer);
void rtgui_timer_start(rtgui_timer_t* timer);
void rtgui_timer_stop (rtgui_timer_t* timer);
void rtgui_timer_start(rtgui_timer_t *timer);
void rtgui_timer_stop(rtgui_timer_t *timer);
/* rtgui system initialization function */
void rtgui_system_server_init(void);
void* rtgui_malloc(rt_size_t size);
void rtgui_free(void* ptr);
void* rtgui_realloc(void* ptr, rt_size_t size);
void *rtgui_malloc(rt_size_t size);
void rtgui_free(void *ptr);
void *rtgui_realloc(void *ptr, rt_size_t size);
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#define rtgui_enter_critical()
#define rtgui_exit_critical()
#else
@ -67,12 +67,12 @@ void rtgui_screen_lock(rt_int32_t timeout);
void rtgui_screen_unlock(void);
struct rtgui_event;
rt_err_t rtgui_send(rt_thread_t tid, struct rtgui_event* event, rt_size_t event_size);
rt_err_t rtgui_send_urgent(rt_thread_t tid, struct rtgui_event* event, rt_size_t event_size);
rt_err_t rtgui_send_sync(rt_thread_t tid, struct rtgui_event* event, rt_size_t event_size);
rt_err_t rtgui_ack(struct rtgui_event* event, rt_int32_t status);
rt_err_t rtgui_recv(struct rtgui_event* event, rt_size_t event_size);
rt_err_t rtgui_recv_nosuspend(struct rtgui_event* event, rt_size_t event_size);
rt_err_t rtgui_recv_filter(rt_uint32_t type, struct rtgui_event* event, rt_size_t event_size);
rt_err_t rtgui_send(rt_thread_t tid, struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_send_urgent(rt_thread_t tid, struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_send_sync(rt_thread_t tid, struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_ack(struct rtgui_event *event, rt_int32_t status);
rt_err_t rtgui_recv(struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_recv_nosuspend(struct rtgui_event *event, rt_size_t event_size);
rt_err_t rtgui_recv_filter(rt_uint32_t type, struct rtgui_event *event, rt_size_t event_size);
#endif

View File

@ -38,27 +38,26 @@
extern "C" {
#endif
void rtgui_system_theme_init(void);
void rtgui_system_theme_init(void);
void rtgui_theme_draw_win(struct rtgui_topwin* win);
void rtgui_theme_draw_button(rtgui_button_t* btn);
void rtgui_theme_draw_label(rtgui_label_t* label);
void rtgui_theme_draw_textbox(rtgui_textbox_t* box);
void rtgui_theme_draw_iconbox(rtgui_iconbox_t* iconbox);
void rtgui_theme_draw_checkbox(rtgui_checkbox_t* checkbox);
void rtgui_theme_draw_radiobutton(struct rtgui_radiobox* radiobox, rt_uint16_t item);
void rtgui_theme_draw_win(struct rtgui_topwin *win);
void rtgui_theme_draw_button(rtgui_button_t *btn);
void rtgui_theme_draw_label(rtgui_label_t *label);
void rtgui_theme_draw_textbox(rtgui_textbox_t *box);
void rtgui_theme_draw_iconbox(rtgui_iconbox_t *iconbox);
void rtgui_theme_draw_checkbox(rtgui_checkbox_t *checkbox);
void rtgui_theme_draw_radiobutton(struct rtgui_radiobox *radiobox, rt_uint16_t item);
void rtgui_theme_draw_radiobox(struct rtgui_radiobox* radiobox);
void rtgui_theme_draw_slider(struct rtgui_slider* slider);
void rtgui_theme_draw_scrollbar(struct rtgui_scrollbar* bar);
void rtgui_theme_draw_progressbar(struct rtgui_progressbar* bar);
void rtgui_theme_draw_staticline(struct rtgui_staticline* staticline);
void rtgui_theme_draw_radiobox(struct rtgui_radiobox *radiobox);
void rtgui_theme_draw_slider(struct rtgui_slider *slider);
void rtgui_theme_draw_progressbar(struct rtgui_progressbar *bar);
void rtgui_theme_draw_staticline(struct rtgui_staticline *staticline);
rt_uint16_t rtgui_theme_get_selected_height(void);
void rtgui_theme_draw_selected(struct rtgui_dc* dc, rtgui_rect_t *rect);
rt_uint16_t rtgui_theme_get_selected_height(void);
void rtgui_theme_draw_selected(struct rtgui_dc *dc, rtgui_rect_t *rect);
rtgui_color_t rtgui_theme_default_bc(void);
rtgui_color_t rtgui_theme_default_fc(void);
rtgui_color_t rtgui_theme_default_bc(void);
rtgui_color_t rtgui_theme_default_fc(void);
#ifdef __cplusplus
}

View File

@ -5,7 +5,8 @@
/* Types of events: start element, end element, text, attr name, attr
val and start/end document. Other events can be ignored! */
enum {
enum
{
EVENT_START = 0, /* Start tag */
EVENT_END, /* End tag */
EVENT_TEXT, /* Text */
@ -18,17 +19,17 @@ enum {
/* xml structure typedef */
typedef struct rtgui_xml rtgui_xml_t;
typedef int (*rtgui_xml_event_handler_t)(rt_uint8_t event, const char* text, rt_size_t len, void* user);
typedef int (*rtgui_xml_event_handler_t)(rt_uint8_t event, const char *text, rt_size_t len, void *user);
/* create a xml parser context */
rtgui_xml_t* rtgui_xml_create(rt_size_t buffer_size, rtgui_xml_event_handler_t handler, void* user);
rtgui_xml_t *rtgui_xml_create(rt_size_t buffer_size, rtgui_xml_event_handler_t handler, void *user);
/* destroy a xml parser context */
void rtgui_xml_destroy(rtgui_xml_t* rtgui_xml);
void rtgui_xml_destroy(rtgui_xml_t *rtgui_xml);
/* parse xml buffer */
int rtgui_xml_parse(rtgui_xml_t* rtgui_xml, const char* buf, rt_size_t len);
int rtgui_xml_parse(rtgui_xml_t *rtgui_xml, const char *buf, rt_size_t len);
/* event string */
const char* rtgui_xml_event_str(rt_uint8_t event);
const char *rtgui_xml_event_str(rt_uint8_t event);
#endif

View File

@ -22,31 +22,31 @@
extern "C" {
#endif
DECLARE_CLASS_TYPE(box);
DECLARE_CLASS_TYPE(box);
/** Gets the type of a box */
/** Gets the type of a box */
#define RTGUI_BOX_TYPE (RTGUI_TYPE(box))
/** Casts the object to an rtgui_box */
/** Casts the object to an rtgui_box */
#define RTGUI_BOX(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_BOX_TYPE, rtgui_box_t))
/** Checks if the object is an rtgui_box */
/** Checks if the object is an rtgui_box */
#define RTGUI_IS_BOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_BOX_TYPE))
struct rtgui_box
{
struct rtgui_box
{
struct rtgui_object parent;
rt_uint16_t orient;
rt_uint16_t border_size;
struct rtgui_container* container;
};
typedef struct rtgui_box rtgui_box_t;
struct rtgui_container *container;
};
typedef struct rtgui_box rtgui_box_t;
struct rtgui_box* rtgui_box_create(int orientation, int border_size);
void rtgui_box_destroy(struct rtgui_box* box);
struct rtgui_box *rtgui_box_create(int orientation, int border_size);
void rtgui_box_destroy(struct rtgui_box *box);
void rtgui_box_layout(rtgui_box_t* box);
void rtgui_box_layout_rect(rtgui_box_t* box, struct rtgui_rect* rect);
void rtgui_box_layout(rtgui_box_t *box);
void rtgui_box_layout_rect(rtgui_box_t *box, struct rtgui_rect *rect);
#ifdef __cplusplus
}

View File

@ -22,18 +22,18 @@
extern "C" {
#endif
/**
/**
* @defgroup rtgui_button
* @{
*/
DECLARE_CLASS_TYPE(button);
DECLARE_CLASS_TYPE(button);
/** Gets the type of a button */
/** Gets the type of a button */
#define RTGUI_BUTTON_TYPE (RTGUI_TYPE(button))
/** Casts the object to an rtgui_button */
/** Casts the object to an rtgui_button */
#define RTGUI_BUTTON(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_BUTTON_TYPE, rtgui_button_t))
/** Checks if the object is an rtgui_button */
/** Checks if the object is an rtgui_button */
#define RTGUI_IS_BUTTON(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_BUTTON_TYPE))
#define RTGUI_BUTTON_FLAG_PRESS 0x01
@ -42,11 +42,11 @@ DECLARE_CLASS_TYPE(button);
#define RTGUI_BUTTON_TYPE_NORMAL 0x00
#define RTGUI_BUTTON_TYPE_PUSH 0x10
/*
/*
* the button widget
*/
struct rtgui_button
{
struct rtgui_button
{
/* inherit from label */
struct rtgui_label parent;
@ -58,21 +58,21 @@ struct rtgui_button
/* click button event handler */
rtgui_onbutton_func_t on_button;
};
typedef struct rtgui_button rtgui_button_t;
};
typedef struct rtgui_button rtgui_button_t;
rtgui_button_t* rtgui_button_create(const char* text);
rtgui_button_t* rtgui_pushbutton_create(const char* text);
void rtgui_button_destroy(rtgui_button_t* btn);
rtgui_button_t *rtgui_button_create(const char *text);
rtgui_button_t *rtgui_pushbutton_create(const char *text);
void rtgui_button_destroy(rtgui_button_t *btn);
void rtgui_button_set_pressed_image(rtgui_button_t* btn, rtgui_image_t* image);
void rtgui_button_set_unpressed_image(rtgui_button_t* btn, rtgui_image_t* image);
void rtgui_button_set_pressed_image(rtgui_button_t *btn, rtgui_image_t *image);
void rtgui_button_set_unpressed_image(rtgui_button_t *btn, rtgui_image_t *image);
void rtgui_button_set_onbutton(rtgui_button_t* btn, rtgui_onbutton_func_t func);
void rtgui_button_set_onbutton(rtgui_button_t *btn, rtgui_onbutton_func_t func);
rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_button_event_handler(struct rtgui_object *object, struct rtgui_event *event);
/** @} */
/** @} */
#ifdef __cplusplus
}

View File

@ -30,14 +30,14 @@ struct rtgui_checkbox
};
typedef struct rtgui_checkbox rtgui_checkbox_t;
rtgui_checkbox_t* rtgui_checkbox_create(const char* text, rt_bool_t checked);
void rtgui_checkbox_destroy(rtgui_checkbox_t* checkbox);
rtgui_checkbox_t *rtgui_checkbox_create(const char *text, rt_bool_t checked);
void rtgui_checkbox_destroy(rtgui_checkbox_t *checkbox);
void rtgui_checkbox_set_checked(rtgui_checkbox_t* checkbox, rt_bool_t checked);
rt_bool_t rtgui_checkbox_get_checked(rtgui_checkbox_t* checkbox);
void rtgui_checkbox_set_checked(rtgui_checkbox_t *checkbox, rt_bool_t checked);
rt_bool_t rtgui_checkbox_get_checked(rtgui_checkbox_t *checkbox);
void rtgui_checkbox_set_onbutton(rtgui_checkbox_t* checkbox, rtgui_onbutton_func_t func);
void rtgui_checkbox_set_onbutton(rtgui_checkbox_t *checkbox, rtgui_onbutton_func_t func);
rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
#endif

View File

@ -25,11 +25,11 @@ struct rtgui_combobox
/* widget private data */
/* pull down window */
struct rtgui_win* pd_win;
struct rtgui_win *pd_win;
rt_bool_t pd_pressed;
/* combobox items */
struct rtgui_listbox_item* items;
struct rtgui_listbox_item *items;
rt_uint16_t items_count;
rt_uint16_t current_item;
@ -38,12 +38,12 @@ struct rtgui_combobox
};
typedef struct rtgui_combobox rtgui_combobox_t;
rtgui_combobox_t *rtgui_combobox_create(struct rtgui_listbox_item* items, rt_uint16_t counter, struct rtgui_rect* rect);
void rtgui_combobox_destroy(rtgui_combobox_t* box);
rtgui_combobox_t *rtgui_combobox_create(struct rtgui_listbox_item *items, rt_uint16_t counter, struct rtgui_rect *rect);
void rtgui_combobox_destroy(rtgui_combobox_t *box);
rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
struct rtgui_listbox_item* rtgui_combox_get_select(struct rtgui_combobox* box);
rt_bool_t rtgui_combobox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
struct rtgui_listbox_item *rtgui_combox_get_select(struct rtgui_combobox *box);
void rtgui_combobox_set_onselected(struct rtgui_combobox* box, rtgui_event_handler_ptr func);
void rtgui_combobox_set_onselected(struct rtgui_combobox *box, rtgui_event_handler_ptr func);
#endif

View File

@ -21,46 +21,46 @@
extern "C" {
#endif
DECLARE_CLASS_TYPE(container);
/** Gets the type of a container */
DECLARE_CLASS_TYPE(container);
/** Gets the type of a container */
#define RTGUI_CONTAINER_TYPE (RTGUI_TYPE(container))
/** Casts the object to an rtgui_container */
/** Casts the object to an rtgui_container */
#define RTGUI_CONTAINER(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_CONTAINER_TYPE, rtgui_container_t))
/** Checks if the object is an rtgui_container */
/** Checks if the object is an rtgui_container */
#define RTGUI_IS_CONTAINER(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_CONTAINER_TYPE))
/*
/*
* the container widget
*/
struct rtgui_container
{
struct rtgui_container
{
struct rtgui_widget parent;
/* layout box */
struct rtgui_box* layout_box;
struct rtgui_box *layout_box;
rtgui_list_t children;
};
typedef struct rtgui_container rtgui_container_t;
};
typedef struct rtgui_container rtgui_container_t;
rtgui_container_t* rtgui_container_create(void);
void rtgui_container_destroy(rtgui_container_t* container);
rtgui_container_t *rtgui_container_create(void);
void rtgui_container_destroy(rtgui_container_t *container);
rt_bool_t rtgui_container_event_handler(struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t rtgui_container_event_handler(struct rtgui_object *widget, struct rtgui_event *event);
/* set layout box */
void rtgui_container_set_box(struct rtgui_container* container, struct rtgui_box* box);
void rtgui_container_layout(struct rtgui_container* container);
/* set layout box */
void rtgui_container_set_box(struct rtgui_container *container, struct rtgui_box *box);
void rtgui_container_layout(struct rtgui_container *container);
void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t* child);
void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t* child);
void rtgui_container_destroy_children(rtgui_container_t *container);
rtgui_widget_t* rtgui_container_get_first_child(rtgui_container_t* container);
void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t *child);
void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t *child);
void rtgui_container_destroy_children(rtgui_container_t *container);
rtgui_widget_t *rtgui_container_get_first_child(rtgui_container_t *container);
rt_bool_t rtgui_container_event_handler(struct rtgui_object* widget, rtgui_event_t* event);
rt_bool_t rtgui_container_event_handler(struct rtgui_object *widget, rtgui_event_t *event);
rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_event_t* event);
rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, struct rtgui_event_mouse* event);
rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_event_t *event);
rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, struct rtgui_event_mouse *event);
#ifdef __cplusplus
}

View File

@ -21,13 +21,13 @@
extern "C" {
#endif
DECLARE_CLASS_TYPE(edit);
DECLARE_CLASS_TYPE(edit);
/** Gets the type of a edit */
/** Gets the type of a edit */
#define RTGUI_EDIT_TYPE (RTGUI_TYPE(edit))
/** Casts the object to a rtgui_edit */
/** Casts the object to a rtgui_edit */
#define RTGUI_EDIT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_EDIT_TYPE, struct rtgui_edit))
/** Checks if the object is a rtgui_edit */
/** Checks if the object is a rtgui_edit */
#define RTGUI_IS_EDIT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_EDIT_TYPE))
#define RTGUI_EDIT_NONE 0x00
@ -40,23 +40,23 @@ DECLARE_CLASS_TYPE(edit);
#define RTGUI_EDIT_CAPSLOCK 0x80
#define RTGUI_EDIT_NUMLOCK 0x100
struct edit_update
{
struct edit_update
{
/* rt_uint32_t type; */ /* update type */
rtgui_point_t start, end; /* update area */
};
};
struct edit_line
{
struct edit_line
{
rt_int16_t zsize; /* zone size */
rt_int16_t len;
struct edit_line *prev;
struct edit_line *next;
char *text;
};
};
struct rtgui_edit
{
struct rtgui_edit
{
/* inherit from container */
rtgui_container_t parent;
@ -68,7 +68,7 @@ struct rtgui_edit
rtgui_point_t visual;
rt_uint8_t tabsize;
rt_uint8_t item_height;
rt_uint8_t font_width,font_height;
rt_uint8_t font_width, font_height;
rt_uint8_t margin;
rt_int16_t bzsize; /* base zone size */
@ -86,26 +86,26 @@ struct rtgui_edit
struct rtgui_scrollbar *hscroll;
struct rtgui_scrollbar *vscroll;
#endif
};
};
rt_bool_t rtgui_edit_append_line(struct rtgui_edit *edit, const char *text);
rt_bool_t rtgui_edit_insert_line(struct rtgui_edit *edit, struct edit_line *p, char *text);
rt_bool_t rtgui_edit_delete_line(struct rtgui_edit *edit, struct edit_line *line);
rt_bool_t rtgui_edit_connect_line(struct rtgui_edit *edit, struct edit_line *line, struct edit_line *connect);
rt_bool_t rtgui_edit_append_line(struct rtgui_edit *edit, const char *text);
rt_bool_t rtgui_edit_insert_line(struct rtgui_edit *edit, struct edit_line *p, char *text);
rt_bool_t rtgui_edit_delete_line(struct rtgui_edit *edit, struct edit_line *line);
rt_bool_t rtgui_edit_connect_line(struct rtgui_edit *edit, struct edit_line *line, struct edit_line *connect);
void _rtgui_edit_constructor(struct rtgui_edit *box);
void _rtgui_edit_deconstructor(struct rtgui_edit *textbox);
void _rtgui_edit_constructor(struct rtgui_edit *box);
void _rtgui_edit_deconstructor(struct rtgui_edit *textbox);
struct rtgui_edit* rtgui_edit_create(struct rtgui_container* container, int left, int top, int w, int h);
void rtgui_edit_destroy(struct rtgui_edit *edit);
void rtgui_edit_update(struct rtgui_edit *edit);
void rtgui_edit_ondraw(struct rtgui_edit *edit);
rt_bool_t rtgui_edit_event_handler(struct rtgui_object* object, rtgui_event_t* event);
void rtgui_edit_set_text(struct rtgui_edit *edit, const char* text);
rtgui_point_t rtgui_edit_get_current_point(struct rtgui_edit *edit);
rt_uint32_t rtgui_edit_get_mem_consume(struct rtgui_edit *edit);
rt_bool_t rtgui_edit_readin_file(struct rtgui_edit *edit, const char *filename);
rt_bool_t rtgui_edit_saveas_file(struct rtgui_edit *edit, const char *filename);
struct rtgui_edit *rtgui_edit_create(struct rtgui_container *container, int left, int top, int w, int h);
void rtgui_edit_destroy(struct rtgui_edit *edit);
void rtgui_edit_update(struct rtgui_edit *edit);
void rtgui_edit_ondraw(struct rtgui_edit *edit);
rt_bool_t rtgui_edit_event_handler(struct rtgui_object *object, rtgui_event_t *event);
void rtgui_edit_set_text(struct rtgui_edit *edit, const char *text);
rtgui_point_t rtgui_edit_get_current_point(struct rtgui_edit *edit);
rt_uint32_t rtgui_edit_get_mem_consume(struct rtgui_edit *edit);
rt_bool_t rtgui_edit_readin_file(struct rtgui_edit *edit, const char *filename);
rt_bool_t rtgui_edit_saveas_file(struct rtgui_edit *edit, const char *filename);
#ifdef __cplusplus
}

View File

@ -8,7 +8,7 @@
#define RTGUI_FITEM_DIR 0x1
struct rtgui_file_item
{
char* name;
char *name;
rt_uint32_t type;
rt_uint32_t size;
@ -29,8 +29,8 @@ struct rtgui_filelist_view
/* widget private data */
/* current directory */
char* current_directory;
char* pattern;
char *current_directory;
char *pattern;
/* the number of item in a page */
rt_uint16_t page_items;
@ -44,15 +44,15 @@ struct rtgui_filelist_view
};
typedef struct rtgui_filelist_view rtgui_filelist_view_t;
rtgui_filelist_view_t* rtgui_filelist_view_create(const char* directory,
const char* pattern,
const rtgui_rect_t* rect);
void rtgui_filelist_view_destroy(rtgui_filelist_view_t* view);
rtgui_filelist_view_t *rtgui_filelist_view_create(const char *directory,
const char *pattern,
const rtgui_rect_t *rect);
void rtgui_filelist_view_destroy(rtgui_filelist_view_t *view);
rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_object* object, struct rtgui_event* event);
void rtgui_filelist_view_set_directory(rtgui_filelist_view_t* view, const char* directory);
rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_filelist_view_set_directory(rtgui_filelist_view_t *view, const char *directory);
void rtgui_filelist_view_get_fullpath(rtgui_filelist_view_t* view, char* path, rt_size_t len);
void rtgui_filelist_view_get_fullpath(rtgui_filelist_view_t *view, char *path, rt_size_t len);
#endif
#endif

View File

@ -28,7 +28,7 @@ DECLARE_CLASS_TYPE(groupbox);
/** Checks if the object is an rtgui_groupbox */
#define RTGUI_IS_GROUPBOX(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_GROUPBOX_TYPE))
typedef void (*widget_select_t)(struct rtgui_widget* widget, rt_bool_t selected);
typedef void (*widget_select_t)(struct rtgui_widget *widget, rt_bool_t selected);
/*
* the groupbox widget
@ -43,7 +43,7 @@ struct rtgui_groupbox
{
struct rtgui_panel parent;
char* label;
char *label;
struct rtgui_box *box;
struct rtgui_widget *selected;
@ -52,18 +52,18 @@ struct rtgui_groupbox
};
typedef struct rtgui_groupbox rtgui_groupbox_t;
rtgui_groupbox_t* rtgui_groupbox_create(const char* label, struct rtgui_rect *rect, int style, widget_select_t select_func);
void rtgui_groupbox_destroy(rtgui_groupbox_t* groupbox);
rtgui_groupbox_t *rtgui_groupbox_create(const char *label, struct rtgui_rect *rect, int style, widget_select_t select_func);
void rtgui_groupbox_destroy(rtgui_groupbox_t *groupbox);
void rtgui_groupbox_layout(struct rtgui_groupbox *box);
void rtgui_groupbox_add_widget(struct rtgui_groupbox *box, struct rtgui_widget *widget);
void rtgui_groupbox_select_widget(struct rtgui_groupbox *box, struct rtgui_widget *widget);
struct rtgui_widget* rtgui_groupbox_get_selected(struct rtgui_groupbox *box);
struct rtgui_widget *rtgui_groupbox_get_selected(struct rtgui_groupbox *box);
rt_bool_t rtgui_groupbox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_groupbox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
rt_inline void rtgui_groupbox_set_onselected(struct rtgui_groupbox* box, rtgui_event_handler_ptr on_selected)
rt_inline void rtgui_groupbox_set_onselected(struct rtgui_groupbox *box, rtgui_event_handler_ptr on_selected)
{
RT_ASSERT(box != RT_NULL);
box->on_selected = on_selected;

View File

@ -36,7 +36,7 @@ struct rtgui_iconbox
struct rtgui_widget parent;
/* widget private data */
struct rtgui_image* image;
struct rtgui_image *image;
char *text;
rt_ubase_t text_position;
@ -45,12 +45,12 @@ struct rtgui_iconbox
};
typedef struct rtgui_iconbox rtgui_iconbox_t;
struct rtgui_iconbox* rtgui_iconbox_create(struct rtgui_image* image, const char* text, int position);
void rtgui_iconbox_destroy(struct rtgui_iconbox* iconbox);
struct rtgui_iconbox *rtgui_iconbox_create(struct rtgui_image *image, const char *text, int position);
void rtgui_iconbox_destroy(struct rtgui_iconbox *iconbox);
rt_bool_t rtgui_iconbox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_iconbox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_iconbox_set_text_position(struct rtgui_iconbox* iconbox, int position);
void rtgui_iconbox_set_selected(struct rtgui_iconbox* iconbox, rt_bool_t selected);
void rtgui_iconbox_set_text_position(struct rtgui_iconbox *iconbox, int position);
void rtgui_iconbox_set_selected(struct rtgui_iconbox *iconbox, rt_bool_t selected);
#endif

View File

@ -34,16 +34,16 @@ struct rtgui_label
struct rtgui_widget parent;
/* label */
char* text;
char *text;
};
typedef struct rtgui_label rtgui_label_t;
rtgui_label_t* rtgui_label_create(const char* text);
void rtgui_label_destroy(rtgui_label_t* label);
rtgui_label_t *rtgui_label_create(const char *text);
void rtgui_label_destroy(rtgui_label_t *label);
rt_bool_t rtgui_label_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_label_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_label_set_text(rtgui_label_t* label, const char* text);
char* rtgui_label_get_text(rtgui_label_t* label);
void rtgui_label_set_text(rtgui_label_t *label, const char *text);
char *rtgui_label_get_text(rtgui_label_t *label);
#endif

View File

@ -21,10 +21,10 @@
#include <rtgui/widgets/container.h>
typedef void (*item_action)(struct rtgui_widget* widget, void* parameter);
typedef void (*item_action)(struct rtgui_widget *widget, void *parameter);
struct rtgui_list_item
{
char* name;
char *name;
rtgui_image_t *image;
item_action action;
@ -49,7 +49,7 @@ struct rtgui_list_view
/* widget private data */
/* list item */
const struct rtgui_list_item* items;
const struct rtgui_list_item *items;
/* layout flag */
rt_uint16_t flag;
@ -66,11 +66,11 @@ struct rtgui_list_view
};
typedef struct rtgui_list_view rtgui_list_view_t;
rtgui_list_view_t* rtgui_list_view_create(const struct rtgui_list_item* items, rt_uint16_t count,
rtgui_list_view_t *rtgui_list_view_create(const struct rtgui_list_item *items, rt_uint16_t count,
rtgui_rect_t *rect, rt_uint16_t flag);
void rtgui_list_view_destroy(rtgui_list_view_t* view);
void rtgui_list_view_destroy(rtgui_list_view_t *view);
rt_bool_t rtgui_list_view_event_handler(struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t rtgui_list_view_event_handler(struct rtgui_object *widget, struct rtgui_event *event);
#endif

View File

@ -22,7 +22,7 @@
struct rtgui_listbox_item
{
char* name;
char *name;
rtgui_image_t *image;
};
@ -40,7 +40,7 @@ struct rtgui_listbox
/* widget private data */
/* listbox item */
const struct rtgui_listbox_item* items;
const struct rtgui_listbox_item *items;
/* item event handler */
rtgui_event_handler_ptr on_item;
@ -54,14 +54,14 @@ struct rtgui_listbox
};
typedef struct rtgui_listbox rtgui_listbox_t;
rtgui_listbox_t* rtgui_listbox_create(const struct rtgui_listbox_item* items, rt_uint16_t count,
rtgui_listbox_t *rtgui_listbox_create(const struct rtgui_listbox_item *items, rt_uint16_t count,
rtgui_rect_t *rect);
void rtgui_listbox_destroy(rtgui_listbox_t* box);
void rtgui_listbox_destroy(rtgui_listbox_t *box);
rt_bool_t rtgui_listbox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
void rtgui_listbox_set_onitem(rtgui_listbox_t* box, rtgui_event_handler_ptr func);
void rtgui_listbox_set_items(rtgui_listbox_t* box, struct rtgui_listbox_item* items, rt_uint16_t count);
void rtgui_listbox_set_current_item(rtgui_listbox_t* box, int index);
rt_bool_t rtgui_listbox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_listbox_set_onitem(rtgui_listbox_t *box, rtgui_event_handler_ptr func);
void rtgui_listbox_set_items(rtgui_listbox_t *box, struct rtgui_listbox_item *items, rt_uint16_t count);
void rtgui_listbox_set_current_item(rtgui_listbox_t *box, int index);
#endif

View File

@ -34,7 +34,7 @@ struct rtgui_listctrl
/* widget private data */
/* listctrl items */
rt_uint32_t items;
void *items;
/* total number of items */
rt_uint16_t items_count;
@ -46,20 +46,21 @@ struct rtgui_listctrl
/* item event handler */
rtgui_event_handler_ptr on_item;
void (*on_item_draw)(struct rtgui_listctrl *list, struct rtgui_dc* dc, rtgui_rect_t* rect, rt_uint16_t index);
void (*on_item_draw)(struct rtgui_listctrl *list, struct rtgui_dc *dc, rtgui_rect_t *rect, rt_uint16_t index);
};
typedef struct rtgui_listctrl rtgui_listctrl_t;
typedef void (*rtgui_onitem_draw_t)(struct rtgui_listctrl *list, struct rtgui_dc* dc, rtgui_rect_t* rect, rt_uint16_t index);
typedef void (*rtgui_onitem_draw_t)(struct rtgui_listctrl *list, struct rtgui_dc *dc, rtgui_rect_t *rect, rt_uint16_t index);
rtgui_listctrl_t* rtgui_listctrl_create(rt_uint32_t items, rt_uint16_t count,
rtgui_listctrl_t *rtgui_listctrl_create(void *items, rt_uint16_t count,
rtgui_rect_t *rect, rtgui_onitem_draw_t ondraw);
void rtgui_listctrl_destroy(rtgui_listctrl_t* ctrl);
void rtgui_listctrl_destroy(rtgui_listctrl_t *ctrl);
rt_bool_t rtgui_listctrl_event_handler(struct rtgui_object* object, struct rtgui_event* event);
void rtgui_listctrl_set_onitem(rtgui_listctrl_t* ctrl, rtgui_event_handler_ptr func);
void rtgui_listctrl_set_items(rtgui_listctrl_t* ctrl, rt_uint32_t items, rt_uint16_t count);
rt_bool_t rtgui_listctrl_get_item_rect(rtgui_listctrl_t* ctrl, rt_uint16_t item, rtgui_rect_t* item_rect);
void rtgui_listctrl_set_itemheight(struct rtgui_listctrl* ctrl, int height);
rt_bool_t rtgui_listctrl_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_listctrl_set_onitem(rtgui_listctrl_t *ctrl, rtgui_event_handler_ptr func);
void rtgui_listctrl_set_items(rtgui_listctrl_t *ctrl, void *items, rt_uint16_t count);
void rtgui_listctrl_set_current_item(struct rtgui_listctrl *ctrl, rt_uint16_t index);
rt_bool_t rtgui_listctrl_get_item_rect(rtgui_listctrl_t *ctrl, rt_uint16_t item, rtgui_rect_t *item_rect);
void rtgui_listctrl_set_itemheight(struct rtgui_listctrl *ctrl, int height);
#endif

View File

@ -20,7 +20,7 @@ struct rtgui_menu_item
rtgui_menu_item_type_t type;
/* menu text label */
const char* label;
const char *label;
/* menu image */
rtgui_image_t *image;
@ -29,7 +29,7 @@ struct rtgui_menu_item
rt_uint16_t submenu_count;
/* menu action */
rt_bool_t (*on_menuaction)(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t (*on_menuaction)(struct rtgui_object *object, struct rtgui_event *event);
};
typedef struct rtgui_menu_item rtgui_menu_item_t;
@ -64,15 +64,15 @@ struct rtgui_menu
};
typedef struct rtgui_menu rtgui_menu_t;
struct rtgui_menu* rtgui_menu_create(const char* title, struct rtgui_menu* parent_menu,
const struct rtgui_menu_item* items, rt_uint16_t count);
void rtgui_menu_destroy(struct rtgui_menu* menu);
struct rtgui_menu *rtgui_menu_create(const char *title, struct rtgui_menu *parent_menu,
const struct rtgui_menu_item *items, rt_uint16_t count);
void rtgui_menu_destroy(struct rtgui_menu *menu);
void rtgui_menu_set_onmenupop(struct rtgui_menu* menu, rtgui_event_handler_ptr handler);
void rtgui_menu_set_onmenuhide(struct rtgui_menu* menu, rtgui_event_handler_ptr handler);
void rtgui_menu_set_onmenupop(struct rtgui_menu *menu, rtgui_event_handler_ptr handler);
void rtgui_menu_set_onmenuhide(struct rtgui_menu *menu, rtgui_event_handler_ptr handler);
void rtgui_menu_pop(struct rtgui_menu* menu, int x, int y);
void rtgui_menu_hiden(struct rtgui_menu* menu);
void rtgui_menu_pop(struct rtgui_menu *menu, int x, int y);
void rtgui_menu_hiden(struct rtgui_menu *menu);
#endif

View File

@ -0,0 +1,44 @@
/*
* File : mv_view.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2012, 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
* 2012-09-15 Grissiom first version
*/
#ifndef __MV_VIEW_H__
#define __MV_VIEW_H__
#include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
DECLARE_CLASS_TYPE(mv_view);
/** Gets the type of a mv_view */
#define RTGUI_MV_VIEW_TYPE (RTGUI_TYPE(mv_view))
/** Casts the object to an mv_view */
#define RTGUI_MV_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_MV_VIEW_TYPE, struct rtgui_mv_view))
/** Checks if the object is an mv_view */
#define RTGUI_IS_MV_VIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_MV_VIEW_TYPE))
struct rtgui_mv_view
{
struct rtgui_widget parent;
rt_uint16_t model_number;
/* if the model_number is 1, the model is the pointer to the model. If the
* model_number is more than 1, model is a pointer to a array of pointers
* to model. */
void *model;
};
struct rtgui_mv_view *rtgui_mv_view_create(void);
void rtgui_mv_view_destroy(struct rtgui_mv_view *view);
struct rtgui_mv_model *rtgui_mv_view_foreach_in_model(struct rtgui_mv_view *view, rt_uint32_t *iter);
#endif /* end of include guard: __MV_VIEW_H__ */

View File

@ -35,8 +35,8 @@ struct rtgui_notebook
rt_uint16_t tab_w, tab_h;
};
struct rtgui_notebook* rtgui_notebook_create(const rtgui_rect_t* rect, rt_uint8_t style);
void rtgui_notebook_destroy(struct rtgui_notebook* notebook);
struct rtgui_notebook *rtgui_notebook_create(const rtgui_rect_t *rect, rt_uint8_t style);
void rtgui_notebook_destroy(struct rtgui_notebook *notebook);
rt_inline void rtgui_notebook_set_tab_height(struct rtgui_notebook *notebook, rt_uint16_t height)
{
@ -50,23 +50,23 @@ rt_inline void rtgui_notebook_set_tab_width(struct rtgui_notebook *notebook, rt_
notebook->tab_w = width;
}
void rtgui_notebook_add(struct rtgui_notebook* notebook, const char* label, struct rtgui_widget* child);
void rtgui_notebook_add(struct rtgui_notebook *notebook, const char *label, struct rtgui_widget *child);
#ifdef RTGUI_USING_NOTEBOOK_IMAGE
void rtgui_notebook_add_image(struct rtgui_notebook* notebook, const char* label, struct rtgui_widget* child,
void rtgui_notebook_add_image(struct rtgui_notebook *notebook, const char *label, struct rtgui_widget *child,
struct rtgui_image *pressed_image, struct rtgui_image *unpressed_image);
#endif
void rtgui_notebook_remove(struct rtgui_notebook* notebook, rt_uint16_t index);
struct rtgui_widget* rtgui_notebook_get_current(struct rtgui_notebook* notebook);
rt_int16_t rtgui_notebook_get_current_index(struct rtgui_notebook* notebook);
void rtgui_notebook_remove(struct rtgui_notebook *notebook, rt_uint16_t index);
struct rtgui_widget *rtgui_notebook_get_current(struct rtgui_notebook *notebook);
rt_int16_t rtgui_notebook_get_current_index(struct rtgui_notebook *notebook);
int rtgui_notebook_get_count(struct rtgui_notebook* notebook);
void rtgui_notebook_get_client_rect(struct rtgui_notebook* notebook, struct rtgui_rect *rect);
int rtgui_notebook_get_count(struct rtgui_notebook *notebook);
void rtgui_notebook_get_client_rect(struct rtgui_notebook *notebook, struct rtgui_rect *rect);
void rtgui_notebook_set_current(struct rtgui_notebook* notebook, struct rtgui_widget* child);
void rtgui_notebook_set_current_by_index(struct rtgui_notebook* notebook, rt_uint16_t index);
void rtgui_notebook_set_current(struct rtgui_notebook *notebook, struct rtgui_widget *child);
void rtgui_notebook_set_current_by_index(struct rtgui_notebook *notebook, rt_uint16_t index);
struct rtgui_widget* rtgui_notebook_get_widget_at(struct rtgui_notebook* notebook, rt_uint16_t index);
struct rtgui_widget *rtgui_notebook_get_widget_at(struct rtgui_notebook *notebook, rt_uint16_t index);
rt_bool_t rtgui_notebook_event_handler(struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t rtgui_notebook_event_handler(struct rtgui_object *widget, struct rtgui_event *event);
#endif

View File

@ -37,15 +37,15 @@ struct rtgui_panel
};
typedef struct rtgui_panel rtgui_panel_t;
rtgui_panel_t* rtgui_panel_create(int border_style);
void rtgui_panel_destroy(rtgui_panel_t* panel);
rtgui_panel_t *rtgui_panel_create(int border_style);
void rtgui_panel_destroy(rtgui_panel_t *panel);
rt_inline void rtgui_panel_set_border(struct rtgui_panel* panel, int border_style)
rt_inline void rtgui_panel_set_border(struct rtgui_panel *panel, int border_style)
{
RT_ASSERT(panel != RT_NULL);
panel->border_style = border_style;
}
rt_bool_t rtgui_panel_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_panel_event_handler(struct rtgui_object *object, struct rtgui_event *event);
#endif

View File

@ -16,6 +16,7 @@
#include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/mv_view.h>
#include <rtgui/widgets/plot_curve.h>
DECLARE_CLASS_TYPE(plot);
@ -27,17 +28,10 @@ DECLARE_CLASS_TYPE(plot);
/** Checks if the object is an rtgui_plot */
#define RTGUI_IS_PLOT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_PLOT_TYPE))
struct rtgui_plot_curve_container
enum rtgui_plot_type
{
struct rtgui_plot_curve *curve;
struct rtgui_plot_curve_container *next;
};
enum rtgui_plot_flag
{
RTGUI_PLOT_INCREMENTAL,
RTGUI_PLOT_MOVING_WINDOW,
RTGUI_PLOT_SCAN,
RTGUI_PLOT_TYPE_SCAN,
RTGUI_PLOT_TYPE_INCREMENTAL,
};
/*
@ -45,20 +39,21 @@ enum rtgui_plot_flag
*/
struct rtgui_plot
{
struct rtgui_widget parent;
struct rtgui_mv_view parent;
enum rtgui_plot_flag pflag;
enum rtgui_plot_type ptype;
rt_uint16_t scale_x;
rt_uint16_t scale_y;
struct rtgui_point base_point;
struct rtgui_plot_curve_container curve_container;
rtgui_plot_curve_dtype base_x;
rtgui_plot_curve_dtype base_y;
};
struct rtgui_plot *rtgui_plot_create(struct rtgui_plot_curve*);
struct rtgui_plot *rtgui_plot_create(void);
void rtgui_plot_destroy(struct rtgui_plot *plot);
void rtgui_plot_set_base_point(struct rtgui_plot *plot, rt_uint16_t x, rt_uint16_t y);
void rtgui_plot_append_curve(struct rtgui_plot *plot, struct rtgui_plot_curve *curve);
void rtgui_plot_remove_curve(struct rtgui_plot *plot, struct rtgui_plot_curve *curve);
void rtgui_plot_set_base(struct rtgui_plot *plot,
rtgui_plot_curve_dtype x, rtgui_plot_curve_dtype y);
rt_bool_t rtgui_plot_event_handler(struct rtgui_object *object, struct rtgui_event *event);

View File

@ -15,6 +15,7 @@
#define __RTGUI_PLOT_CURVE_H__
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_mv_model.h>
DECLARE_CLASS_TYPE(plot_curve);
@ -31,15 +32,20 @@ DECLARE_CLASS_TYPE(plot_curve);
struct rtgui_plot_curve
{
struct rtgui_object parent;
struct rtgui_mv_model parent;
rtgui_color_t color;
rt_size_t length;
rtgui_plot_curve_dtype *x_data;
rtgui_plot_curve_dtype *y_data;
rtgui_plot_curve_dtype min_x, max_x;
rtgui_plot_curve_dtype min_y, max_y;
};
struct rtgui_plot_curve *rtgui_plot_curve_create(void);
void rtgui_plot_curve_destroy(struct rtgui_plot_curve *curve);
void rtgui_plot_curve_set_x(struct rtgui_plot_curve *curve, void *p);
void *rtgui_plot_curve_get_x(struct rtgui_plot_curve *curve);
void rtgui_plot_curve_set_y(struct rtgui_plot_curve *curve, void *p);
void *rtgui_plot_curve_get_y(struct rtgui_plot_curve *curve);
#endif

View File

@ -26,11 +26,11 @@ struct rtgui_progressbar
};
typedef struct rtgui_progressbar rtgui_progressbar_t;
struct rtgui_progressbar* rtgui_progressbar_create(int orientation, int range, rtgui_rect_t* r);
void rtgui_progressbar_destroy(struct rtgui_progressbar* p_bar);
struct rtgui_progressbar *rtgui_progressbar_create(int orientation, int range, rtgui_rect_t *r);
void rtgui_progressbar_destroy(struct rtgui_progressbar *p_bar);
rt_bool_t rtgui_progressbar_event_handler(struct rtgui_object* object,
struct rtgui_event* event);
rt_bool_t rtgui_progressbar_event_handler(struct rtgui_object *object,
struct rtgui_event *event);
void rtgui_progressbar_set_value(struct rtgui_progressbar *p_bar, int value);
int rtgui_progressbar_get_value(struct rtgui_progressbar *p_bar);

View File

@ -17,7 +17,7 @@ struct rtgui_radiobox
struct rtgui_widget parent;
/* widget private data */
char* text; /* radio box label */
char *text; /* radio box label */
/* box orient */
rt_uint8_t orient;
@ -25,21 +25,21 @@ struct rtgui_radiobox
/* item size */
rt_uint8_t item_size;
char** items;
char **items;
rt_uint16_t item_count;
rt_int16_t item_selection;
};
typedef struct rtgui_radiobox rtgui_radiobox_t;
struct rtgui_radiobox* rtgui_radiobox_create(const char* label, int orient, char** radio_items, int number);
void rtgui_radiobox_destroy(struct rtgui_radiobox* radiobox);
struct rtgui_radiobox *rtgui_radiobox_create(const char *label, int orient, char **radio_items, int number);
void rtgui_radiobox_destroy(struct rtgui_radiobox *radiobox);
void rtgui_radiobox_set_selection(struct rtgui_radiobox* radiobox, int selection);
int rtgui_radiobox_get_selection(struct rtgui_radiobox* radiobox);
void rtgui_radiobox_set_selection(struct rtgui_radiobox *radiobox, int selection);
int rtgui_radiobox_get_selection(struct rtgui_radiobox *radiobox);
rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_radiobox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_radiobox_set_orientation(struct rtgui_radiobox* radiobox, int orientation);
void rtgui_radiobox_set_orientation(struct rtgui_radiobox *radiobox, int orientation);
#endif

View File

@ -14,14 +14,15 @@
#ifndef __RTGUI_SCROLLBAR_H__
#define __RTGUI_SCROLLBAR_H__
#include <rtgui/rtgui.h>
#include <rtgui/widgets/widget.h>
#include <rtgui/widgets/container.h>
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_CLASS_TYPE(scrollbar);
/** Gets the type of a scrollbar */
#define RTGUI_SCROLLBAR_TYPE (RTGUI_TYPE(scrollbar))
/** Casts the object to an rtgui_scrollbar */
@ -29,58 +30,60 @@ DECLARE_CLASS_TYPE(scrollbar);
/** Checks if the object is an rtgui_scrollbar */
#define RTGUI_IS_SCROLLBAR(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_SCROLLBAR_TYPE))
#define RTGUI_DEFAULT_SB_WIDTH 100
#define RTGUI_DEFAULT_SB_HEIGHT 16
#define RTGUI_DEFAULT_SB_WIDTH 16
/* scrollbar status/positions*/
#define SBS_UNKNOWN 0x0000
#define SBS_LEFTARROW 0x0001
#define SBS_RIGHTARROW 0x0002
#define SBS_LEFTSPACE 0x0004
#define SBS_RIGHTSPACE 0x0008
#define SBS_HORZTHUMB 0x0010
#define SBS_LEFTSPACE 0x0004 /* Need mouse_motion event */
#define SBS_RIGHTSPACE 0x0008 /* Need mouse_motion event */
#define SBS_HORZTHUMB 0x0010 /* Need mouse_motion event */
#define SBS_UPARROW 0x0020
#define SBS_DOWNARROW 0x0040
#define SBS_UPSPACE 0x0080
#define SBS_DOWNSPACE 0x0100
#define SBS_VERTTHUMB 0x0200
#define SBS_UPSPACE 0x0080 /* Need mouse_motion event */
#define SBS_DOWNSPACE 0x0100 /* Need mouse_motion event */
#define SBS_VERTTHUMB 0x0200 /* Need mouse_motion event */
#define SBS_UPTHUMB 0x0400 /* Need mouse_motion event */
#define SBS_DOWNTHUMB 0x0800 /* Need mouse_motion event */
#define SBS_LEFTTHUMB 0x1000 /* Need mouse_motion event */
#define SBS_RIGHTTHUMB 0x2000 /* Need mouse_motion event */
struct rtgui_scrollbar
{
/* inherit from widget */
struct rtgui_widget parent;
rtgui_widget_t parent;
rt_uint8_t orient;
rt_uint8_t status;
rt_uint32_t status;
/* page_step = width of scrollbar */
/* thumb size = line_step * page_step / (page_step - (button width * 2)) */
/* page_step = display lines of scrollbar */
/* thumb_len = line_step * page_step / (page_step - (button width * 2)) */
rt_int16_t line_step, page_step;
rt_int16_t thumb_position, thumb_size;
rt_int16_t value, thumb_len,thumb_w;
/* position 1:1 width of scrollbar */
rt_int16_t min_position, max_position;
rt_int16_t count;
rtgui_event_handler_ptr on_scroll;
rtgui_widget_t *widget_link;/* be connected widget */
rt_bool_t (*on_scroll) (rtgui_object_t *obj, rtgui_event_t* event);
};
typedef struct rtgui_scrollbar rtgui_scrollbar_t;
struct rtgui_scrollbar* rtgui_scrollbar_create(int orient, rtgui_rect_t* r);
void rtgui_scrollbar_destroy(struct rtgui_scrollbar* bar);
rtgui_scrollbar_t* rtgui_scrollbar_create(rtgui_container_t *container,int left,int top,int w,int len,int orient);
void rtgui_scrollbar_destroy(rtgui_scrollbar_t* bar);
void rtgui_scrollbar_ondraw(rtgui_scrollbar_t* bar);
void rtgui_scrollbar_get_thumb_rect(rtgui_scrollbar_t *bar, rtgui_rect_t *erect);
void rtgui_scrollbar_get_thumb_rect(rtgui_scrollbar_t *bar, rtgui_rect_t *rect);
void rtgui_scrollbar_set_range(rtgui_scrollbar_t* bar, int count);
void rtgui_scrollbar_set_value(rtgui_scrollbar_t* bar, rt_int16_t value);
void rtgui_scrollbar_set_range(struct rtgui_scrollbar* bar, int min, int max);
rt_int16_t rtgui_scrollbar_get_value(struct rtgui_scrollbar* bar);
void rtgui_scrollbar_set_value(struct rtgui_scrollbar* bar, rt_int16_t position);
void rtgui_scrollbar_set_onscroll(rtgui_scrollbar_t* bar, rtgui_event_handler_ptr handler);
void rtgui_scrollbar_set_orientation(rtgui_scrollbar_t* bar, int orient);
void rtgui_scrollbar_set_page_step(rtgui_scrollbar_t* bar, int step);
void rtgui_scrollbar_set_line_step(rtgui_scrollbar_t* bar, int step);
void rtgui_scrollbar_set_onscroll(struct rtgui_scrollbar* bar, rtgui_event_handler_ptr handler);
void rtgui_scrollbar_set_orientation(struct rtgui_scrollbar* bar, int orientation);
void rtgui_scrollbar_set_page_step(struct rtgui_scrollbar* bar, int step);
void rtgui_scrollbar_set_line_step(struct rtgui_scrollbar* bar, int step);
rt_bool_t rtgui_scrollbar_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_scrollbar_event_handler(rtgui_object_t *obj, rtgui_event_t* event);
void rtgui_scrollbar_hide(rtgui_scrollbar_t* bar);
#ifdef __cplusplus
}

View File

@ -35,19 +35,19 @@ struct rtgui_slider
int orient;
void (*on_changed)(struct rtgui_widget* widget, struct rtgui_event *event);
void (*on_changed)(struct rtgui_widget *widget, struct rtgui_event *event);
};
typedef struct rtgui_slider rtgui_slider_t;
struct rtgui_slider* rtgui_slider_create(rt_size_t min, rt_size_t max, int orient);
void rtgui_slider_destroy(struct rtgui_slider* slider);
struct rtgui_slider *rtgui_slider_create(rt_size_t min, rt_size_t max, int orient);
void rtgui_slider_destroy(struct rtgui_slider *slider);
rt_bool_t rtgui_slider_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_slider_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_slider_set_range(struct rtgui_slider* slider, rt_size_t min, rt_size_t max);
void rtgui_slider_set_value(struct rtgui_slider* slider, rt_size_t value);
void rtgui_slider_set_orientation(struct rtgui_slider* slider, int orientation);
void rtgui_slider_set_range(struct rtgui_slider *slider, rt_size_t min, rt_size_t max);
void rtgui_slider_set_value(struct rtgui_slider *slider, rt_size_t value);
void rtgui_slider_set_orientation(struct rtgui_slider *slider, int orientation);
rt_size_t rtgui_slider_get_value(struct rtgui_slider* slider);
rt_size_t rtgui_slider_get_value(struct rtgui_slider *slider);
#endif

View File

@ -26,10 +26,10 @@ struct rtgui_staticline
typedef struct rtgui_staticline rtgui_staticline_t;
rtgui_staticline_t *rtgui_staticline_create(int orientation);
void rtgui_staticline_destroy(rtgui_staticline_t* staticline);
void rtgui_staticline_destroy(rtgui_staticline_t *staticline);
rt_bool_t rtgui_staticline_event_handler(struct rtgui_object* object, struct rtgui_event* event);
void rtgui_staticline_set_orientation(rtgui_staticline_t* staticline, int orientation);
rt_bool_t rtgui_staticline_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_staticline_set_orientation(rtgui_staticline_t *staticline, int orientation);
#endif

View File

@ -1,16 +1,16 @@
/*
* File : textbox.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
*/
* File : textbox.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_TEXTBOX_H__
#define __RTGUI_TEXTBOX_H__
@ -54,7 +54,9 @@ struct rtgui_textbox
/* current line and position */
rt_uint16_t line, line_begin, position, line_length;
rt_uint16_t dis_length; /*may be display length.*/
char* text;
rt_uint16_t first_pos;
char mask_char;
char *text;
rt_size_t font_width;
rtgui_timer_t *caret_timer;
@ -62,23 +64,24 @@ struct rtgui_textbox
rtgui_rect_t caret_rect;
/* textbox private data */
rt_bool_t (*on_enter) (struct rtgui_textbox *box, rtgui_event_t* event);
rt_bool_t (*on_enter)(struct rtgui_textbox *box, rtgui_event_t *event);
};
typedef struct rtgui_textbox rtgui_textbox_t;
struct rtgui_textbox* rtgui_textbox_create(const char* text, rt_uint32_t flag);
void rtgui_textbox_destroy(struct rtgui_textbox* box);
rtgui_textbox_t *rtgui_textbox_create(const char *text, rt_uint32_t flag);
void rtgui_textbox_destroy(struct rtgui_textbox *box);
rt_bool_t rtgui_textbox_event_handler(struct rtgui_object* object, struct rtgui_event* event);
rt_bool_t rtgui_textbox_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_textbox_set_value(struct rtgui_textbox* box, const char* text);
const char* rtgui_textbox_get_value(struct rtgui_textbox* box);
void rtgui_textbox_set_value(struct rtgui_textbox *box, const char *text);
const char *rtgui_textbox_get_value(struct rtgui_textbox *box);
void rtgui_textbox_set_mask_char(rtgui_textbox_t *box, const char ch);
const char rtgui_textbox_get_mask_char(rtgui_textbox_t *box);
void rtgui_textbox_set_line_length(struct rtgui_textbox *box, rt_size_t length);
void rtgui_textbox_set_line_length(struct rtgui_textbox* box, rt_size_t length);
void rtgui_textbox_get_edit_rect(struct rtgui_textbox *box, rtgui_rect_t *rect);
void rtgui_textbox_get_edit_rect(struct rtgui_textbox *box,rtgui_rect_t *rect);
void rtgui_textbox_ondraw(rtgui_textbox_t* box);
void rtgui_textbox_ondraw(rtgui_textbox_t *box);
#ifdef __cplusplus
}
#endif

View File

@ -20,45 +20,45 @@
extern "C" {
#endif
/**
/**
* @defgroup rtgui_textview
* @{
*/
DECLARE_CLASS_TYPE(textview);
DECLARE_CLASS_TYPE(textview);
/** Gets the type of a textview */
/** Gets the type of a textview */
#define RTGUI_TEXTVIEW_TYPE (RTGUI_TYPE(textview))
/** Casts the object to an rtgui_textview */
/** Casts the object to an rtgui_textview */
#define RTGUI_TEXTVIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_TEXTVIEW_TYPE, rtgui_textview_t))
/** Checks if the object is an rtgui_textview */
/** Checks if the object is an rtgui_textview */
#define RTGUI_IS_TEXTVIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_TEXTVIEW_TYPE))
/*
/*
* the textview widget
*/
struct rtgui_textview
{
struct rtgui_textview
{
/* inherit from widget */
struct rtgui_widget parent;
rt_uint16_t line_width;
rt_uint16_t line_count;
char* lines;
char *lines;
rt_int16_t line_current;
rt_uint16_t line_page_count;
};
typedef struct rtgui_textview rtgui_textview_t;
};
typedef struct rtgui_textview rtgui_textview_t;
rtgui_textview_t* rtgui_textview_create(const char* text, const rtgui_rect_t *rect);
void rtgui_textview_destroy(rtgui_textview_t* textview);
rtgui_textview_t *rtgui_textview_create(const char *text, const rtgui_rect_t *rect);
void rtgui_textview_destroy(rtgui_textview_t *textview);
rt_bool_t rtgui_textview_event_handler(struct rtgui_object* object, struct rtgui_event* event);
void rtgui_textview_set_text(rtgui_textview_t* textview, const char* text);
rt_bool_t rtgui_textview_event_handler(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_textview_set_text(rtgui_textview_t *textview, const char *text);
/** @} */
/** @} */
#ifdef __cplusplus
}

View File

@ -29,16 +29,16 @@ struct rtgui_wintitle
struct rtgui_widget parent;
/* title */
char* title;
char *title;
};
typedef struct rtgui_wintitle rtgui_wintitle_t;
rtgui_wintitle_t* rtgui_wintitle_create(struct rtgui_win *window, const char* title);
void rtgui_wintitle_destroy(rtgui_wintitle_t* wintitle);
rtgui_wintitle_t *rtgui_wintitle_create(struct rtgui_win *window, const char *title);
void rtgui_wintitle_destroy(rtgui_wintitle_t *wintitle);
rt_bool_t rtgui_wintile_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
rt_bool_t rtgui_wintile_event_handler(rtgui_widget_t *widget, rtgui_event_t *event);
void rtgui_wintitle_set_title(rtgui_wintitle_t* wintitle, const char* title);
char *rtgui_wintitle_get_title(rtgui_wintitle_t* wintitle);
void rtgui_wintitle_set_title(rtgui_wintitle_t *wintitle, const char *title);
char *rtgui_wintitle_get_title(rtgui_wintitle_t *wintitle);
#endif

View File

@ -33,7 +33,7 @@ extern "C" {
#define RTGUI_WIDGET_FLAG_FOCUSABLE 0x0010
#define RTGUI_WIDGET_FLAG_DC_VISIBLE 0x0100
/* rtgui widget attribute */
/* rtgui widget attribute */
#define RTGUI_WIDGET_FOREGROUND(w) (RTGUI_WIDGET(w)->gc.foreground)
#define RTGUI_WIDGET_BACKGROUND(w) (RTGUI_WIDGET(w)->gc.background)
#define RTGUI_WIDGET_TEXTALIGN(w) (RTGUI_WIDGET(w)->gc.textalign)
@ -62,20 +62,20 @@ extern "C" {
#define RTGUI_WIDGET_DC_SET_UNVISIBLE(w) RTGUI_WIDGET_FLAG(w) &= ~RTGUI_WIDGET_FLAG_DC_VISIBLE
#define RTGUI_WIDGET_DC(w) ((struct rtgui_dc*)&((w)->dc_type))
DECLARE_CLASS_TYPE(widget);
DECLARE_CLASS_TYPE(widget);
/** Gets the type of a widget */
/** Gets the type of a widget */
#define RTGUI_WIDGET_TYPE (RTGUI_TYPE(widget))
/** Casts the object to a rtgui_widget */
/** Casts the object to a rtgui_widget */
#define RTGUI_WIDGET(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_WIDGET_TYPE, rtgui_widget_t))
/** Check if the object is a rtgui_widget */
/** Check if the object is a rtgui_widget */
#define RTGUI_IS_WIDGET(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_WIDGET_TYPE))
/*
/*
* the base widget object
*/
struct rtgui_widget
{
struct rtgui_widget
{
/* inherit from rtgui_object */
struct rtgui_object object;
@ -91,7 +91,7 @@ struct rtgui_widget
/* hardware device context */
rt_uint32_t dc_type;
const struct rtgui_dc_engine* dc_engine;
const struct rtgui_dc_engine *dc_engine;
/* the graphic context of widget */
rtgui_gc_t gc;
@ -109,92 +109,92 @@ struct rtgui_widget
rtgui_region_t clip;
/* call back */
rt_bool_t (*on_focus_in) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_focus_out) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_focus_in)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_focus_out)(struct rtgui_object *widget, struct rtgui_event *event);
#ifndef RTGUI_USING_SMALL_SIZE
rt_bool_t (*on_draw) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_mouseclick) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_key) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_size) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_command) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_draw)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_mouseclick)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_key)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_size)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_command)(struct rtgui_object *widget, struct rtgui_event *event);
#endif
/* user private data */
rt_uint32_t user_data;
};
typedef struct rtgui_widget rtgui_widget_t;
};
typedef struct rtgui_widget rtgui_widget_t;
rtgui_widget_t *rtgui_widget_create(rtgui_type_t *widget_type);
void rtgui_widget_destroy(rtgui_widget_t* widget);
rtgui_widget_t *rtgui_widget_create(rtgui_type_t *widget_type);
void rtgui_widget_destroy(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_event_handler(struct rtgui_object* object, rtgui_event_t* event);
rt_bool_t rtgui_widget_event_handler(struct rtgui_object *object, rtgui_event_t *event);
/* focus and unfocus */
void rtgui_widget_focus(rtgui_widget_t * widget);
void rtgui_widget_unfocus(rtgui_widget_t *widget);
/* focus and unfocus */
void rtgui_widget_focus(rtgui_widget_t *widget);
void rtgui_widget_unfocus(rtgui_widget_t *widget);
/* event handler for each command */
void rtgui_widget_set_onfocus(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onunfocus(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
/* event handler for each command */
void rtgui_widget_set_onfocus(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onunfocus(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
#ifndef RTGUI_USING_SMALL_SIZE
void rtgui_widget_set_ondraw(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onmouseclick(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onkey(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onsize(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_oncommand(rtgui_widget_t* widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_ondraw(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onmouseclick(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onkey(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_onsize(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
void rtgui_widget_set_oncommand(rtgui_widget_t *widget, rtgui_event_handler_ptr handler);
#endif
/* get and set rect of widget */
void rtgui_widget_get_rect(rtgui_widget_t* widget, rtgui_rect_t *rect);
void rtgui_widget_set_border(rtgui_widget_t* widget, rt_uint32_t style);
void rtgui_widget_set_rect(rtgui_widget_t* widget, const rtgui_rect_t* rect);
void rtgui_widget_set_rectangle(rtgui_widget_t* widget, int x, int y, int width, int height);
void rtgui_widget_get_extent(rtgui_widget_t* widget, rtgui_rect_t *rect);
/* get and set rect of widget */
void rtgui_widget_get_rect(rtgui_widget_t *widget, rtgui_rect_t *rect);
void rtgui_widget_set_border(rtgui_widget_t *widget, rt_uint32_t style);
void rtgui_widget_set_rect(rtgui_widget_t *widget, const rtgui_rect_t *rect);
void rtgui_widget_set_rectangle(rtgui_widget_t *widget, int x, int y, int width, int height);
void rtgui_widget_get_extent(rtgui_widget_t *widget, rtgui_rect_t *rect);
#ifndef RTGUI_USING_SMALL_SIZE
void rtgui_widget_set_miniwidth(rtgui_widget_t* widget, int width);
void rtgui_widget_set_miniheight(rtgui_widget_t* widget, int height);
void rtgui_widget_set_miniwidth(rtgui_widget_t *widget, int width);
void rtgui_widget_set_miniheight(rtgui_widget_t *widget, int height);
#endif
void rtgui_widget_set_parent(rtgui_widget_t* widget, rtgui_widget_t* parent);
void rtgui_widget_set_parent(rtgui_widget_t *widget, rtgui_widget_t *parent);
/* get the physical position of a logic point on widget */
void rtgui_widget_point_to_device(rtgui_widget_t * widget, rtgui_point_t * point);
/* get the physical position of a logic rect on widget */
void rtgui_widget_rect_to_device(rtgui_widget_t * widget, rtgui_rect_t * rect);
/* get the physical position of a logic point on widget */
void rtgui_widget_point_to_device(rtgui_widget_t *widget, rtgui_point_t *point);
/* get the physical position of a logic rect on widget */
void rtgui_widget_rect_to_device(rtgui_widget_t *widget, rtgui_rect_t *rect);
/* get the logic position of a physical point on widget */
void rtgui_widget_point_to_logic(rtgui_widget_t* widget, rtgui_point_t * point);
/* get the logic position of a physical rect on widget */
void rtgui_widget_rect_to_logic(rtgui_widget_t* widget, rtgui_rect_t* rect);
/* get the logic position of a physical point on widget */
void rtgui_widget_point_to_logic(rtgui_widget_t *widget, rtgui_point_t *point);
/* get the logic position of a physical rect on widget */
void rtgui_widget_rect_to_logic(rtgui_widget_t *widget, rtgui_rect_t *rect);
/* move widget and its children to a logic point */
void rtgui_widget_move_to_logic(rtgui_widget_t* widget, int dx, int dy);
/* move widget and its children to a logic point */
void rtgui_widget_move_to_logic(rtgui_widget_t *widget, int dx, int dy);
/* update the clip info of widget */
void rtgui_widget_update_clip(rtgui_widget_t* widget);
/* update the clip info of widget */
void rtgui_widget_update_clip(rtgui_widget_t *widget);
/* get the toplevel widget of widget */
struct rtgui_win* rtgui_widget_get_toplevel(rtgui_widget_t* widget);
rt_bool_t rtgui_widget_onupdate_toplvl(struct rtgui_object *object, struct rtgui_event *event);
/* get the toplevel widget of widget */
struct rtgui_win *rtgui_widget_get_toplevel(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onupdate_toplvl(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_show(rtgui_widget_t* widget);
rt_bool_t rtgui_widget_onshow(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_hide(rtgui_widget_t* widget);
rt_bool_t rtgui_widget_onhide(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_update(rtgui_widget_t* widget);
void rtgui_widget_show(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onshow(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_hide(rtgui_widget_t *widget);
rt_bool_t rtgui_widget_onhide(struct rtgui_object *object, struct rtgui_event *event);
void rtgui_widget_update(rtgui_widget_t *widget);
/* get parent color */
rtgui_color_t rtgui_widget_get_parent_foreground(rtgui_widget_t* widget);
rtgui_color_t rtgui_widget_get_parent_background(rtgui_widget_t* widget);
/* get parent color */
rtgui_color_t rtgui_widget_get_parent_foreground(rtgui_widget_t *widget);
rtgui_color_t rtgui_widget_get_parent_background(rtgui_widget_t *widget);
/* get the next sibling of widget */
rtgui_widget_t* rtgui_widget_get_next_sibling(rtgui_widget_t* widget);
/* get the prev sibling of widget */
rtgui_widget_t* rtgui_widget_get_prev_sibling(rtgui_widget_t* widget);
/* get the next sibling of widget */
rtgui_widget_t *rtgui_widget_get_next_sibling(rtgui_widget_t *widget);
/* get the prev sibling of widget */
rtgui_widget_t *rtgui_widget_get_prev_sibling(rtgui_widget_t *widget);
/* dump widget information */
void rtgui_widget_dump(rtgui_widget_t* widget);
/* dump widget information */
void rtgui_widget_dump(rtgui_widget_t *widget);
#ifdef __cplusplus
}

View File

@ -78,6 +78,9 @@ struct rtgui_win
/* the widget that will grab the focus in current window */
struct rtgui_widget *focused_widget;
/* which app I belong */
struct rtgui_app *app;
/* window style */
rt_uint16_t style;
@ -87,15 +90,15 @@ struct rtgui_win
rtgui_modal_code_t modal_code;
/* last mouse event handled widget */
rtgui_widget_t* last_mevent_widget;
rtgui_widget_t *last_mevent_widget;
/* window title */
char* title;
char *title;
/* call back */
rt_bool_t (*on_activate) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_deactivate) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_close) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_activate)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_deactivate)(struct rtgui_object *widget, struct rtgui_event *event);
rt_bool_t (*on_close)(struct rtgui_object *widget, struct rtgui_event *event);
/* the key is sent to the focused widget by default. If the focused widget
* and all of it's parents didn't handle the key event, it will be handled
* by @func on_key
@ -103,17 +106,17 @@ struct rtgui_win
* If you want to handle key event on your own, it's better to overload
* this function other than handle EVENT_KBD in event_handler.
*/
rt_bool_t (*on_key) (struct rtgui_object* widget, struct rtgui_event* event);
rt_bool_t (*on_key)(struct rtgui_object *widget, struct rtgui_event *event);
/* reserved user data */
rt_uint32_t user_data;
};
rtgui_win_t* rtgui_win_create(struct rtgui_win *parent_window, const char* title,
rtgui_win_t *rtgui_win_create(struct rtgui_win *parent_window, const char *title,
rtgui_rect_t *rect, rt_uint16_t style);
rtgui_win_t* rtgui_mainwin_create(struct rtgui_win *parent_window, const char* title, rt_uint16_t style);
rtgui_win_t *rtgui_mainwin_create(struct rtgui_win *parent_window, const char *title, rt_uint16_t style);
void rtgui_win_destroy(rtgui_win_t* win);
void rtgui_win_destroy(rtgui_win_t *win);
/** Close window.
*
@ -124,30 +127,30 @@ void rtgui_win_destroy(rtgui_win_t* win);
*
* \sa rtgui_win_set_onclose .
*/
rt_bool_t rtgui_win_close(struct rtgui_win* win);
rt_bool_t rtgui_win_close(struct rtgui_win *win);
rt_base_t rtgui_win_show(struct rtgui_win *win, rt_bool_t is_modal);
void rtgui_win_hiden(rtgui_win_t* win);
void rtgui_win_end_modal(rtgui_win_t* win, rtgui_modal_code_t modal_code);
void rtgui_win_hiden(rtgui_win_t *win);
void rtgui_win_end_modal(rtgui_win_t *win, rtgui_modal_code_t modal_code);
rt_err_t rtgui_win_activate(struct rtgui_win *win);
rt_bool_t rtgui_win_is_activated(struct rtgui_win* win);
rt_bool_t rtgui_win_is_activated(struct rtgui_win *win);
void rtgui_win_move(struct rtgui_win* win, int x, int y);
void rtgui_win_move(struct rtgui_win *win, int x, int y);
/* reset extent of window */
void rtgui_win_set_rect(rtgui_win_t* win, rtgui_rect_t* rect);
void rtgui_win_update_clip(struct rtgui_win* win);
void rtgui_win_set_rect(rtgui_win_t *win, rtgui_rect_t *rect);
void rtgui_win_update_clip(struct rtgui_win *win);
void rtgui_win_set_onactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler);
void rtgui_win_set_ondeactivate(rtgui_win_t* win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onclose(rtgui_win_t* win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onkey(rtgui_win_t* win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onactivate(rtgui_win_t *win, rtgui_event_handler_ptr handler);
void rtgui_win_set_ondeactivate(rtgui_win_t *win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onclose(rtgui_win_t *win, rtgui_event_handler_ptr handler);
void rtgui_win_set_onkey(rtgui_win_t *win, rtgui_event_handler_ptr handler);
rt_bool_t rtgui_win_event_handler(struct rtgui_object* win, struct rtgui_event* event);
rt_bool_t rtgui_win_event_handler(struct rtgui_object *win, struct rtgui_event *event);
void rtgui_win_event_loop(rtgui_win_t* wnd);
void rtgui_win_event_loop(rtgui_win_t *wnd);
void rtgui_win_set_title(rtgui_win_t* win, const char *title);
char* rtgui_win_get_title(rtgui_win_t* win);
void rtgui_win_set_title(rtgui_win_t *win, const char *title);
char *rtgui_win_get_title(rtgui_win_t *win);
#endif

View File

@ -20,7 +20,7 @@ extern const struct rtgui_graphic_driver_ops *rtgui_pixel_device_get_ops(int pix
extern const struct rtgui_graphic_driver_ops *rtgui_framebuffer_get_ops(int pixel_format);
/* get default driver */
struct rtgui_graphic_driver* rtgui_graphic_driver_get_default()
struct rtgui_graphic_driver *rtgui_graphic_driver_get_default()
{
return &_driver;
}
@ -56,7 +56,7 @@ rt_err_t rtgui_graphic_set_device(rt_device_t device)
_driver.bits_per_pixel = info.bits_per_pixel;
_driver.width = info.width;
_driver.height = info.height;
_driver.pitch = _driver.width * _driver.bits_per_pixel/8;
_driver.pitch = _driver.width * _driver.bits_per_pixel / 8;
_driver.framebuffer = info.framebuffer;
if (info.framebuffer != RT_NULL)
@ -75,11 +75,12 @@ rt_err_t rtgui_graphic_set_device(rt_device_t device)
RTM_EXPORT(rtgui_graphic_set_device);
/* screen update */
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver* driver, rtgui_rect_t *rect)
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect)
{
struct rt_device_rect_info rect_info;
rect_info.x = rect->x1; rect_info.y = rect->y1;
rect_info.x = rect->x1;
rect_info.y = rect->y1;
rect_info.width = rect->x2 - rect->x1;
rect_info.height = rect->y2 - rect->y1;
rt_device_control(driver->device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect_info);
@ -87,13 +88,13 @@ void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver* drive
RTM_EXPORT(rtgui_graphic_driver_screen_update);
/* get video frame buffer */
rt_uint8_t* rtgui_graphic_driver_get_framebuffer(const struct rtgui_graphic_driver* driver)
rt_uint8_t *rtgui_graphic_driver_get_framebuffer(const struct rtgui_graphic_driver *driver)
{
return (rt_uint8_t*)driver->framebuffer;
return (rt_uint8_t *)driver->framebuffer;
}
RTM_EXPORT(rtgui_graphic_driver_get_framebuffer);
rt_uint8_t* rtgui_graphic_driver_get_default_framebuffer(void)
rt_uint8_t *rtgui_graphic_driver_get_default_framebuffer(void)
{
return rtgui_graphic_driver_get_framebuffer(&_driver);
}

View File

@ -54,11 +54,12 @@ struct rtgui_cursor
#endif
};
struct rtgui_cursor* _rtgui_cursor;
struct rtgui_cursor *_rtgui_cursor;
#ifdef RTGUI_USING_MOUSE_CURSOR
struct rt_mutex cursor_mutex;
static const rt_uint8_t * cursor_xpm[] = {
static const rt_uint8_t *cursor_xpm[] =
{
"16 16 35 1",
" c None",
". c #A0B8D0",
@ -110,27 +111,28 @@ static const rt_uint8_t * cursor_xpm[] = {
" / )345 ",
" 6}${ ",
" 5{ ",
" "};
" "
};
static void rtgui_cursor_restore (void);
static void rtgui_cursor_save (void);
static void rtgui_cursor_show (void);
static void rtgui_cursor_restore(void);
static void rtgui_cursor_save(void);
static void rtgui_cursor_show(void);
#endif
#ifdef RTGUI_USING_WINMOVE
static void rtgui_winrect_restore (void);
static void rtgui_winrect_save (void);
static void rtgui_winrect_show (void);
static void rtgui_winrect_restore(void);
static void rtgui_winrect_save(void);
static void rtgui_winrect_show(void);
#endif
#define WIN_MOVE_BORDER 4
void rtgui_mouse_init(void)
{
const struct rtgui_graphic_driver* gd = rtgui_graphic_driver_get_default();
const struct rtgui_graphic_driver *gd = rtgui_graphic_driver_get_default();
if (_rtgui_cursor != RT_NULL) rtgui_mouse_fini();
_rtgui_cursor = (struct rtgui_cursor*) rtgui_malloc(sizeof(struct rtgui_cursor));
_rtgui_cursor = (struct rtgui_cursor *) rtgui_malloc(sizeof(struct rtgui_cursor));
rt_memset(_rtgui_cursor, 0, sizeof(struct rtgui_cursor));
#ifdef RTGUI_USING_MOUSE_CURSOR
@ -138,13 +140,13 @@ void rtgui_mouse_init(void)
#endif
/* init cursor */
_rtgui_cursor->bpp = gd->bits_per_pixel/8;
_rtgui_cursor->bpp = gd->bits_per_pixel / 8;
_rtgui_cursor->screen_pitch = _rtgui_cursor->bpp * gd->width;
#ifdef RTGUI_USING_MOUSE_CURSOR
/* init cursor image */
_rtgui_cursor->cursor_image = rtgui_image_create_from_mem("xpm",
(rt_uint8_t*)cursor_xpm,
(rt_uint8_t *)cursor_xpm,
sizeof(cursor_xpm),
RT_TRUE);
if (_rtgui_cursor->cursor_image == RT_NULL)
@ -267,11 +269,11 @@ void rtgui_mouse_set_cursor_enable(rt_bool_t enable)
}
/* set current cursor image */
void rtgui_mouse_set_cursor(rtgui_image_t* cursor)
void rtgui_mouse_set_cursor(rtgui_image_t *cursor)
{
}
void rtgui_mouse_get_cursor_rect(rtgui_rect_t* rect)
void rtgui_mouse_get_cursor_rect(rtgui_rect_t *rect)
{
if (rect != RT_NULL)
{
@ -308,9 +310,9 @@ void rtgui_mouse_hide_cursor()
_rtgui_cursor->show_cursor_count --;
}
rt_bool_t rtgui_mouse_is_intersect(rtgui_rect_t* r)
rt_bool_t rtgui_mouse_is_intersect(rtgui_rect_t *r)
{
return rtgui_rect_is_intersect(&(_rtgui_cursor->rect), r) == RT_EOK? RT_TRUE : RT_FALSE;
return rtgui_rect_is_intersect(&(_rtgui_cursor->rect), r) == RT_EOK ? RT_TRUE : RT_FALSE;
}
/* display the saved cursor area to screen */
@ -324,11 +326,11 @@ static void rtgui_cursor_restore()
cursor_ptr = _rtgui_cursor->cursor_saved;
height = (_rtgui_cursor->cy + _rtgui_cursor->cursor_image->h <
rtgui_graphic_driver_get_default()->height)? _rtgui_cursor->cursor_image->h :
rtgui_graphic_driver_get_default()->height) ? _rtgui_cursor->cursor_image->h :
rtgui_graphic_driver_get_default()->height - _rtgui_cursor->cy;
cursor_pitch = (_rtgui_cursor->cx + _rtgui_cursor->cursor_image->w <
rtgui_graphic_driver_get_default()->width)? _rtgui_cursor->cursor_pitch :
rtgui_graphic_driver_get_default()->width) ? _rtgui_cursor->cursor_pitch :
(rtgui_graphic_driver_get_default()->width - _rtgui_cursor->cx) * _rtgui_cursor->bpp;
for (idx = 0; idx < height; idx ++)
@ -351,11 +353,11 @@ static void rtgui_cursor_save()
cursor_ptr = _rtgui_cursor->cursor_saved;
height = (_rtgui_cursor->cy + _rtgui_cursor->cursor_image->h <
rtgui_graphic_driver_get_default()->height)? _rtgui_cursor->cursor_image->h :
rtgui_graphic_driver_get_default()->height) ? _rtgui_cursor->cursor_image->h :
rtgui_graphic_driver_get_default()->height - _rtgui_cursor->cy;
cursor_pitch = (_rtgui_cursor->cx + _rtgui_cursor->cursor_image->w <
rtgui_graphic_driver_get_default()->width)? _rtgui_cursor->cursor_pitch :
rtgui_graphic_driver_get_default()->width) ? _rtgui_cursor->cursor_pitch :
(rtgui_graphic_driver_get_default()->width - _rtgui_cursor->cx) * _rtgui_cursor->bpp;
for (idx = 0; idx < height; idx ++)
@ -372,11 +374,11 @@ static void rtgui_cursor_show()
// FIXME: the prototype of set_pixel is using int so we have to use int
// as well. Might be uniformed with others in the future
int x, y;
rtgui_color_t* ptr;
rtgui_color_t *ptr;
rtgui_rect_t rect;
void (*set_pixel) (rtgui_color_t *c, int x, int y);
void (*set_pixel)(rtgui_color_t * c, int x, int y);
ptr = (rtgui_color_t*) _rtgui_cursor->cursor_image->data;
ptr = (rtgui_color_t *) _rtgui_cursor->cursor_image->data;
set_pixel = rtgui_graphic_driver_get_default()->ops->set_pixel;
rtgui_mouse_get_cursor_rect(&rect);
@ -404,17 +406,17 @@ static void rtgui_cursor_show()
#endif
#ifdef RTGUI_USING_WINMOVE
void rtgui_winrect_set(struct rtgui_topwin* topwin)
void rtgui_winrect_set(struct rtgui_topwin *topwin)
{
/* set win rect show */
_rtgui_cursor->win_rect_show = RT_TRUE;
/* set win rect */
_rtgui_cursor->win_rect = topwin->title == RT_NULL? topwin->extent : RTGUI_WIDGET(topwin->title)->extent;
_rtgui_cursor->win_rect = topwin->title == RT_NULL ? topwin->extent : RTGUI_WIDGET(topwin->title)->extent;
_rtgui_cursor->topwin = topwin;
}
rt_bool_t rtgui_winrect_moved_done(rtgui_rect_t* winrect, struct rtgui_topwin** topwin)
rt_bool_t rtgui_winrect_moved_done(rtgui_rect_t *winrect, struct rtgui_topwin **topwin)
{
rt_bool_t moved = RT_FALSE;
@ -451,7 +453,7 @@ static void rtgui_winrect_show()
rt_uint16_t x, y;
rtgui_color_t c;
rtgui_rect_t screen_rect, win_rect, win_rect_inner;
void (*set_pixel) (rtgui_color_t *c, int x, int y);
void (*set_pixel)(rtgui_color_t * c, int x, int y);
c = black;
set_pixel = rtgui_graphic_driver_get_default()->ops->set_pixel;
@ -536,7 +538,7 @@ static void rtgui_winrect_restore()
/* restore winrect top */
fb_ptr = driver_fb + win_rect.y1 * _rtgui_cursor->screen_pitch +
(win_rect.x1 + WIN_MOVE_BORDER)* _rtgui_cursor->bpp;
(win_rect.x1 + WIN_MOVE_BORDER) * _rtgui_cursor->bpp;
winrect_ptr = _rtgui_cursor->win_top;
winrect_pitch = (win_rect.x2 - win_rect.x1 - 2 * WIN_MOVE_BORDER) * _rtgui_cursor->bpp;
display_direct_memcpy(winrect_ptr, fb_ptr, winrect_pitch, _rtgui_cursor->screen_pitch,
@ -584,7 +586,7 @@ static void rtgui_winrect_save()
/* save winrect top */
fb_ptr = driver_fb + win_rect.y1 * _rtgui_cursor->screen_pitch +
(win_rect.x1 + WIN_MOVE_BORDER)* _rtgui_cursor->bpp;
(win_rect.x1 + WIN_MOVE_BORDER) * _rtgui_cursor->bpp;
winrect_ptr = _rtgui_cursor->win_top;
winrect_pitch = (win_rect.x2 - win_rect.x1 - 2 * WIN_MOVE_BORDER) * _rtgui_cursor->bpp;
display_direct_memcpy(fb_ptr, winrect_ptr, _rtgui_cursor->screen_pitch, winrect_pitch,
@ -599,15 +601,15 @@ static void rtgui_winrect_save()
}
#endif
void rtgui_mouse_monitor_append(rtgui_list_t* head, rtgui_rect_t* rect)
void rtgui_mouse_monitor_append(rtgui_list_t *head, rtgui_rect_t *rect)
{
struct rtgui_mouse_monitor* mmonitor;
struct rtgui_mouse_monitor *mmonitor;
/* check parameters */
if (head == RT_NULL || rect == RT_NULL) return;
/* create a mouse monitor node */
mmonitor = (struct rtgui_mouse_monitor*) rtgui_malloc (sizeof(struct rtgui_mouse_monitor));
mmonitor = (struct rtgui_mouse_monitor *) rtgui_malloc(sizeof(struct rtgui_mouse_monitor));
if (mmonitor == RT_NULL) return; /* no memory */
/* set mouse monitor node */
@ -618,10 +620,10 @@ void rtgui_mouse_monitor_append(rtgui_list_t* head, rtgui_rect_t* rect)
rtgui_list_append(head, &(mmonitor->list));
}
void rtgui_mouse_monitor_remove(rtgui_list_t* head, rtgui_rect_t* rect)
void rtgui_mouse_monitor_remove(rtgui_list_t *head, rtgui_rect_t *rect)
{
struct rtgui_list_node* node;
struct rtgui_mouse_monitor* mmonitor;
struct rtgui_list_node *node;
struct rtgui_mouse_monitor *mmonitor;
/* check parameters */
if (head == RT_NULL || rect == RT_NULL) return;
@ -643,16 +645,16 @@ void rtgui_mouse_monitor_remove(rtgui_list_t* head, rtgui_rect_t* rect)
}
}
rt_bool_t rtgui_mouse_monitor_contains_point(rtgui_list_t* head, int x, int y)
rt_bool_t rtgui_mouse_monitor_contains_point(rtgui_list_t *head, int x, int y)
{
struct rtgui_list_node* node;
struct rtgui_list_node *node;
/* check parameter */
if (head == RT_NULL) return RT_FALSE;
rtgui_list_foreach(node, head)
{
struct rtgui_mouse_monitor* monitor = rtgui_list_entry(node,
struct rtgui_mouse_monitor *monitor = rtgui_list_entry(node,
struct rtgui_mouse_monitor, list);
if (rtgui_rect_contains_point(&(monitor->rect), x, y) == RT_EOK)

View File

@ -33,22 +33,22 @@ void rtgui_mouse_fini(void);
void rtgui_mouse_moveto(int x, int y);
void rtgui_mouse_set_cursor_enable(rt_bool_t enable);
void rtgui_mouse_set_cursor(rtgui_image_t* cursor);
void rtgui_mouse_get_cursor_rect(rtgui_rect_t* rect);
void rtgui_mouse_set_cursor(rtgui_image_t *cursor);
void rtgui_mouse_get_cursor_rect(rtgui_rect_t *rect);
void rtgui_mouse_show_cursor(void);
void rtgui_mouse_hide_cursor(void);
rt_bool_t rtgui_mouse_is_intersect(rtgui_rect_t* r);
rt_bool_t rtgui_mouse_is_intersect(rtgui_rect_t *r);
#ifdef RTGUI_USING_WINMOVE
rt_bool_t rtgui_winrect_is_moved(void);
void rtgui_winrect_set(struct rtgui_topwin* topwin);
rt_bool_t rtgui_winrect_moved_done(rtgui_rect_t* winrect, struct rtgui_topwin** topwin);
void rtgui_winrect_set(struct rtgui_topwin *topwin);
rt_bool_t rtgui_winrect_moved_done(rtgui_rect_t *winrect, struct rtgui_topwin **topwin);
#endif
void rtgui_mouse_monitor_append(rtgui_list_t* head, rtgui_rect_t* rect);
void rtgui_mouse_monitor_remove(rtgui_list_t* head, rtgui_rect_t* rect);
rt_bool_t rtgui_mouse_monitor_contains_point(rtgui_list_t* head, int x, int y);
void rtgui_mouse_monitor_append(rtgui_list_t *head, rtgui_rect_t *rect);
void rtgui_mouse_monitor_remove(rtgui_list_t *head, rtgui_rect_t *rect);
rt_bool_t rtgui_mouse_monitor_contains_point(rtgui_list_t *head, int x, int y);
#endif

View File

@ -27,9 +27,9 @@ static struct rt_thread *rtgui_server_tid;
static struct rtgui_app *rtgui_server_application = RT_NULL;
static struct rtgui_app *rtgui_wm_application = RT_NULL;
void rtgui_server_handle_update(struct rtgui_event_update_end* event)
void rtgui_server_handle_update(struct rtgui_event_update_end *event)
{
struct rtgui_graphic_driver* driver;
struct rtgui_graphic_driver *driver;
driver = rtgui_graphic_driver_get_default();
if (driver != RT_NULL)
@ -38,21 +38,21 @@ void rtgui_server_handle_update(struct rtgui_event_update_end* event)
}
}
void rtgui_server_handle_monitor_add(struct rtgui_event_monitor* event)
void rtgui_server_handle_monitor_add(struct rtgui_event_monitor *event)
{
/* add monitor rect to top window list */
rtgui_topwin_append_monitor_rect(event->wid, &(event->rect));
}
void rtgui_server_handle_monitor_remove(struct rtgui_event_monitor* event)
void rtgui_server_handle_monitor_remove(struct rtgui_event_monitor *event)
{
/* add monitor rect to top window list */
rtgui_topwin_remove_monitor_rect(event->wid, &(event->rect));
}
void rtgui_server_handle_mouse_btn(struct rtgui_event_mouse* event)
void rtgui_server_handle_mouse_btn(struct rtgui_event_mouse *event)
{
struct rtgui_topwin* wnd;
struct rtgui_topwin *wnd;
/* re-init to server thread */
RTGUI_EVENT_MOUSE_BUTTON_INIT(event);
@ -61,7 +61,7 @@ void rtgui_server_handle_mouse_btn(struct rtgui_event_mouse* event)
if (rtgui_winrect_is_moved() &&
event->button & (RTGUI_MOUSE_BUTTON_LEFT | RTGUI_MOUSE_BUTTON_UP))
{
struct rtgui_topwin* topwin;
struct rtgui_topwin *topwin;
rtgui_rect_t rect;
if (rtgui_winrect_moved_done(&rect, &topwin) == RT_TRUE)
@ -114,18 +114,18 @@ void rtgui_server_handle_mouse_btn(struct rtgui_event_mouse* event)
else
{
/* send mouse event to thread */
rtgui_send(wnd->tid, (struct rtgui_event*)event, sizeof(struct rtgui_event_mouse));
rtgui_send(wnd->tid, (struct rtgui_event *)event, sizeof(struct rtgui_event_mouse));
}
return ;
}
}
static struct rtgui_topwin* last_monitor_topwin = RT_NULL;
static struct rtgui_topwin *last_monitor_topwin = RT_NULL;
void rtgui_server_handle_mouse_motion(struct rtgui_event_mouse* event)
void rtgui_server_handle_mouse_motion(struct rtgui_event_mouse *event)
{
/* the topwin contains current mouse */
struct rtgui_topwin* win = RT_NULL;
struct rtgui_topwin *win = RT_NULL;
/* re-init mouse event */
RTGUI_EVENT_MOUSE_MOTION_INIT(event);
@ -165,9 +165,9 @@ void rtgui_server_handle_mouse_motion(struct rtgui_event_mouse* event)
rtgui_mouse_moveto(event->x, event->y);
}
void rtgui_server_handle_kbd(struct rtgui_event_kbd* event)
void rtgui_server_handle_kbd(struct rtgui_event_kbd *event)
{
struct rtgui_topwin* wnd;
struct rtgui_topwin *wnd;
/* re-init to server thread */
RTGUI_EVENT_KBD_INIT(event);
@ -183,13 +183,13 @@ void rtgui_server_handle_kbd(struct rtgui_event_kbd* event)
event->wid = wnd->wid;
/* send keyboard event to thread */
rtgui_send(wnd->tid, (struct rtgui_event*)event, sizeof(struct rtgui_event_kbd));
rtgui_send(wnd->tid, (struct rtgui_event *)event, sizeof(struct rtgui_event_kbd));
return;
}
}
#ifdef _WIN32
#ifdef _WIN32_NATIVE
#include <windows.h>
#endif
@ -219,57 +219,57 @@ static rt_bool_t rtgui_server_event_handler(struct rtgui_object *object,
/* mouse and keyboard event */
case RTGUI_EVENT_MOUSE_MOTION:
/* handle mouse motion event */
rtgui_server_handle_mouse_motion((struct rtgui_event_mouse*)event);
rtgui_server_handle_mouse_motion((struct rtgui_event_mouse *)event);
break;
case RTGUI_EVENT_MOUSE_BUTTON:
/* handle mouse button */
rtgui_server_handle_mouse_btn((struct rtgui_event_mouse*)event);
rtgui_server_handle_mouse_btn((struct rtgui_event_mouse *)event);
break;
case RTGUI_EVENT_KBD:
/* handle keyboard event */
rtgui_server_handle_kbd((struct rtgui_event_kbd*)event);
rtgui_server_handle_kbd((struct rtgui_event_kbd *)event);
break;
/* window event */
case RTGUI_EVENT_WIN_CREATE:
if (rtgui_topwin_add((struct rtgui_event_win_create*)event) == RT_EOK)
if (rtgui_topwin_add((struct rtgui_event_win_create *)event) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
break;
case RTGUI_EVENT_WIN_SHOW:
if (rtgui_topwin_show((struct rtgui_event_win*)event) == RT_EOK)
if (rtgui_topwin_show((struct rtgui_event_win *)event) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
break;
case RTGUI_EVENT_WIN_HIDE:
if (rtgui_topwin_hide((struct rtgui_event_win*)event) == RT_EOK)
if (rtgui_topwin_hide((struct rtgui_event_win *)event) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
break;
case RTGUI_EVENT_WIN_MOVE:
if (rtgui_topwin_move((struct rtgui_event_win_move*)event) == RT_EOK)
if (rtgui_topwin_move((struct rtgui_event_win_move *)event) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
break;
case RTGUI_EVENT_WIN_MODAL_ENTER:
if (rtgui_topwin_modal_enter((struct rtgui_event_win_modal_enter*)event) == RT_EOK)
if (rtgui_topwin_modal_enter((struct rtgui_event_win_modal_enter *)event) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
break;
case RTGUI_EVENT_WIN_ACTIVATE:
if (rtgui_topwin_activate((struct rtgui_event_win_activate*)event) == RT_EOK)
if (rtgui_topwin_activate((struct rtgui_event_win_activate *)event) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
@ -277,17 +277,17 @@ static rt_bool_t rtgui_server_event_handler(struct rtgui_object *object,
case RTGUI_EVENT_WIN_DESTROY:
if (last_monitor_topwin != RT_NULL &&
last_monitor_topwin->wid == ((struct rtgui_event_win*)event)->wid)
last_monitor_topwin->wid == ((struct rtgui_event_win *)event)->wid)
last_monitor_topwin = RT_NULL;
if (rtgui_topwin_remove(((struct rtgui_event_win*)event)->wid) == RT_EOK)
if (rtgui_topwin_remove(((struct rtgui_event_win *)event)->wid) == RT_EOK)
rtgui_ack(event, RTGUI_STATUS_OK);
else
rtgui_ack(event, RTGUI_STATUS_ERROR);
break;
case RTGUI_EVENT_WIN_RESIZE:
rtgui_topwin_resize(((struct rtgui_event_win_resize*)event)->wid,
&(((struct rtgui_event_win_resize*)event)->rect));
rtgui_topwin_resize(((struct rtgui_event_win_resize *)event)->wid,
&(((struct rtgui_event_win_resize *)event)->rect));
break;
case RTGUI_EVENT_SET_WM:
@ -299,7 +299,7 @@ static rt_bool_t rtgui_server_event_handler(struct rtgui_object *object,
{
struct rtgui_event_set_wm *set_wm;
set_wm = (struct rtgui_event_set_wm*) event;
set_wm = (struct rtgui_event_set_wm *) event;
rtgui_wm_application = set_wm->app;
rtgui_ack(event, RTGUI_STATUS_OK);
}
@ -318,7 +318,7 @@ static rt_bool_t rtgui_server_event_handler(struct rtgui_object *object,
case RTGUI_EVENT_UPDATE_END:
/* handle screen update */
rtgui_server_handle_update((struct rtgui_event_update_end*)event);
rtgui_server_handle_update((struct rtgui_event_update_end *)event);
#ifdef RTGUI_USING_MOUSE_CURSOR
/* show cursor */
rtgui_mouse_show_cursor();
@ -327,8 +327,11 @@ static rt_bool_t rtgui_server_event_handler(struct rtgui_object *object,
case RTGUI_EVENT_MONITOR_ADD:
/* handle mouse monitor */
rtgui_server_handle_monitor_add((struct rtgui_event_monitor*)event);
rtgui_server_handle_monitor_add((struct rtgui_event_monitor *)event);
break;
default:
rt_kprintf("RTGUI: wrong event sent to server: %d", event->type);
return RT_FALSE;
}
return RT_TRUE;
@ -337,9 +340,9 @@ static rt_bool_t rtgui_server_event_handler(struct rtgui_object *object,
/**
* rtgui server thread's entry
*/
static void rtgui_server_entry(void* parameter)
static void rtgui_server_entry(void *parameter)
{
#ifdef _WIN32
#ifdef _WIN32_NATIVE
/* set the server thread to highest */
HANDLE hCurrentThread = GetCurrentThread();
SetThreadPriority(hCurrentThread, THREAD_PRIORITY_HIGHEST);
@ -365,7 +368,7 @@ static void rtgui_server_entry(void* parameter)
rtgui_server_application = RT_NULL;
}
void rtgui_server_post_event(struct rtgui_event* event, rt_size_t size)
void rtgui_server_post_event(struct rtgui_event *event, rt_size_t size)
{
if (rtgui_server_tid != RT_NULL)
rtgui_send(rtgui_server_tid, event, size);
@ -373,7 +376,7 @@ void rtgui_server_post_event(struct rtgui_event* event, rt_size_t size)
rt_kprintf("post when server is not running\n");
}
rt_err_t rtgui_server_post_event_sync(struct rtgui_event* event, rt_size_t size)
rt_err_t rtgui_server_post_event_sync(struct rtgui_event *event, rt_size_t size)
{
if (rtgui_server_tid != RT_NULL)
return rtgui_send_sync(rtgui_server_tid, event, size);

View File

@ -47,7 +47,7 @@ static struct rtgui_dlist_node _rtgui_topwin_list;
static struct rt_semaphore _rtgui_topwin_lock;
static void rtgui_topwin_update_clip(void);
static void rtgui_topwin_redraw(struct rtgui_rect* rect);
static void rtgui_topwin_redraw(struct rtgui_rect *rect);
static void _rtgui_topwin_activate_next(enum rtgui_topwin_flag);
void rtgui_topwin_init(void)
@ -59,12 +59,12 @@ void rtgui_topwin_init(void)
"topwin", 1, RT_IPC_FLAG_FIFO);
}
static struct rtgui_topwin* rtgui_topwin_search_in_list(struct rtgui_win* window,
struct rtgui_dlist_node* list)
static struct rtgui_topwin *rtgui_topwin_search_in_list(struct rtgui_win *window,
struct rtgui_dlist_node *list)
{
/* TODO: use a cache to speed up the search. */
struct rtgui_dlist_node* node;
struct rtgui_topwin* topwin;
struct rtgui_dlist_node *node;
struct rtgui_topwin *topwin;
/* the action is tend to operate on the top most window. So we search in a
* depth first order.
@ -88,9 +88,9 @@ static struct rtgui_topwin* rtgui_topwin_search_in_list(struct rtgui_win* window
}
/* add a window to window list[hide] */
rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event)
rt_err_t rtgui_topwin_add(struct rtgui_event_win_create *event)
{
struct rtgui_topwin* topwin;
struct rtgui_topwin *topwin;
topwin = rtgui_malloc(sizeof(struct rtgui_topwin));
if (topwin == RT_NULL)
@ -131,7 +131,7 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event)
if (event->parent.user & RTGUI_WIN_STYLE_ONTOP) topwin->flag |= WINTITLE_ONTOP;
if (event->parent.user & RTGUI_WIN_STYLE_ONBTM) topwin->flag |= WINTITLE_ONBTM;
if(!(topwin->flag & WINTITLE_NO) || (topwin->flag & WINTITLE_BORDER))
if (!(topwin->flag & WINTITLE_NO) || (topwin->flag & WINTITLE_BORDER))
{
/* get win extent */
rtgui_rect_t rect = topwin->extent;
@ -148,7 +148,7 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event)
#ifdef RTGUI_USING_SMALL_SIZE
topwin->title = rtgui_wintitle_create(topwin->wid, event->wid->title);
#else
topwin->title = rtgui_wintitle_create(topwin->wid, (const char*)event->title);
topwin->title = rtgui_wintitle_create(topwin->wid, (const char *)event->title);
#endif
rtgui_widget_set_rect(RTGUI_WIDGET(topwin->title), &rect);
@ -165,7 +165,7 @@ rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event)
return RT_EOK;
}
static struct rtgui_topwin* _rtgui_topwin_get_root_win(struct rtgui_topwin *topwin)
static struct rtgui_topwin *_rtgui_topwin_get_root_win(struct rtgui_topwin *topwin)
{
struct rtgui_topwin *topparent;
@ -177,25 +177,25 @@ static struct rtgui_topwin* _rtgui_topwin_get_root_win(struct rtgui_topwin *topw
return topparent;
}
static struct rtgui_topwin* _rtgui_topwin_get_topmost_child_shown(struct rtgui_topwin *topwin)
static struct rtgui_topwin *_rtgui_topwin_get_topmost_child_shown(struct rtgui_topwin *topwin)
{
RT_ASSERT(topwin != RT_NULL);
while (!(rtgui_dlist_isempty(&topwin->child_list)) &&
get_topwin_from_list(topwin->child_list.next)->flag & WINTITLE_SHOWN)
get_topwin_from_list(topwin->child_list.next)->flag &WINTITLE_SHOWN)
topwin = get_topwin_from_list(topwin->child_list.next);
return topwin;
}
static rt_bool_t _rtgui_topwin_in_layer(struct rtgui_topwin *topwin, enum rtgui_topwin_flag flag)
{
return (topwin->flag & (WINTITLE_ONTOP|WINTITLE_ONBTM))
== (flag & (WINTITLE_ONTOP|WINTITLE_ONBTM));
return (topwin->flag & (WINTITLE_ONTOP | WINTITLE_ONBTM))
== (flag & (WINTITLE_ONTOP | WINTITLE_ONBTM));
}
/* find the topmost window shown in the layer set by flag. The flag has many
* other infomations but we only use the ONTOP/ONBTM */
static struct rtgui_topwin* _rtgui_topwin_get_topmost_window_shown(enum rtgui_topwin_flag flag)
static struct rtgui_topwin *_rtgui_topwin_get_topmost_window_shown(enum rtgui_topwin_flag flag)
{
struct rtgui_dlist_node *node;
@ -251,7 +251,7 @@ static void _rtgui_topwin_union_region_tree(struct rtgui_topwin *topwin,
* As we freed the node in this function, it would be a null reference error of
* the caller iterate the tree normally.
*/
static struct rtgui_dlist_node* _rtgui_topwin_free_tree(struct rtgui_topwin *topwin)
static struct rtgui_dlist_node *_rtgui_topwin_free_tree(struct rtgui_topwin *topwin)
{
struct rtgui_dlist_node *node, *next_node;
@ -267,7 +267,7 @@ static struct rtgui_dlist_node* _rtgui_topwin_free_tree(struct rtgui_topwin *top
/* free the monitor rect list, topwin node and title */
while (topwin->monitor_list.next != RT_NULL)
{
struct rtgui_mouse_monitor* monitor = rtgui_list_entry(topwin->monitor_list.next,
struct rtgui_mouse_monitor *monitor = rtgui_list_entry(topwin->monitor_list.next,
struct rtgui_mouse_monitor, list);
topwin->monitor_list.next = topwin->monitor_list.next->next;
@ -282,7 +282,7 @@ static struct rtgui_dlist_node* _rtgui_topwin_free_tree(struct rtgui_topwin *top
return next_node;
}
rt_err_t rtgui_topwin_remove(struct rtgui_win* wid)
rt_err_t rtgui_topwin_remove(struct rtgui_win *wid)
{
struct rtgui_topwin *topwin, *old_focus;
struct rtgui_region region;
@ -472,7 +472,7 @@ static void _rtgui_topwin_raise_tree_from_root(struct rtgui_topwin *topwin)
* - raise the window to the front of it's siblings
* - activate a win
*/
rt_err_t rtgui_topwin_activate(struct rtgui_event_win_activate* event)
rt_err_t rtgui_topwin_activate(struct rtgui_event_win_activate *event)
{
struct rtgui_topwin *topwin;
@ -505,7 +505,7 @@ static void _rtgui_topwin_draw_tree(struct rtgui_topwin *topwin, struct rtgui_ev
}
}
rt_err_t rtgui_topwin_activate_topwin(struct rtgui_topwin* topwin)
rt_err_t rtgui_topwin_activate_topwin(struct rtgui_topwin *topwin)
{
struct rtgui_topwin *old_focus_topwin;
struct rtgui_event_paint epaint;
@ -557,7 +557,7 @@ rt_err_t rtgui_topwin_activate_topwin(struct rtgui_topwin* topwin)
* Remember that we are in a embedded system so write the @param func memory
* efficiently.
*/
rt_inline void _rtgui_topwin_preorder_map(struct rtgui_topwin *topwin, void (*func)(struct rtgui_topwin*))
rt_inline void _rtgui_topwin_preorder_map(struct rtgui_topwin *topwin, void (*func)(struct rtgui_topwin *))
{
struct rtgui_dlist_node *child;
@ -594,10 +594,10 @@ rt_inline void _rtgui_topwin_mark_shown(struct rtgui_topwin *topwin)
RTGUI_WIDGET_UNHIDE(topwin->wid);
}
rt_err_t rtgui_topwin_show(struct rtgui_event_win* event)
rt_err_t rtgui_topwin_show(struct rtgui_event_win *event)
{
struct rtgui_topwin *topwin;
struct rtgui_win* wid = event->wid;
struct rtgui_win *wid = event->wid;
topwin = rtgui_topwin_search_in_list(wid, &_rtgui_topwin_list);
/* no such a window recorded */
@ -638,7 +638,7 @@ static void _rtgui_topwin_clear_modal_tree(struct rtgui_topwin *topwin)
}
/* hide a window */
rt_err_t rtgui_topwin_hide(struct rtgui_event_win* event)
rt_err_t rtgui_topwin_hide(struct rtgui_event_win *event)
{
struct rtgui_topwin *topwin;
struct rtgui_topwin *old_focus_topwin = rtgui_topwin_get_focus();
@ -691,12 +691,12 @@ rt_err_t rtgui_topwin_hide(struct rtgui_event_win* event)
}
/* move top window */
rt_err_t rtgui_topwin_move(struct rtgui_event_win_move* event)
rt_err_t rtgui_topwin_move(struct rtgui_event_win_move *event)
{
struct rtgui_topwin* topwin;
struct rtgui_topwin *topwin;
int dx, dy;
rtgui_rect_t old_rect; /* the old topwin coverage area */
struct rtgui_list_node* node;
struct rtgui_list_node *node;
/* find in show list */
topwin = rtgui_topwin_search_in_list(event->wid, &_rtgui_topwin_list);
@ -724,7 +724,7 @@ rt_err_t rtgui_topwin_move(struct rtgui_event_win_move* event)
/* move the monitor rect list */
rtgui_list_foreach(node, &(topwin->monitor_list))
{
struct rtgui_mouse_monitor* monitor = rtgui_list_entry(node,
struct rtgui_mouse_monitor *monitor = rtgui_list_entry(node,
struct rtgui_mouse_monitor,
list);
rtgui_rect_moveto(&(monitor->rect), dx, dy);
@ -758,9 +758,9 @@ rt_err_t rtgui_topwin_move(struct rtgui_event_win_move* event)
* resize a top win
* Note: currently, only support resize hidden window
*/
void rtgui_topwin_resize(struct rtgui_win* wid, rtgui_rect_t* rect)
void rtgui_topwin_resize(struct rtgui_win *wid, rtgui_rect_t *rect)
{
struct rtgui_topwin* topwin;
struct rtgui_topwin *topwin;
struct rtgui_region region;
/* find in show list */
@ -801,7 +801,7 @@ void rtgui_topwin_resize(struct rtgui_win* wid, rtgui_rect_t* rect)
rtgui_topwin_redraw(rtgui_region_extents(&region));
}
static struct rtgui_topwin* _rtgui_topwin_get_focus_from_list(struct rtgui_dlist_node *list)
static struct rtgui_topwin *_rtgui_topwin_get_focus_from_list(struct rtgui_dlist_node *list)
{
struct rtgui_dlist_node *node;
@ -821,12 +821,12 @@ static struct rtgui_topwin* _rtgui_topwin_get_focus_from_list(struct rtgui_dlist
return RT_NULL;
}
struct rtgui_topwin* rtgui_topwin_get_focus(void)
struct rtgui_topwin *rtgui_topwin_get_focus(void)
{
return _rtgui_topwin_get_focus_from_list(&_rtgui_topwin_list);
}
static struct rtgui_topwin* _rtgui_topwin_get_wnd_from_tree(struct rtgui_dlist_node *list,
static struct rtgui_topwin *_rtgui_topwin_get_wnd_from_tree(struct rtgui_dlist_node *list,
int x, int y,
rt_bool_t exclude_modaled)
{
@ -863,12 +863,12 @@ static struct rtgui_topwin* _rtgui_topwin_get_wnd_from_tree(struct rtgui_dlist_n
return RT_NULL;
}
struct rtgui_topwin* rtgui_topwin_get_wnd(int x, int y)
struct rtgui_topwin *rtgui_topwin_get_wnd(int x, int y)
{
return _rtgui_topwin_get_wnd_from_tree(&_rtgui_topwin_list, x, y, RT_FALSE);
}
struct rtgui_topwin* rtgui_topwin_get_wnd_no_modaled(int x, int y)
struct rtgui_topwin *rtgui_topwin_get_wnd_no_modaled(int x, int y)
{
return _rtgui_topwin_get_wnd_from_tree(&_rtgui_topwin_list, x, y, RT_TRUE);
}
@ -965,7 +965,7 @@ static void rtgui_topwin_update_clip(void)
}
static void _rtgui_topwin_redraw_tree(struct rtgui_dlist_node *list,
struct rtgui_rect* rect,
struct rtgui_rect *rect,
struct rtgui_event_paint *epaint)
{
struct rtgui_dlist_node *node;
@ -1004,7 +1004,7 @@ static void _rtgui_topwin_redraw_tree(struct rtgui_dlist_node *list,
}
}
static void rtgui_topwin_redraw(struct rtgui_rect* rect)
static void rtgui_topwin_redraw(struct rtgui_rect *rect)
{
struct rtgui_event_paint epaint;
RTGUI_EVENT_PAINT_INIT(&epaint);
@ -1016,7 +1016,7 @@ static void rtgui_topwin_redraw(struct rtgui_rect* rect)
/* a window enter modal mode will modal all the sibling window and parent
* window all along to the root window(which parent is RT_NULL or the desktop
* window if there is). If a root window modals, there is nothing to do here.*/
rt_err_t rtgui_topwin_modal_enter(struct rtgui_event_win_modal_enter* event)
rt_err_t rtgui_topwin_modal_enter(struct rtgui_event_win_modal_enter *event)
{
struct rtgui_topwin *topwin, *parent_top;
struct rtgui_dlist_node *node;
@ -1051,7 +1051,7 @@ rt_err_t rtgui_topwin_modal_enter(struct rtgui_event_win_modal_enter* event)
return RT_EOK;
}
void rtgui_topwin_title_onmouse(struct rtgui_topwin* win, struct rtgui_event_mouse* event)
void rtgui_topwin_title_onmouse(struct rtgui_topwin *win, struct rtgui_event_mouse *event)
{
rtgui_rect_t rect;
@ -1104,9 +1104,9 @@ void rtgui_topwin_title_onmouse(struct rtgui_topwin* win, struct rtgui_event_mou
}
}
void rtgui_topwin_append_monitor_rect(struct rtgui_win* wid, rtgui_rect_t* rect)
void rtgui_topwin_append_monitor_rect(struct rtgui_win *wid, rtgui_rect_t *rect)
{
struct rtgui_topwin* win;
struct rtgui_topwin *win;
/* parameters check */
if (wid == RT_NULL || rect == RT_NULL) return;
@ -1120,9 +1120,9 @@ void rtgui_topwin_append_monitor_rect(struct rtgui_win* wid, rtgui_rect_t* rect)
rtgui_mouse_monitor_append(&(win->monitor_list), rect);
}
void rtgui_topwin_remove_monitor_rect(struct rtgui_win* wid, rtgui_rect_t* rect)
void rtgui_topwin_remove_monitor_rect(struct rtgui_win *wid, rtgui_rect_t *rect)
{
struct rtgui_topwin* win;
struct rtgui_topwin *win;
/* parameters check */
if (wid == RT_NULL || rect == RT_NULL)

View File

@ -21,37 +21,37 @@
#include <rtgui/rtgui_server.h>
/* add or remove a top win */
rt_err_t rtgui_topwin_add(struct rtgui_event_win_create* event);
rt_err_t rtgui_topwin_remove(struct rtgui_win* wid);
rt_err_t rtgui_topwin_activate(struct rtgui_event_win_activate* event);
rt_err_t rtgui_topwin_activate_topwin(struct rtgui_topwin* win);
rt_err_t rtgui_topwin_add(struct rtgui_event_win_create *event);
rt_err_t rtgui_topwin_remove(struct rtgui_win *wid);
rt_err_t rtgui_topwin_activate(struct rtgui_event_win_activate *event);
rt_err_t rtgui_topwin_activate_topwin(struct rtgui_topwin *win);
/* show a window */
rt_err_t rtgui_topwin_show(struct rtgui_event_win* event);
rt_err_t rtgui_topwin_show(struct rtgui_event_win *event);
/* hide a window */
rt_err_t rtgui_topwin_hide(struct rtgui_event_win* event);
rt_err_t rtgui_topwin_hide(struct rtgui_event_win *event);
/* move a window */
rt_err_t rtgui_topwin_move(struct rtgui_event_win_move* event);
rt_err_t rtgui_topwin_move(struct rtgui_event_win_move *event);
/* resize a window */
void rtgui_topwin_resize(struct rtgui_win* wid, rtgui_rect_t* r);
void rtgui_topwin_resize(struct rtgui_win *wid, rtgui_rect_t *r);
/* a window is entering modal mode */
rt_err_t rtgui_topwin_modal_enter(struct rtgui_event_win_modal_enter* event);
rt_err_t rtgui_topwin_modal_enter(struct rtgui_event_win_modal_enter *event);
/* get window at (x, y) */
struct rtgui_topwin* rtgui_topwin_get_wnd(int x, int y);
struct rtgui_topwin* rtgui_topwin_get_wnd_no_modaled(int x, int y);
struct rtgui_topwin *rtgui_topwin_get_wnd(int x, int y);
struct rtgui_topwin *rtgui_topwin_get_wnd_no_modaled(int x, int y);
//void rtgui_topwin_deactivate_win(struct rtgui_topwin* win);
/* window title */
void rtgui_topwin_title_ondraw(struct rtgui_topwin* win);
void rtgui_topwin_title_onmouse(struct rtgui_topwin* win, struct rtgui_event_mouse* event);
void rtgui_topwin_title_ondraw(struct rtgui_topwin *win);
void rtgui_topwin_title_onmouse(struct rtgui_topwin *win, struct rtgui_event_mouse *event);
/* monitor rect */
void rtgui_topwin_append_monitor_rect(struct rtgui_win* wid, rtgui_rect_t* rect);
void rtgui_topwin_remove_monitor_rect(struct rtgui_win* wid, rtgui_rect_t* rect);
void rtgui_topwin_append_monitor_rect(struct rtgui_win *wid, rtgui_rect_t *rect);
void rtgui_topwin_remove_monitor_rect(struct rtgui_win *wid, rtgui_rect_t *rect);
/* get the topwin that is currently focused */
struct rtgui_topwin* rtgui_topwin_get_focus(void);
struct rtgui_topwin *rtgui_topwin_get_focus(void);
#endif

View File

@ -31,11 +31,11 @@ DEFINE_CLASS_TYPE(box, "box",
RT_NULL,
sizeof(struct rtgui_box));
struct rtgui_box* rtgui_box_create(int orientation, int border_size)
struct rtgui_box *rtgui_box_create(int orientation, int border_size)
{
struct rtgui_box* box;
struct rtgui_box *box;
box = (struct rtgui_box*) rtgui_object_create (RTGUI_BOX_TYPE);
box = (struct rtgui_box *) rtgui_object_create(RTGUI_BOX_TYPE);
if (box != RT_NULL)
{
box->orient = orientation;
@ -46,13 +46,13 @@ struct rtgui_box* rtgui_box_create(int orientation, int border_size)
}
RTM_EXPORT(rtgui_box_create);
void rtgui_box_destroy(struct rtgui_box* box)
void rtgui_box_destroy(struct rtgui_box *box)
{
rtgui_object_destroy(RTGUI_OBJECT(box));
}
RTM_EXPORT(rtgui_box_destroy);
static void rtgui_box_layout_vertical(struct rtgui_box* box, struct rtgui_rect* extent)
static void rtgui_box_layout_vertical(struct rtgui_box *box, struct rtgui_rect *extent)
{
rtgui_list_t *node;
rt_int32_t box_width;
@ -71,7 +71,7 @@ static void rtgui_box_layout_vertical(struct rtgui_box* box, struct rtgui_rect*
rtgui_list_foreach(node, &(box->container->children))
{
rtgui_widget_t* widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
rtgui_widget_t *widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
if (widget->align & RTGUI_ALIGN_STRETCH) space_count ++;
else total_height += widget->mini_height;
}
@ -91,7 +91,7 @@ static void rtgui_box_layout_vertical(struct rtgui_box* box, struct rtgui_rect*
rtgui_list_foreach(node, &(box->container->children))
{
struct rtgui_rect *rect;
rtgui_widget_t* widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
rtgui_widget_t *widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
/* get extent of widget */
rect = &(widget->extent);
@ -115,7 +115,7 @@ static void rtgui_box_layout_vertical(struct rtgui_box* box, struct rtgui_rect*
rt_uint32_t mid;
mid = box_width - rtgui_rect_width(*rect);
mid = mid /2;
mid = mid / 2;
rect->x1 = next_x + mid;
rect->x2 = next_x + box_width - mid;
@ -145,7 +145,7 @@ static void rtgui_box_layout_vertical(struct rtgui_box* box, struct rtgui_rect*
}
}
static void rtgui_box_layout_horizontal(struct rtgui_box* box, struct rtgui_rect* extent)
static void rtgui_box_layout_horizontal(struct rtgui_box *box, struct rtgui_rect *extent)
{
rtgui_list_t *node;
rt_int32_t box_height;
@ -164,7 +164,7 @@ static void rtgui_box_layout_horizontal(struct rtgui_box* box, struct rtgui_rect
rtgui_list_foreach(node, &(box->container->children))
{
rtgui_widget_t* widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
rtgui_widget_t *widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
if (widget->align & RTGUI_ALIGN_STRETCH) space_count ++;
else total_width += widget->mini_width;
}
@ -184,7 +184,7 @@ static void rtgui_box_layout_horizontal(struct rtgui_box* box, struct rtgui_rect
rtgui_list_foreach(node, &(box->container->children))
{
rtgui_rect_t *rect;
rtgui_widget_t* widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
rtgui_widget_t *widget = rtgui_list_entry(node, struct rtgui_widget, sibling);
/* get extent of widget */
rect = &(widget->extent);
@ -208,7 +208,7 @@ static void rtgui_box_layout_horizontal(struct rtgui_box* box, struct rtgui_rect
rt_uint32_t mid;
mid = box_height - rtgui_rect_height(*rect);
mid = mid /2;
mid = mid / 2;
rect->y1 = next_y + mid;
rect->y2 = next_y + box_height - mid;
@ -238,7 +238,7 @@ static void rtgui_box_layout_horizontal(struct rtgui_box* box, struct rtgui_rect
}
}
void rtgui_box_layout(rtgui_box_t* box)
void rtgui_box_layout(rtgui_box_t *box)
{
struct rtgui_rect extent;
RT_ASSERT(box != RT_NULL);
@ -263,7 +263,7 @@ void rtgui_box_layout(rtgui_box_t* box)
}
RTM_EXPORT(rtgui_box_layout);
void rtgui_box_layout_rect(rtgui_box_t* box, struct rtgui_rect* rect)
void rtgui_box_layout_rect(rtgui_box_t *box, struct rtgui_rect *rect)
{
RT_ASSERT(box != RT_NULL);

View File

@ -16,7 +16,7 @@
#include <rtgui/widgets/button.h>
#include <rtgui/widgets/window.h>
static rt_bool_t rtgui_button_onunfocus(struct rtgui_object* object, rtgui_event_t* event);
static rt_bool_t rtgui_button_onunfocus(struct rtgui_object *object, rtgui_event_t *event);
static void _rtgui_button_constructor(rtgui_button_t *button)
{
@ -59,7 +59,7 @@ DEFINE_CLASS_TYPE(button, "button",
_rtgui_button_destructor,
sizeof(struct rtgui_button));
rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_event* event)
rt_bool_t rtgui_button_event_handler(struct rtgui_object *object, struct rtgui_event *event)
{
struct rtgui_widget *widget;
struct rtgui_button *btn;
@ -77,7 +77,7 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
case RTGUI_EVENT_KBD:
{
struct rtgui_event_kbd* ekbd = (struct rtgui_event_kbd*) event;
struct rtgui_event_kbd *ekbd = (struct rtgui_event_kbd *) event;
if (RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
if ((ekbd->key == RTGUIK_RETURN) || (ekbd->key == RTGUIK_SPACE))
@ -106,7 +106,7 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
case RTGUI_EVENT_MOUSE_BUTTON:
if (RTGUI_WIDGET_IS_HIDE(widget)) return RT_FALSE;
{
struct rtgui_event_mouse* emouse = (struct rtgui_event_mouse*)event;
struct rtgui_event_mouse *emouse = (struct rtgui_event_mouse *)event;
/* it's not this widget event, clean status */
if (rtgui_rect_contains_point(&(RTGUI_WIDGET(btn)->extent),
@ -155,7 +155,7 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
if (emouse->button & RTGUI_MOUSE_BUTTON_LEFT)
{
/* set the last mouse event handled widget */
struct rtgui_win* win;
struct rtgui_win *win;
win = RTGUI_WIN(RTGUI_WIDGET(btn)->toplevel);
win->last_mevent_widget = RTGUI_WIDGET(btn);
@ -199,11 +199,11 @@ rt_bool_t rtgui_button_event_handler(struct rtgui_object* object, struct rtgui_e
}
RTM_EXPORT(rtgui_button_event_handler);
rtgui_button_t* rtgui_button_create(const char* text)
rtgui_button_t *rtgui_button_create(const char *text)
{
struct rtgui_button* btn;
struct rtgui_button *btn;
btn = (struct rtgui_button*) rtgui_widget_create (RTGUI_BUTTON_TYPE);
btn = (struct rtgui_button *) rtgui_widget_create(RTGUI_BUTTON_TYPE);
if (btn != RT_NULL)
{
rtgui_rect_t rect;
@ -220,9 +220,9 @@ rtgui_button_t* rtgui_button_create(const char* text)
}
RTM_EXPORT(rtgui_button_create);
rtgui_button_t* rtgui_pushbutton_create(const char* text)
rtgui_button_t *rtgui_pushbutton_create(const char *text)
{
rtgui_button_t* btn;
rtgui_button_t *btn;
btn = rtgui_button_create(text);
if (btn != RT_NULL) btn->flag |= RTGUI_BUTTON_TYPE_PUSH;
@ -231,13 +231,13 @@ rtgui_button_t* rtgui_pushbutton_create(const char* text)
}
RTM_EXPORT(rtgui_pushbutton_create);
void rtgui_button_destroy(rtgui_button_t* btn)
void rtgui_button_destroy(rtgui_button_t *btn)
{
rtgui_widget_destroy(RTGUI_WIDGET(btn));
}
RTM_EXPORT(rtgui_button_destroy);
void rtgui_button_set_pressed_image(rtgui_button_t* btn, rtgui_image_t* image)
void rtgui_button_set_pressed_image(rtgui_button_t *btn, rtgui_image_t *image)
{
RT_ASSERT(btn != RT_NULL);
@ -245,7 +245,7 @@ void rtgui_button_set_pressed_image(rtgui_button_t* btn, rtgui_image_t* image)
}
RTM_EXPORT(rtgui_button_set_pressed_image);
void rtgui_button_set_unpressed_image(rtgui_button_t* btn, rtgui_image_t* image)
void rtgui_button_set_unpressed_image(rtgui_button_t *btn, rtgui_image_t *image)
{
RT_ASSERT(btn != RT_NULL);
@ -253,7 +253,7 @@ void rtgui_button_set_unpressed_image(rtgui_button_t* btn, rtgui_image_t* image)
}
RTM_EXPORT(rtgui_button_set_unpressed_image);
void rtgui_button_set_onbutton(rtgui_button_t* btn, rtgui_onbutton_func_t func)
void rtgui_button_set_onbutton(rtgui_button_t *btn, rtgui_onbutton_func_t func)
{
RT_ASSERT(btn != RT_NULL);
@ -261,7 +261,7 @@ void rtgui_button_set_onbutton(rtgui_button_t* btn, rtgui_onbutton_func_t func)
}
RTM_EXPORT(rtgui_button_set_onbutton);
static rt_bool_t rtgui_button_onunfocus(struct rtgui_object* object, rtgui_event_t* event)
static rt_bool_t rtgui_button_onunfocus(struct rtgui_object *object, rtgui_event_t *event)
{
rtgui_rect_t rect;
rtgui_widget_t *widget;
@ -271,11 +271,11 @@ static rt_bool_t rtgui_button_onunfocus(struct rtgui_object* object, rtgui_event
widget = RTGUI_WIDGET(object);
dc = rtgui_dc_begin_drawing(widget);
if(dc == RT_NULL) return RT_FALSE;
if (dc == RT_NULL) return RT_FALSE;
rtgui_widget_get_rect(widget, &rect);
if(!RTGUI_WIDGET_IS_FOCUSED(widget))
if (!RTGUI_WIDGET_IS_FOCUSED(widget))
{
/* only clear focus rect */
rtgui_color_t color;

View File

@ -22,14 +22,14 @@ DEFINE_CLASS_TYPE(checkbox, "checkbox",
RT_NULL,
sizeof(struct rtgui_checkbox));
void rtgui_checkbox_set_onbutton(rtgui_checkbox_t* checkbox, rtgui_onbutton_func_t func)
void rtgui_checkbox_set_onbutton(rtgui_checkbox_t *checkbox, rtgui_onbutton_func_t func)
{
RT_ASSERT(checkbox != RT_NULL);
checkbox->on_button = func;
}
rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object *object, struct rtgui_event *event)
{
struct rtgui_checkbox *box;
@ -54,7 +54,7 @@ rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui
{
if (RTGUI_WIDGET_IS_ENABLE(widget) && !RTGUI_WIDGET_IS_HIDE(widget))
{
struct rtgui_event_mouse* emouse = (struct rtgui_event_mouse*)event;
struct rtgui_event_mouse *emouse = (struct rtgui_event_mouse *)event;
if (emouse->button & RTGUI_MOUSE_BUTTON_LEFT &&
emouse->button & RTGUI_MOUSE_BUTTON_UP)
{
@ -99,11 +99,11 @@ rt_bool_t rtgui_checkbox_event_handler(struct rtgui_object* object, struct rtgui
return RT_FALSE;
}
struct rtgui_checkbox* rtgui_checkbox_create(const char* text, rt_bool_t checked)
struct rtgui_checkbox *rtgui_checkbox_create(const char *text, rt_bool_t checked)
{
struct rtgui_checkbox* box;
struct rtgui_checkbox *box;
box = (struct rtgui_checkbox*) rtgui_widget_create (RTGUI_CHECKBOX_TYPE);
box = (struct rtgui_checkbox *) rtgui_widget_create(RTGUI_CHECKBOX_TYPE);
if (box != RT_NULL)
{
rtgui_rect_t rect;
@ -125,12 +125,12 @@ struct rtgui_checkbox* rtgui_checkbox_create(const char* text, rt_bool_t checked
return box;
}
void rtgui_checkbox_destroy(rtgui_checkbox_t* box)
void rtgui_checkbox_destroy(rtgui_checkbox_t *box)
{
rtgui_widget_destroy(RTGUI_WIDGET(box));
}
void rtgui_checkbox_set_checked(rtgui_checkbox_t* checkbox, rt_bool_t checked)
void rtgui_checkbox_set_checked(rtgui_checkbox_t *checkbox, rt_bool_t checked)
{
RT_ASSERT(checkbox != RT_NULL);
if (checked == RT_TRUE)
@ -140,7 +140,7 @@ void rtgui_checkbox_set_checked(rtgui_checkbox_t* checkbox, rt_bool_t checked)
}
rt_bool_t rtgui_checkbox_get_checked(rtgui_checkbox_t* checkbox)
rt_bool_t rtgui_checkbox_get_checked(rtgui_checkbox_t *checkbox)
{
RT_ASSERT(checkbox != RT_NULL);

View File

@ -2,7 +2,7 @@
#include <rtgui/rtgui_theme.h>
#include <rtgui/widgets/combobox.h>
static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object* object, struct rtgui_event* event);
static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object *object, struct rtgui_event *event);
const static rt_uint8_t down_arrow[] = {0xff, 0x7e, 0x3c, 0x18};
static void _rtgui_combobox_constructor(rtgui_combobox_t *box)
@ -30,12 +30,12 @@ static void _rtgui_combobox_destructor(rtgui_combobox_t *box)
box->pd_win = RT_NULL;
}
rt_bool_t rtgui_combobox_pdwin_onitem(struct rtgui_object* object, struct rtgui_event* event)
rt_bool_t rtgui_combobox_pdwin_onitem(struct rtgui_object *object, struct rtgui_event *event)
{
struct rtgui_widget *widget;
rtgui_win_t* pd_win;
rtgui_combobox_t* combo;
rtgui_listbox_t* list;
rtgui_win_t *pd_win;
rtgui_combobox_t *combo;
rtgui_listbox_t *list;
RT_ASSERT(object != RT_NULL);
@ -54,7 +54,7 @@ rt_bool_t rtgui_combobox_pdwin_onitem(struct rtgui_object* object, struct rtgui_
return RT_FALSE;
}
rt_bool_t rtgui_combobox_pdwin_ondeactive(struct rtgui_object* object, struct rtgui_event* event)
rt_bool_t rtgui_combobox_pdwin_ondeactive(struct rtgui_object *object, struct rtgui_event *event)
{
rtgui_win_hiden(RTGUI_WIN(object));
return RT_TRUE;
@ -66,11 +66,11 @@ DEFINE_CLASS_TYPE(combobox, "combobox",
_rtgui_combobox_destructor,
sizeof(struct rtgui_combobox));
rtgui_combobox_t *rtgui_combobox_create(struct rtgui_listbox_item* items, rt_uint16_t count, struct rtgui_rect* rect)
rtgui_combobox_t *rtgui_combobox_create(struct rtgui_listbox_item *items, rt_uint16_t count, struct rtgui_rect *rect)
{
rtgui_combobox_t *box;
box = (rtgui_combobox_t*)rtgui_widget_create(RTGUI_COMBOBOX_TYPE);
box = (rtgui_combobox_t *)rtgui_widget_create(RTGUI_COMBOBOX_TYPE);
box->items_count = count;
box->items = items;
rtgui_widget_set_rect(RTGUI_WIDGET(box), rect);
@ -80,16 +80,16 @@ rtgui_combobox_t *rtgui_combobox_create(struct rtgui_listbox_item* items, rt_uin
return box;
}
void rtgui_combobox_destroy(rtgui_combobox_t* box)
void rtgui_combobox_destroy(rtgui_combobox_t *box)
{
rtgui_widget_destroy(RTGUI_WIDGET(box));
}
static void rtgui_combobox_ondraw(struct rtgui_combobox* box)
static void rtgui_combobox_ondraw(struct rtgui_combobox *box)
{
/* draw button */
rtgui_color_t bc;
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect, r;
/* begin drawing */
@ -123,7 +123,10 @@ static void rtgui_combobox_ondraw(struct rtgui_combobox* box)
if (box->pd_pressed == RT_TRUE) rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_SUNKEN);
else rtgui_dc_draw_border(dc, &rect, RTGUI_BORDER_RAISE);
r.x1 = 0; r.y1 = 0; r.x2 = 8; r.y2 = 4;
r.x1 = 0;
r.y1 = 0;
r.x2 = 8;
r.y2 = 4;
rtgui_rect_moveto_align(&rect, &r, RTGUI_ALIGN_CENTER_HORIZONTAL | RTGUI_ALIGN_CENTER_VERTICAL);
rtgui_dc_draw_byte(dc, r.x1, r.y1, 4, down_arrow);
@ -132,7 +135,7 @@ static void rtgui_combobox_ondraw(struct rtgui_combobox* box)
return;
}
static rt_bool_t rtgui_combobox_onmouse_button(struct rtgui_combobox* box, struct rtgui_event_mouse* event)
static rt_bool_t rtgui_combobox_onmouse_button(struct rtgui_combobox *box, struct rtgui_event_mouse *event)
{
struct rtgui_rect rect;
@ -164,7 +167,8 @@ static rt_bool_t rtgui_combobox_onmouse_button(struct rtgui_combobox* box, struc
/* create pull down window */
rect = RTGUI_WIDGET(box)->extent;
rect.y1 = rect.y2;
rect.y2 = rect.y1 + 5 * (2 + rtgui_theme_get_selected_height());
/* give it 5 pixels margin, or the last item won't get shown */
rect.y2 = rect.y1 + box->items_count * (2 + rtgui_theme_get_selected_height()) + 5;
box->pd_win = rtgui_win_create(RT_NULL, "combo", &rect, RTGUI_WIN_STYLE_NO_TITLE);
rtgui_win_set_ondeactivate(RTGUI_WIN(box->pd_win), rtgui_combobox_pulldown_hide);
/* set user data to parent combobox */
@ -190,7 +194,7 @@ static rt_bool_t rtgui_combobox_onmouse_button(struct rtgui_combobox* box, struc
return RT_FALSE;
}
rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui_event* event)
rt_bool_t rtgui_combobox_event_handler(struct rtgui_object *object, struct rtgui_event *event)
{
struct rtgui_combobox *box;
RTGUI_WIDGET_EVENT_HANDLER_PREPARE
@ -210,14 +214,14 @@ rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui
break;
case RTGUI_EVENT_MOUSE_BUTTON:
return rtgui_combobox_onmouse_button(box, (struct rtgui_event_mouse*)event);
return rtgui_combobox_onmouse_button(box, (struct rtgui_event_mouse *)event);
case RTGUI_EVENT_FOCUSED:
{
/* item focused */
struct rtgui_event_focused* focused;
struct rtgui_event_focused *focused;
focused = (struct rtgui_event_focused*) event;
focused = (struct rtgui_event_focused *) event;
if (focused->widget != RT_NULL)
{
@ -234,7 +238,7 @@ rt_bool_t rtgui_combobox_event_handler(struct rtgui_object* object, struct rtgui
return RT_FALSE;
}
static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object* object, struct rtgui_event* event)
static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object *object, struct rtgui_event *event)
{
struct rtgui_widget *widget;
struct rtgui_combobox *box;
@ -247,7 +251,7 @@ static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object* object, struc
if (widget == RT_NULL) return RT_TRUE;
box = (struct rtgui_combobox*) (((struct rtgui_win*)widget)->user_data);
box = (struct rtgui_combobox *)(((struct rtgui_win *)widget)->user_data);
if (box == RT_NULL) return RT_TRUE;
/* hide pull down window */
@ -260,7 +264,7 @@ static rt_bool_t rtgui_combobox_pulldown_hide(struct rtgui_object* object, struc
return RT_TRUE;
}
struct rtgui_listbox_item* rtgui_combox_get_select(struct rtgui_combobox* box)
struct rtgui_listbox_item *rtgui_combox_get_select(struct rtgui_combobox *box)
{
if ((box != RT_NULL) && (box->current_item < box->items_count))
{
@ -270,7 +274,7 @@ struct rtgui_listbox_item* rtgui_combox_get_select(struct rtgui_combobox* box)
return RT_NULL;
}
void rtgui_combobox_set_onselected(struct rtgui_combobox* box, rtgui_event_handler_ptr func)
void rtgui_combobox_set_onselected(struct rtgui_combobox *box, rtgui_event_handler_ptr func)
{
box->on_selected = func;
}

View File

@ -45,14 +45,14 @@ DEFINE_CLASS_TYPE(container, "container",
sizeof(struct rtgui_container));
RTM_EXPORT(_rtgui_container);
rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_event_t* event)
rt_bool_t rtgui_container_dispatch_event(rtgui_container_t *container, rtgui_event_t *event)
{
/* handle in child widget */
struct rtgui_list_node* node;
struct rtgui_list_node *node;
rtgui_list_foreach(node, &(container->children))
{
struct rtgui_widget* w;
struct rtgui_widget *w;
w = rtgui_list_entry(node, struct rtgui_widget, sibling);
if (RTGUI_OBJECT(w)->event_handler &&
@ -68,11 +68,11 @@ RTM_EXPORT(rtgui_container_dispatch_event);
* events will always reach every child.*/
rt_bool_t rtgui_container_broadcast_event(struct rtgui_container *container, struct rtgui_event *event)
{
struct rtgui_list_node* node;
struct rtgui_list_node *node;
rtgui_list_foreach(node, &(container->children))
{
struct rtgui_widget* w;
struct rtgui_widget *w;
w = rtgui_list_entry(node, struct rtgui_widget, sibling);
if (RTGUI_OBJECT(w)->event_handler)
@ -83,17 +83,17 @@ rt_bool_t rtgui_container_broadcast_event(struct rtgui_container *container, str
}
RTM_EXPORT(rtgui_container_broadcast_event);
rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, struct rtgui_event_mouse* event)
rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, struct rtgui_event_mouse *event)
{
/* handle in child widget */
struct rtgui_list_node* node;
struct rtgui_list_node *node;
struct rtgui_widget *old_focus;
old_focus = RTGUI_WIDGET(container)->toplevel->focused_widget;
rtgui_list_foreach(node, &(container->children))
{
struct rtgui_widget* w;
struct rtgui_widget *w;
w = rtgui_list_entry(node, struct rtgui_widget, sibling);
if (rtgui_rect_contains_point(&(w->extent),
event->x, event->y) == RT_EOK)
@ -102,7 +102,7 @@ rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, str
rtgui_widget_focus(w);
if (RTGUI_OBJECT(w)->event_handler &&
RTGUI_OBJECT(w)->event_handler(RTGUI_OBJECT(w),
(rtgui_event_t*)event) == RT_TRUE)
(rtgui_event_t *)event) == RT_TRUE)
return RT_TRUE;
}
}
@ -111,7 +111,7 @@ rt_bool_t rtgui_container_dispatch_mouse_event(rtgui_container_t *container, str
}
RTM_EXPORT(rtgui_container_dispatch_mouse_event);
rt_bool_t rtgui_container_event_handler(struct rtgui_object* object, struct rtgui_event* event)
rt_bool_t rtgui_container_event_handler(struct rtgui_object *object, struct rtgui_event *event)
{
struct rtgui_container *container;
struct rtgui_widget *widget;
@ -126,7 +126,7 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object* object, struct rtgu
{
case RTGUI_EVENT_PAINT:
{
struct rtgui_dc* dc;
struct rtgui_dc *dc;
struct rtgui_rect rect;
dc = rtgui_dc_begin_drawing(widget);
@ -151,7 +151,7 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object* object, struct rtgu
case RTGUI_EVENT_MOUSE_MOTION:
/* handle in child widget */
return rtgui_container_dispatch_mouse_event(container,
(struct rtgui_event_mouse*)event);
(struct rtgui_event_mouse *)event);
case RTGUI_EVENT_SHOW:
rtgui_widget_onshow(RTGUI_OBJECT(container), event);
@ -162,7 +162,6 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object* object, struct rtgu
rtgui_container_dispatch_event(container, event);
break;
case RTGUI_EVENT_COMMAND:
case RTGUI_EVENT_RESIZE:
rtgui_container_dispatch_event(container, event);
break;
@ -173,6 +172,11 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object* object, struct rtgu
rtgui_container_broadcast_event(container, event);
break;
case RTGUI_EVENT_RESIZE:
/* re-layout container */
rtgui_container_layout(container);
break;
default:
/* call parent widget event handler */
return rtgui_widget_event_handler(RTGUI_OBJECT(widget), event);
@ -182,17 +186,17 @@ rt_bool_t rtgui_container_event_handler(struct rtgui_object* object, struct rtgu
}
RTM_EXPORT(rtgui_container_event_handler);
rtgui_container_t* rtgui_container_create(void)
rtgui_container_t *rtgui_container_create(void)
{
struct rtgui_container* container;
struct rtgui_container *container;
/* allocate container */
container = (struct rtgui_container*) rtgui_widget_create (RTGUI_CONTAINER_TYPE);
container = (struct rtgui_container *) rtgui_widget_create(RTGUI_CONTAINER_TYPE);
return container;
}
RTM_EXPORT(rtgui_container_create);
void rtgui_container_destroy(rtgui_container_t* container)
void rtgui_container_destroy(rtgui_container_t *container)
{
rtgui_widget_destroy(RTGUI_WIDGET(container));
}
@ -203,7 +207,7 @@ RTM_EXPORT(rtgui_container_destroy);
* Note: this function will not change the widget layout
* the layout is the responsibility of layout widget, such as box.
*/
void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t* child)
void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t *child)
{
RT_ASSERT(container != RT_NULL);
RT_ASSERT(child != RT_NULL);
@ -220,13 +224,13 @@ void rtgui_container_add_child(rtgui_container_t *container, rtgui_widget_t* chi
struct rtgui_event_update_toplvl eup;
RTGUI_EVENT_UPDATE_TOPLVL_INIT(&eup);
eup.toplvl = RTGUI_WIDGET(container)->toplevel;
rtgui_container_broadcast_event(container, (struct rtgui_event*)&eup);
rtgui_container_broadcast_event(container, (struct rtgui_event *)&eup);
}
}
RTM_EXPORT(rtgui_container_add_child);
/* remove a child to widget */
void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t* child)
void rtgui_container_remove_child(rtgui_container_t *container, rtgui_widget_t *child)
{
RT_ASSERT(container != RT_NULL);
RT_ASSERT(child != RT_NULL);
@ -245,7 +249,7 @@ RTM_EXPORT(rtgui_container_remove_child);
/* destroy all children of container */
void rtgui_container_destroy_children(rtgui_container_t *container)
{
struct rtgui_list_node* node;
struct rtgui_list_node *node;
if (container == RT_NULL)
return;
@ -253,7 +257,7 @@ void rtgui_container_destroy_children(rtgui_container_t *container)
node = container->children.next;
while (node != RT_NULL)
{
rtgui_widget_t* child = rtgui_list_entry(node, rtgui_widget_t, sibling);
rtgui_widget_t *child = rtgui_list_entry(node, rtgui_widget_t, sibling);
if (RTGUI_IS_CONTAINER(child))
{
@ -283,9 +287,9 @@ void rtgui_container_destroy_children(rtgui_container_t *container)
}
RTM_EXPORT(rtgui_container_destroy_children);
rtgui_widget_t* rtgui_container_get_first_child(rtgui_container_t* container)
rtgui_widget_t *rtgui_container_get_first_child(rtgui_container_t *container)
{
rtgui_widget_t* child = RT_NULL;
rtgui_widget_t *child = RT_NULL;
RT_ASSERT(container != RT_NULL);
@ -298,7 +302,7 @@ rtgui_widget_t* rtgui_container_get_first_child(rtgui_container_t* container)
}
RTM_EXPORT(rtgui_container_get_first_child);
void rtgui_container_set_box(rtgui_container_t* container, struct rtgui_box* box)
void rtgui_container_set_box(rtgui_container_t *container, struct rtgui_box *box)
{
if (container == RT_NULL || box == RT_NULL)
return;
@ -308,7 +312,7 @@ void rtgui_container_set_box(rtgui_container_t* container, struct rtgui_box* box
}
RTM_EXPORT(rtgui_container_set_box);
void rtgui_container_layout(struct rtgui_container* container)
void rtgui_container_layout(struct rtgui_container *container)
{
if (container == RT_NULL || container->layout_box == RT_NULL)
return;

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More