mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-27 09:32:28 +08:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -13,217 +13,218 @@
|
||||
*/
|
||||
#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 =
|
||||
{
|
||||
asc12_font, /* bmp */
|
||||
RT_NULL, /* each character width, NULL for fixed font */
|
||||
RT_NULL, /* offset for each character */
|
||||
6, /* width */
|
||||
12, /* height */
|
||||
0, /* first char */
|
||||
255 /* last char */
|
||||
asc12_font, /* bmp */
|
||||
RT_NULL, /* each character width, NULL for fixed font */
|
||||
RT_NULL, /* offset for each character */
|
||||
6, /* width */
|
||||
12, /* height */
|
||||
0, /* first char */
|
||||
255 /* last char */
|
||||
};
|
||||
|
||||
struct rtgui_font rtgui_font_asc12 =
|
||||
{
|
||||
"asc", /* family */
|
||||
12, /* height */
|
||||
1, /* refer count */
|
||||
&bmp_font_engine, /* font engine */
|
||||
(struct rtgui_font_bitmap *)&asc12, /* font private data */
|
||||
"asc", /* family */
|
||||
12, /* height */
|
||||
1, /* refer count */
|
||||
&bmp_font_engine, /* font engine */
|
||||
(struct rtgui_font_bitmap *) &asc12, /* font private data */
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -13,18 +13,18 @@
|
||||
*/
|
||||
#include <rtgui/color.h>
|
||||
|
||||
const rtgui_color_t red = RTGUI_RGB(0xff, 0x00, 0x00);
|
||||
const rtgui_color_t green = RTGUI_RGB(0x00, 0xff, 0x00);
|
||||
const rtgui_color_t blue = RTGUI_RGB(0x00, 0x00, 0xff);
|
||||
const rtgui_color_t black = RTGUI_RGB(0x00, 0x00, 0x00);
|
||||
const rtgui_color_t white = RTGUI_RGB(0xff, 0xff, 0xff);
|
||||
const rtgui_color_t red = RTGUI_RGB(0xff, 0x00, 0x00);
|
||||
const rtgui_color_t green = RTGUI_RGB(0x00, 0xff, 0x00);
|
||||
const rtgui_color_t blue = RTGUI_RGB(0x00, 0x00, 0xff);
|
||||
const rtgui_color_t black = RTGUI_RGB(0x00, 0x00, 0x00);
|
||||
const rtgui_color_t white = RTGUI_RGB(0xff, 0xff, 0xff);
|
||||
|
||||
const rtgui_color_t high_light = RTGUI_RGB(0xff, 0xff, 0xff);
|
||||
const rtgui_color_t dark_grey = RTGUI_RGB(0x7f, 0x7f, 0x7f);
|
||||
const rtgui_color_t light_grey = RTGUI_RGB(0xc0, 0xc0, 0xc0);
|
||||
const rtgui_color_t high_light = RTGUI_RGB(0xff, 0xff, 0xff);
|
||||
const rtgui_color_t dark_grey = RTGUI_RGB(0x7f, 0x7f, 0x7f);
|
||||
const rtgui_color_t light_grey = RTGUI_RGB(0xc0, 0xc0, 0xc0);
|
||||
|
||||
#define RTGUI_RGB_R(c) ((c) & 0xff)
|
||||
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
|
||||
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)
|
||||
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
|
||||
#define RTGUI_RGB_R(c) ((c) & 0xff)
|
||||
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
|
||||
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)
|
||||
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
@@ -28,131 +28,131 @@ extern struct rtgui_font rtgui_font_hz12;
|
||||
|
||||
void rtgui_font_system_init()
|
||||
{
|
||||
rtgui_list_init(&(_rtgui_font_list));
|
||||
rtgui_list_init(&(_rtgui_font_list));
|
||||
|
||||
/* set default font to NULL */
|
||||
rtgui_default_font = RT_NULL;
|
||||
/* set default font to NULL */
|
||||
rtgui_default_font = RT_NULL;
|
||||
|
||||
#ifdef RTGUI_USING_FONT16
|
||||
rtgui_font_system_add_font(&rtgui_font_asc16);
|
||||
rtgui_font_system_add_font(&rtgui_font_asc16);
|
||||
#ifdef RTGUI_USING_FONTHZ
|
||||
rtgui_font_system_add_font(&rtgui_font_hz16);
|
||||
rtgui_font_system_add_font(&rtgui_font_hz16);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RTGUI_USING_FONT12
|
||||
rtgui_font_system_add_font(&rtgui_font_asc12);
|
||||
rtgui_font_system_add_font(&rtgui_font_asc12);
|
||||
#ifdef RTGUI_USING_FONTHZ
|
||||
rtgui_font_system_add_font(&rtgui_font_hz12);
|
||||
rtgui_font_system_add_font(&rtgui_font_hz12);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RTGUI_USING_FONT12
|
||||
if (rtgui_default_font == RT_NULL)
|
||||
rtgui_font_set_defaut(&rtgui_font_asc12);
|
||||
if (rtgui_default_font == RT_NULL)
|
||||
rtgui_font_set_defaut(&rtgui_font_asc12);
|
||||
#endif
|
||||
#ifdef RTGUI_USING_FONT16
|
||||
if (rtgui_default_font == RT_NULL)
|
||||
rtgui_font_set_defaut(&rtgui_font_asc16);
|
||||
if (rtgui_default_font == RT_NULL)
|
||||
rtgui_font_set_defaut(&rtgui_font_asc16);
|
||||
#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));
|
||||
rtgui_list_init(&(font->list));
|
||||
rtgui_list_append(&_rtgui_font_list, &(font->list));
|
||||
|
||||
/* init font */
|
||||
if (font->engine->font_init != RT_NULL)
|
||||
font->engine->font_init(font);
|
||||
/* init font */
|
||||
if (font->engine->font_init != RT_NULL)
|
||||
font->engine->font_init(font);
|
||||
|
||||
/* first refer, load it */
|
||||
if (font->engine->font_load != RT_NULL)
|
||||
font->engine->font_load(font);
|
||||
/* first refer, load it */
|
||||
if (font->engine->font_load != RT_NULL)
|
||||
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));
|
||||
rtgui_list_remove(&_rtgui_font_list, &(font->list));
|
||||
}
|
||||
|
||||
struct rtgui_font* rtgui_font_default()
|
||||
struct rtgui_font *rtgui_font_default()
|
||||
{
|
||||
return rtgui_default_font;
|
||||
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;
|
||||
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;
|
||||
/* search 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) &&
|
||||
font->height == height)
|
||||
{
|
||||
font->refer_count ++;
|
||||
return font;
|
||||
}
|
||||
}
|
||||
rtgui_list_foreach(node, &_rtgui_font_list)
|
||||
{
|
||||
font = rtgui_list_entry(node, struct rtgui_font, list);
|
||||
if ((rt_strncmp(font->family, family, RTGUI_NAME_MAX) == 0) &&
|
||||
font->height == height)
|
||||
{
|
||||
font->refer_count ++;
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
void rtgui_font_derefer(struct rtgui_font* font)
|
||||
void rtgui_font_derefer(struct rtgui_font *font)
|
||||
{
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
|
||||
font->refer_count --;
|
||||
font->refer_count --;
|
||||
|
||||
/* no refer, remove font */
|
||||
if (font->refer_count == 0)
|
||||
{
|
||||
rtgui_font_system_remove_font(font);
|
||||
}
|
||||
/* no refer, remove font */
|
||||
if (font->refer_count == 0)
|
||||
{
|
||||
rtgui_font_system_remove_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);
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
|
||||
if (font->engine != RT_NULL &&
|
||||
font->engine->font_draw_text != RT_NULL)
|
||||
{
|
||||
font->engine->font_draw_text(font, dc, text, len, rect);
|
||||
}
|
||||
if (font->engine != RT_NULL &&
|
||||
font->engine->font_draw_text != RT_NULL)
|
||||
{
|
||||
font->engine->font_draw_text(font, dc, text, len, rect);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
rtgui_rect_t rect;
|
||||
|
||||
/* get metrics */
|
||||
rtgui_font_get_metrics(font, text, &rect);
|
||||
/* get metrics */
|
||||
rtgui_font_get_metrics(font, text, &rect);
|
||||
|
||||
return rect.x2 - rect.x1;
|
||||
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);
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
|
||||
if (font->engine != RT_NULL &&
|
||||
font->engine->font_get_metrics != RT_NULL)
|
||||
{
|
||||
font->engine->font_get_metrics(font, text, rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no font engine found, set rect to zero */
|
||||
rt_memset(rect, 0, sizeof(rtgui_rect_t));
|
||||
}
|
||||
if (font->engine != RT_NULL &&
|
||||
font->engine->font_get_metrics != RT_NULL)
|
||||
{
|
||||
font->engine->font_get_metrics(font, text, rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no font engine found, set rect to zero */
|
||||
rt_memset(rect, 0, sizeof(rtgui_rect_t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,168 +16,169 @@
|
||||
|
||||
/* 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,
|
||||
RT_NULL,
|
||||
rtgui_bitmap_font_draw_text,
|
||||
rtgui_bitmap_font_get_metrics
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_bitmap_font_draw_text,
|
||||
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;
|
||||
rt_uint16_t x, y, w, h, style;
|
||||
register rt_base_t i, j, /*k,*/ word_bytes;
|
||||
rtgui_color_t bc;
|
||||
const rt_uint8_t *font_ptr;
|
||||
rt_uint16_t x, y, w, h, style;
|
||||
register rt_base_t i, j, /*k,*/ word_bytes;
|
||||
|
||||
/* check first and last char */
|
||||
if (ch < font->first_char || ch > font->last_char) return;
|
||||
/* check first and last char */
|
||||
if (ch < font->first_char || ch > font->last_char) return;
|
||||
|
||||
/* get text style */
|
||||
style = rtgui_dc_get_gc(dc)->textstyle;
|
||||
bc = rtgui_dc_get_gc(dc)->background;
|
||||
/* get text style */
|
||||
style = rtgui_dc_get_gc(dc)->textstyle;
|
||||
bc = rtgui_dc_get_gc(dc)->background;
|
||||
|
||||
x = rect->x1;
|
||||
y = rect->y1;
|
||||
/* get width */
|
||||
if (font->char_width == RT_NULL)
|
||||
{
|
||||
word_bytes = (((font->width - 1) / 8) + 1);
|
||||
font_ptr = font->bmp + (ch - font->first_char) * word_bytes * font->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
x = rect->x1;
|
||||
y = rect->y1;
|
||||
/* get width */
|
||||
if (font->char_width == RT_NULL)
|
||||
{
|
||||
word_bytes = (((font->width - 1) / 8) + 1);
|
||||
font_ptr = font->bmp + (ch - font->first_char) * word_bytes * font->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
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++)
|
||||
{
|
||||
rt_uint8_t chr;
|
||||
const rt_uint8_t *ptr = font_ptr + i * word_bytes;
|
||||
for(j = 0; j < w; j++)
|
||||
{
|
||||
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);
|
||||
chr <<= 1;
|
||||
}
|
||||
}
|
||||
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++)
|
||||
{
|
||||
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);
|
||||
chr <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
rt_uint32_t length;
|
||||
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);
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
if (rect->y1 > rect->y2) return;
|
||||
if (rect->y1 > rect->y2) return;
|
||||
|
||||
hz_font = rtgui_font_refer("hz", font->height);
|
||||
while ((rect->x1 < rect->x2) && len)
|
||||
{
|
||||
length = 0;
|
||||
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);
|
||||
text += length;
|
||||
len -= length;
|
||||
}
|
||||
hz_font = rtgui_font_refer("hz", font->height);
|
||||
while ((rect->x1 < rect->x2) && len)
|
||||
{
|
||||
length = 0;
|
||||
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);
|
||||
text += length;
|
||||
len -= length;
|
||||
}
|
||||
|
||||
length = 0;
|
||||
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
|
||||
if (length > 0)
|
||||
{
|
||||
len -= length;
|
||||
while (length-- && rect->x1 < rect->x2)
|
||||
{
|
||||
rtgui_bitmap_font_draw_char(bmp_font, dc, *text, rect);
|
||||
length = 0;
|
||||
while (((rt_uint8_t) * (text + length) < 0x80) && *(text + length)) length ++;
|
||||
if (length > 0)
|
||||
{
|
||||
len -= length;
|
||||
while (length-- && rect->x1 < rect->x2)
|
||||
{
|
||||
rtgui_bitmap_font_draw_char(bmp_font, dc, *text, rect);
|
||||
|
||||
/* move x to next character */
|
||||
if (bmp_font->char_width == RT_NULL)
|
||||
rect->x1 += bmp_font->width;
|
||||
else
|
||||
rect->x1 += bmp_font->char_width[*text - bmp_font->first_char];
|
||||
text ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* move x to next character */
|
||||
if (bmp_font->char_width == RT_NULL)
|
||||
rect->x1 += bmp_font->width;
|
||||
else
|
||||
rect->x1 += bmp_font->char_width[*text - bmp_font->first_char];
|
||||
text ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hz_font != RT_NULL) rtgui_font_derefer(hz_font);
|
||||
if (hz_font != RT_NULL) rtgui_font_derefer(hz_font);
|
||||
|
||||
#else
|
||||
if (rect->y1 > rect->y2) return;
|
||||
if (rect->y1 > rect->y2) return;
|
||||
|
||||
while ((rect->x1 < rect->x2) && len)
|
||||
{
|
||||
length = 0;
|
||||
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
|
||||
if (length > 0)
|
||||
{
|
||||
len -= length;
|
||||
while (length-- && rect->x1 < rect->x2)
|
||||
{
|
||||
rtgui_bitmap_font_draw_char(bmp_font, dc, *text, rect);
|
||||
while ((rect->x1 < rect->x2) && len)
|
||||
{
|
||||
length = 0;
|
||||
while (((rt_uint8_t) * (text + length) < 0x80) && *(text + length)) length ++;
|
||||
if (length > 0)
|
||||
{
|
||||
len -= length;
|
||||
while (length-- && rect->x1 < rect->x2)
|
||||
{
|
||||
rtgui_bitmap_font_draw_char(bmp_font, dc, *text, rect);
|
||||
|
||||
/* move x to next character */
|
||||
if (bmp_font->char_width == RT_NULL)
|
||||
rect->x1 += bmp_font->width;
|
||||
else
|
||||
rect->x1 += bmp_font->char_width[*text - bmp_font->first_char];
|
||||
text ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* move x to next character */
|
||||
if (bmp_font->char_width == RT_NULL)
|
||||
rect->x1 += bmp_font->width;
|
||||
else
|
||||
rect->x1 += bmp_font->char_width[*text - bmp_font->first_char];
|
||||
text ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#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);
|
||||
rt_uint32_t length;
|
||||
struct rtgui_font_bitmap *bmp_font = (struct rtgui_font_bitmap *)(font->data);
|
||||
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
/* set init metrics rect */
|
||||
rect->x1 = rect->y1 = 0;rect->x2 = 0;
|
||||
rect->y2 = bmp_font->height;
|
||||
/* set init metrics rect */
|
||||
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;
|
||||
text += length;
|
||||
while (*text)
|
||||
{
|
||||
length = 0;
|
||||
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 ++;
|
||||
if (bmp_font->char_width != NULL)
|
||||
{
|
||||
/* get width for each character */
|
||||
while (*text && ((rt_uint8_t)*text < 0x80))
|
||||
{
|
||||
rect->x2 += bmp_font->char_width[*text - bmp_font->first_char];
|
||||
text ++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* set metrics rect */
|
||||
rect->x2 += bmp_font->width * length;
|
||||
text += length;
|
||||
}
|
||||
}
|
||||
length = 0;
|
||||
while (((rt_uint8_t) * (text + length) < 0x80) && *(text + length)) length ++;
|
||||
if (bmp_font->char_width != NULL)
|
||||
{
|
||||
/* get width for each character */
|
||||
while (*text && ((rt_uint8_t)*text < 0x80))
|
||||
{
|
||||
rect->x2 += bmp_font->char_width[*text - bmp_font->first_char];
|
||||
text ++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* set metrics rect */
|
||||
rect->x2 += bmp_font->width * length;
|
||||
text += length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,233 +5,235 @@
|
||||
#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 =
|
||||
{
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_freetype_font_draw_text,
|
||||
rtgui_freetype_font_get_metrics
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_freetype_font_draw_text,
|
||||
rtgui_freetype_font_get_metrics
|
||||
};
|
||||
|
||||
struct rtgui_freetype_font
|
||||
{
|
||||
int bold;
|
||||
int italic;
|
||||
int bold;
|
||||
int italic;
|
||||
|
||||
FT_Face face;
|
||||
FT_Library library;
|
||||
FT_Face face;
|
||||
FT_Library library;
|
||||
};
|
||||
|
||||
static void gbk_to_unicode(rt_uint16_t *unicode, const unsigned char *text, int len)
|
||||
{
|
||||
int i;
|
||||
unsigned short wch;
|
||||
extern unsigned short ff_convert(unsigned short wch, int direction);
|
||||
int i;
|
||||
unsigned short wch;
|
||||
extern unsigned short ff_convert(unsigned short wch, int direction);
|
||||
|
||||
for (i = 0; i < len; )
|
||||
{
|
||||
if (*text < 0x80)
|
||||
{
|
||||
wch = *text;
|
||||
*unicode = ff_convert(wch, 1);
|
||||
text ++;
|
||||
i ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wch = wch = *(text + 1) | (*text << 8);
|
||||
*unicode = ff_convert(wch, 1);
|
||||
text += 2;
|
||||
i += 2;
|
||||
}
|
||||
for (i = 0; i < len;)
|
||||
{
|
||||
if (*text < 0x80)
|
||||
{
|
||||
wch = *text;
|
||||
*unicode = ff_convert(wch, 1);
|
||||
text ++;
|
||||
i ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wch = wch = *(text + 1) | (*text << 8);
|
||||
*unicode = ff_convert(wch, 1);
|
||||
text += 2;
|
||||
i += 2;
|
||||
}
|
||||
|
||||
unicode ++;
|
||||
}
|
||||
unicode ++;
|
||||
}
|
||||
|
||||
*unicode = '\0';
|
||||
*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;
|
||||
int index = 0;
|
||||
FT_Error err = 0;
|
||||
rt_uint16_t *text_short, *text_ptr;
|
||||
struct rtgui_freetype_font *freetype;
|
||||
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font*) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font *) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
|
||||
/* allocate unicode buffer */
|
||||
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
|
||||
if (text_short == RT_NULL) return ; /* out of memory */
|
||||
/* allocate unicode buffer */
|
||||
text_short = (rt_uint16_t *)rtgui_malloc((len + 1) * 2);
|
||||
if (text_short == RT_NULL) return ; /* out of memory */
|
||||
|
||||
/* convert gbk to unicode */
|
||||
gbk_to_unicode(text_short, text, len);
|
||||
text_ptr = text_short;
|
||||
/* convert gbk to unicode */
|
||||
gbk_to_unicode(text_short, text, len);
|
||||
text_ptr = text_short;
|
||||
|
||||
while (*text_ptr)
|
||||
{
|
||||
index = FT_Get_Char_Index(freetype->face, *text_ptr);
|
||||
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT|FT_LOAD_RENDER);
|
||||
if (err == 0)
|
||||
{
|
||||
int rows, x;
|
||||
rt_uint8_t* ptr;
|
||||
while (*text_ptr)
|
||||
{
|
||||
index = FT_Get_Char_Index(freetype->face, *text_ptr);
|
||||
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT | FT_LOAD_RENDER);
|
||||
if (err == 0)
|
||||
{
|
||||
int rows, x;
|
||||
rt_uint8_t *ptr;
|
||||
|
||||
/* render font */
|
||||
ptr = (rt_uint8_t*)freetype->face->glyph->bitmap.buffer;
|
||||
|
||||
for (rows = 0; rows < freetype->face->glyph->bitmap.rows; rows ++)
|
||||
for (x = 0; x < freetype->face->glyph->bitmap.width; x++)
|
||||
{
|
||||
if (*ptr > 0)
|
||||
rtgui_dc_draw_color_point(dc, rect->x1 + x, rect->y1 + rows, RTGUI_RGB(0xff - *ptr, 0xff - *ptr, 0xff - *ptr));
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
/* render font */
|
||||
ptr = (rt_uint8_t *)freetype->face->glyph->bitmap.buffer;
|
||||
|
||||
text_ptr ++;
|
||||
rect->x1 += freetype->face->glyph->bitmap.width;
|
||||
}
|
||||
for (rows = 0; rows < freetype->face->glyph->bitmap.rows; rows ++)
|
||||
for (x = 0; x < freetype->face->glyph->bitmap.width; x++)
|
||||
{
|
||||
if (*ptr > 0)
|
||||
rtgui_dc_draw_color_point(dc, rect->x1 + x, rect->y1 + rows, RTGUI_RGB(0xff - *ptr, 0xff - *ptr, 0xff - *ptr));
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
/* release unicode buffer */
|
||||
rtgui_free(text_short);
|
||||
text_ptr ++;
|
||||
rect->x1 += freetype->face->glyph->bitmap.width;
|
||||
}
|
||||
|
||||
/* release unicode buffer */
|
||||
rtgui_free(text_short);
|
||||
}
|
||||
|
||||
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
|
||||
static void rtgui_freetype_font_get_metrics(struct rtgui_font *font, const char *text, rtgui_rect_t *rect)
|
||||
{
|
||||
int index = 0, len;
|
||||
FT_Error err = 0;
|
||||
rt_uint16_t w = 0, h = 0;
|
||||
rt_uint16_t *text_short, *text_ptr;
|
||||
struct rtgui_freetype_font* freetype;
|
||||
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
RT_ASSERT(rect != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font*) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
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;
|
||||
|
||||
len = strlen(text);
|
||||
memset(rect, 0, sizeof(struct rtgui_rect));
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
RT_ASSERT(rect != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font *) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
|
||||
/* allocate unicode buffer */
|
||||
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
|
||||
if (text_short == RT_NULL) return ; /* out of memory */
|
||||
len = strlen(text);
|
||||
memset(rect, 0, sizeof(struct rtgui_rect));
|
||||
|
||||
/* convert gbk to unicode */
|
||||
gbk_to_unicode(text_short, text, len);
|
||||
text_ptr = text_short;
|
||||
/* allocate unicode buffer */
|
||||
text_short = (rt_uint16_t *)rtgui_malloc((len + 1) * 2);
|
||||
if (text_short == RT_NULL) return ; /* out of memory */
|
||||
|
||||
while (*text_ptr)
|
||||
{
|
||||
index = FT_Get_Char_Index(freetype->face, *text_ptr);
|
||||
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT);
|
||||
/* convert gbk to unicode */
|
||||
gbk_to_unicode(text_short, text, len);
|
||||
text_ptr = text_short;
|
||||
|
||||
if (err == 0)
|
||||
{
|
||||
w += freetype->face->glyph->bitmap.width;
|
||||
if (freetype->face->glyph->bitmap.rows > h)
|
||||
{
|
||||
h = freetype->face->glyph->bitmap.rows;
|
||||
}
|
||||
}
|
||||
while (*text_ptr)
|
||||
{
|
||||
index = FT_Get_Char_Index(freetype->face, *text_ptr);
|
||||
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT);
|
||||
|
||||
text_ptr ++;
|
||||
}
|
||||
if (err == 0)
|
||||
{
|
||||
w += freetype->face->glyph->bitmap.width;
|
||||
if (freetype->face->glyph->bitmap.rows > h)
|
||||
{
|
||||
h = freetype->face->glyph->bitmap.rows;
|
||||
}
|
||||
}
|
||||
|
||||
rect->x1 = 0; rect->y1 = 0;
|
||||
rect->x2 = w; rect->y2 = h;
|
||||
text_ptr ++;
|
||||
}
|
||||
|
||||
/* release unicode buffer */
|
||||
rtgui_free(text_short);
|
||||
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;
|
||||
FT_Error err = 0;
|
||||
struct rtgui_font *font;
|
||||
|
||||
font = (struct rtgui_font*) rtgui_malloc (sizeof(struct rtgui_font));
|
||||
if (font != RT_NULL)
|
||||
{
|
||||
struct rtgui_freetype_font* freetype;
|
||||
font = (struct rtgui_font *) rtgui_malloc(sizeof(struct rtgui_font));
|
||||
if (font != RT_NULL)
|
||||
{
|
||||
struct rtgui_freetype_font *freetype;
|
||||
|
||||
freetype = (struct rtgui_freetype_font*) rtgui_malloc (sizeof(struct rtgui_freetype_font));
|
||||
if (freetype == RT_NULL)
|
||||
{
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = FT_Init_FreeType(&freetype->library);
|
||||
if((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
|
||||
{
|
||||
FT_Done_FreeType(freetype->library);
|
||||
freetype = (struct rtgui_freetype_font *) rtgui_malloc(sizeof(struct rtgui_freetype_font));
|
||||
if (freetype == RT_NULL)
|
||||
{
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = FT_Init_FreeType(&freetype->library);
|
||||
if ((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
|
||||
{
|
||||
FT_Done_FreeType(freetype->library);
|
||||
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = FT_Select_Charmap(freetype->face, ft_encoding_unicode);
|
||||
if(err)
|
||||
{
|
||||
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1 );
|
||||
}
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = FT_Select_Charmap(freetype->face, ft_encoding_unicode);
|
||||
if (err)
|
||||
{
|
||||
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1);
|
||||
}
|
||||
|
||||
err = FT_Set_Pixel_Sizes(freetype->face, 0, size);
|
||||
if (err != 0)
|
||||
{
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
err = FT_Set_Pixel_Sizes(freetype->face, 0, size);
|
||||
if (err != 0)
|
||||
{
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
|
||||
FT_Done_FreeType(freetype->library);
|
||||
rtgui_free(freetype);
|
||||
FT_Done_FreeType(freetype->library);
|
||||
rtgui_free(freetype);
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
freetype->bold = bold;
|
||||
freetype->italic = italic;
|
||||
freetype->bold = bold;
|
||||
freetype->italic = italic;
|
||||
|
||||
rt_kprintf("fonfile:%s\n", filename);
|
||||
rt_kprintf("font family_name:%s\n", freetype->face->family_name);
|
||||
rt_kprintf("font style_name:%s\n", freetype->face->style_name);
|
||||
rt_kprintf("fonfile:%s\n", filename);
|
||||
rt_kprintf("font family_name:%s\n", freetype->face->family_name);
|
||||
rt_kprintf("font style_name:%s\n", freetype->face->style_name);
|
||||
|
||||
/* set user data */
|
||||
font->data = freetype;
|
||||
font->family = rt_strdup(freetype->face->family_name);
|
||||
font->height = (rt_uint16_t)size;
|
||||
font->refer_count = 0;
|
||||
font->engine = &freetype_font_engine;
|
||||
/* set user data */
|
||||
font->data = freetype;
|
||||
font->family = rt_strdup(freetype->face->family_name);
|
||||
font->height = (rt_uint16_t)size;
|
||||
font->refer_count = 0;
|
||||
font->engine = &freetype_font_engine;
|
||||
|
||||
/* add to system */
|
||||
rtgui_font_system_add_font(font);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* add to system */
|
||||
rtgui_font_system_add_font(font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return font;
|
||||
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;
|
||||
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font*) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
struct rtgui_freetype_font *freetype;
|
||||
|
||||
rtgui_font_system_remove_font(font);
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font *) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
|
||||
FT_Done_Face (freetype->face);
|
||||
FT_Done_FreeType(freetype->library);
|
||||
rtgui_free(freetype);
|
||||
rtgui_free(font);
|
||||
rtgui_font_system_remove_font(font);
|
||||
|
||||
FT_Done_Face(freetype->face);
|
||||
FT_Done_FreeType(freetype->library);
|
||||
rtgui_free(freetype);
|
||||
rtgui_free(font);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4,123 +4,156 @@
|
||||
|
||||
#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,
|
||||
RT_NULL,
|
||||
rtgui_hz_bitmap_font_draw_text,
|
||||
rtgui_hz_bitmap_font_get_metrics
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_hz_bitmap_font_draw_text,
|
||||
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_uint8_t* str;
|
||||
rtgui_color_t bc;
|
||||
rt_uint16_t style;
|
||||
register rt_base_t h, word_bytes, font_bytes;
|
||||
rt_uint16_t cha = *(rt_uint16_t *)str;
|
||||
int idx;
|
||||
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
if (bmp_font->height == 16)
|
||||
idx = rtgui_font_mph16(cha);
|
||||
else // asume the height is 12
|
||||
idx = rtgui_font_mph12(cha);
|
||||
|
||||
/* get text style */
|
||||
style = rtgui_dc_get_gc(dc)->textstyle;
|
||||
bc = rtgui_dc_get_gc(dc)->background;
|
||||
/* don't access beyond the data */
|
||||
if (idx < 0)
|
||||
idx = 0;
|
||||
|
||||
/* drawing height */
|
||||
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;
|
||||
/* 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;
|
||||
|
||||
str = (rt_uint8_t*)text;
|
||||
/* calculate section and index */
|
||||
sect = *str - 0xA0;
|
||||
index = *(str + 1) - 0xA0;
|
||||
|
||||
while (len > 0 && rect->x1 < rect->x2)
|
||||
{
|
||||
const rt_uint8_t* font_ptr;
|
||||
rt_ubase_t sect, index;
|
||||
register rt_base_t i, j, k;
|
||||
/* get font pixel data */
|
||||
return bmp_font->bmp + (94 * (sect - 1) + (index - 1)) * font_bytes;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* calculate section and index */
|
||||
sect = *str - 0xA0;
|
||||
index = *(str+1) - 0xA0;
|
||||
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)
|
||||
{
|
||||
rtgui_color_t bc;
|
||||
rt_uint16_t style;
|
||||
rt_uint8_t *str;
|
||||
register rt_base_t h, word_bytes, font_bytes;
|
||||
|
||||
/* get font pixel data */
|
||||
font_ptr = bmp_font->bmp + (94 * (sect - 1) + (index - 1)) * font_bytes;
|
||||
/* draw word */
|
||||
for (i=0; i < h; i ++)
|
||||
{
|
||||
for (j=0; j < word_bytes; j++)
|
||||
for (k=0; k < 8; k++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (style & RTGUI_TEXTSTYLE_DRAW_BACKGROUND)
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, rect->x1 + 8*j + k, rect->y1 + i, bc);
|
||||
}
|
||||
}
|
||||
}
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
/* move x to next character */
|
||||
rect->x1 += bmp_font->width;
|
||||
str += 2;
|
||||
len -= 2;
|
||||
}
|
||||
/* get text style */
|
||||
style = rtgui_dc_get_gc(dc)->textstyle;
|
||||
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;
|
||||
font_bytes = word_bytes * bmp_font->height;
|
||||
|
||||
str = (rt_uint8_t *)text;
|
||||
|
||||
while (len > 0 && rect->x1 < rect->x2)
|
||||
{
|
||||
const rt_uint8_t *font_ptr;
|
||||
register rt_base_t i, j, k;
|
||||
|
||||
/* get font pixel data */
|
||||
font_ptr = _rtgui_hz_bitmap_get_font_ptr(bmp_font, str, font_bytes);
|
||||
/* draw word */
|
||||
for (i = 0; i < h; i ++)
|
||||
{
|
||||
for (j = 0; j < word_bytes; j++)
|
||||
for (k = 0; k < 8; k++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (style & RTGUI_TEXTSTYLE_DRAW_BACKGROUND)
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, rect->x1 + 8 * j + k, rect->y1 + i, bc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* move x to next character */
|
||||
rect->x1 += bmp_font->width;
|
||||
str += 2;
|
||||
len -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
rt_uint32_t len;
|
||||
struct rtgui_font *efont;
|
||||
struct rtgui_font_bitmap *bmp_font = (struct rtgui_font_bitmap *)(font->data);
|
||||
|
||||
RT_ASSERT(dc != RT_NULL);
|
||||
RT_ASSERT(dc != RT_NULL);
|
||||
|
||||
/* get English font */
|
||||
efont = rtgui_font_refer("asc", bmp_font->height);
|
||||
if (efont == RT_NULL) efont = rtgui_font_default(); /* use system default font */
|
||||
/* get English font */
|
||||
efont = rtgui_font_refer("asc", bmp_font->height);
|
||||
if (efont == RT_NULL) efont = rtgui_font_default(); /* use system default font */
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
len = 0;
|
||||
while (((rt_uint8_t)*(text + len)) < 0x80 && *(text + len) && len < length) len ++;
|
||||
/* draw text with English font */
|
||||
if (len > 0)
|
||||
{
|
||||
rtgui_font_draw(efont, dc, text, len, rect);
|
||||
while (length > 0)
|
||||
{
|
||||
len = 0;
|
||||
while (((rt_uint8_t) * (text + len)) < 0x80 && *(text + len) && len < length) len ++;
|
||||
/* draw text with English font */
|
||||
if (len > 0)
|
||||
{
|
||||
rtgui_font_draw(efont, dc, text, len, rect);
|
||||
|
||||
text += len;
|
||||
length -= len;
|
||||
}
|
||||
text += len;
|
||||
length -= len;
|
||||
}
|
||||
|
||||
len = 0;
|
||||
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);
|
||||
len = 0;
|
||||
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);
|
||||
|
||||
text += len;
|
||||
length -= len;
|
||||
}
|
||||
}
|
||||
text += len;
|
||||
length -= len;
|
||||
}
|
||||
}
|
||||
|
||||
rtgui_font_derefer(efont);
|
||||
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);
|
||||
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->y2 = bmp_font->height;
|
||||
/* 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->y2 = bmp_font->height;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,27 +7,27 @@
|
||||
#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>
|
||||
#include <io.h>
|
||||
#define open _open
|
||||
#define close _close
|
||||
#define read _read
|
||||
#define write _write
|
||||
#define unlink _unlink
|
||||
#define open _open
|
||||
#define close _close
|
||||
#define read _read
|
||||
#define write _write
|
||||
#define unlink _unlink
|
||||
#else
|
||||
#include <dfs_posix.h>
|
||||
#endif
|
||||
|
||||
#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,8 +81,8 @@ 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) !=
|
||||
font->font_data_size)
|
||||
read(font->fd, (char *)(cache + 1), font->font_data_size) !=
|
||||
font->font_data_size)
|
||||
{
|
||||
rtgui_free(cache);
|
||||
return RT_NULL;
|
||||
@@ -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 &&
|
||||
(rect->x1 + 8 * j + k < rect->x2))
|
||||
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
|
||||
|
||||
35
components/rtgui/common/font_mph-tmpl.c
Normal file
35
components/rtgui/common/font_mph-tmpl.c
Normal 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 };
|
||||
|
||||
@@ -1,225 +1,225 @@
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/driver.h>
|
||||
|
||||
#define GET_PIXEL(dst, x, y, type) \
|
||||
(type *)((rt_uint8_t*)((dst)->framebuffer) + (y) * (dst)->pitch + (x) * ((dst)->bits_per_pixel/8))
|
||||
#define GET_PIXEL(dst, x, y, type) \
|
||||
(type *)((rt_uint8_t*)((dst)->framebuffer) + (y) * (dst)->pitch + (x) * ((dst)->bits_per_pixel/8))
|
||||
|
||||
static void _rgb565_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565(*c);
|
||||
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565(*c);
|
||||
}
|
||||
|
||||
static void _rgb565_get_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
|
||||
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
|
||||
|
||||
/* get pixel from color */
|
||||
*c = rtgui_color_from_565(pixel);
|
||||
/* get pixel from color */
|
||||
*c = rtgui_color_from_565(pixel);
|
||||
}
|
||||
|
||||
static void _rgb565_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||
{
|
||||
rt_ubase_t index;
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t *pixel_ptr;
|
||||
rt_ubase_t index;
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t *pixel_ptr;
|
||||
|
||||
/* get pixel from color */
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
/* get pixel from color */
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
|
||||
/* get pixel pointer in framebuffer */
|
||||
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
|
||||
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
*pixel_ptr = pixel;
|
||||
pixel_ptr ++;
|
||||
}
|
||||
/* get pixel pointer in framebuffer */
|
||||
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
|
||||
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
*pixel_ptr = pixel;
|
||||
pixel_ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
static void _rgb565_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
|
||||
{
|
||||
rt_uint8_t *dst;
|
||||
rt_uint16_t pixel;
|
||||
rt_ubase_t index;
|
||||
rt_uint8_t *dst;
|
||||
rt_uint16_t pixel;
|
||||
rt_ubase_t index;
|
||||
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
*(rt_uint16_t*)dst = pixel;
|
||||
dst += rtgui_graphic_get_device()->pitch;
|
||||
}
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
*(rt_uint16_t *)dst = pixel;
|
||||
dst += rtgui_graphic_get_device()->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
static void _rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565p(*c);
|
||||
*GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t) = rtgui_color_to_565p(*c);
|
||||
}
|
||||
|
||||
static void _rgb565p_get_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
|
||||
pixel = *GET_PIXEL(rtgui_graphic_get_device(), x, y, rt_uint16_t);
|
||||
|
||||
/* get pixel from color */
|
||||
*c = rtgui_color_from_565p(pixel);
|
||||
/* get pixel from color */
|
||||
*c = rtgui_color_from_565p(pixel);
|
||||
}
|
||||
|
||||
static void _rgb565p_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||
{
|
||||
rt_ubase_t index;
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t *pixel_ptr;
|
||||
rt_ubase_t index;
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t *pixel_ptr;
|
||||
|
||||
/* get pixel from color */
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
/* get pixel from color */
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
|
||||
/* get pixel pointer in framebuffer */
|
||||
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
|
||||
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
*pixel_ptr = pixel;
|
||||
pixel_ptr ++;
|
||||
}
|
||||
/* get pixel pointer in framebuffer */
|
||||
pixel_ptr = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint16_t);
|
||||
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
*pixel_ptr = pixel;
|
||||
pixel_ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
static void _rgb565p_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
|
||||
{
|
||||
rt_uint8_t *dst;
|
||||
rt_uint16_t pixel;
|
||||
rt_ubase_t index;
|
||||
rt_uint8_t *dst;
|
||||
rt_uint16_t pixel;
|
||||
rt_ubase_t index;
|
||||
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
*(rt_uint16_t*)dst = pixel;
|
||||
dst += rtgui_graphic_get_device()->pitch;
|
||||
}
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
dst = GET_PIXEL(rtgui_graphic_get_device(), x, y1, rt_uint8_t);
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
*(rt_uint16_t *)dst = pixel;
|
||||
dst += rtgui_graphic_get_device()->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw raw hline */
|
||||
static void framebuffer_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
|
||||
{
|
||||
rt_uint8_t *dst;
|
||||
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));
|
||||
dst = GET_PIXEL(rtgui_graphic_get_device(), x1, y, rt_uint8_t);
|
||||
rt_memcpy(dst, pixels, (x2 - x1) * (rtgui_graphic_get_device()->bits_per_pixel / 8));
|
||||
}
|
||||
|
||||
const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops =
|
||||
const struct rtgui_graphic_driver_ops _framebuffer_rgb565_ops =
|
||||
{
|
||||
_rgb565_set_pixel,
|
||||
_rgb565_get_pixel,
|
||||
_rgb565_draw_hline,
|
||||
_rgb565_draw_vline,
|
||||
framebuffer_draw_raw_hline,
|
||||
_rgb565_set_pixel,
|
||||
_rgb565_get_pixel,
|
||||
_rgb565_draw_hline,
|
||||
_rgb565_draw_vline,
|
||||
framebuffer_draw_raw_hline,
|
||||
};
|
||||
|
||||
const struct rtgui_graphic_driver_ops _framebuffer_rgb565p_ops =
|
||||
const struct rtgui_graphic_driver_ops _framebuffer_rgb565p_ops =
|
||||
{
|
||||
_rgb565p_set_pixel,
|
||||
_rgb565p_get_pixel,
|
||||
_rgb565p_draw_hline,
|
||||
_rgb565p_draw_vline,
|
||||
framebuffer_draw_raw_hline,
|
||||
_rgb565p_set_pixel,
|
||||
_rgb565p_get_pixel,
|
||||
_rgb565p_draw_hline,
|
||||
_rgb565p_draw_vline,
|
||||
framebuffer_draw_raw_hline,
|
||||
};
|
||||
|
||||
#define FRAMEBUFFER (rtgui_graphic_get_device()->framebuffer)
|
||||
#define FRAMEBUFFER (rtgui_graphic_get_device()->framebuffer)
|
||||
#define MONO_PIXEL(framebuffer, x, y) \
|
||||
((rt_uint8_t**)(framebuffer))[y/8][x]
|
||||
((rt_uint8_t**)(framebuffer))[y/8][x]
|
||||
|
||||
static void _mono_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
if (*c == white)
|
||||
MONO_PIXEL(FRAMEBUFFER, x, y) &= ~(1 << (y%8));
|
||||
else
|
||||
MONO_PIXEL(FRAMEBUFFER, x, y) |= (1 << (y%8));
|
||||
if (*c == white)
|
||||
MONO_PIXEL(FRAMEBUFFER, x, y) &= ~(1 << (y % 8));
|
||||
else
|
||||
MONO_PIXEL(FRAMEBUFFER, x, y) |= (1 << (y % 8));
|
||||
}
|
||||
|
||||
static void _mono_get_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
if (MONO_PIXEL(FRAMEBUFFER, x, y) & (1 << (y%8)))
|
||||
*c = black;
|
||||
else
|
||||
*c = white;
|
||||
if (MONO_PIXEL(FRAMEBUFFER, x, y) & (1 << (y % 8)))
|
||||
*c = black;
|
||||
else
|
||||
*c = white;
|
||||
}
|
||||
|
||||
static void _mono_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||
{
|
||||
rt_ubase_t index;
|
||||
|
||||
if (*c == white)
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
|
||||
}
|
||||
else
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
|
||||
}
|
||||
rt_ubase_t index;
|
||||
|
||||
if (*c == white)
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y % 8));
|
||||
}
|
||||
else
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y % 8));
|
||||
}
|
||||
}
|
||||
|
||||
static void _mono_draw_vline(rtgui_color_t *c, int x , int y1, int y2)
|
||||
{
|
||||
rt_ubase_t index;
|
||||
|
||||
if (*c == white)
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, x, index) &= ~(1 << (index%8));
|
||||
}
|
||||
else
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, x, index) |= (1 << (index%8));
|
||||
}
|
||||
rt_ubase_t index;
|
||||
|
||||
if (*c == white)
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, x, index) &= ~(1 << (index % 8));
|
||||
}
|
||||
else
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
MONO_PIXEL(FRAMEBUFFER, x, index) |= (1 << (index % 8));
|
||||
}
|
||||
}
|
||||
|
||||
/* draw raw hline */
|
||||
static void _mono_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
|
||||
{
|
||||
rt_ubase_t index;
|
||||
rt_ubase_t index;
|
||||
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
if (pixels[index/8] && (1 << (index % 8)))
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y%8));
|
||||
else
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y%8));
|
||||
}
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
if (pixels[index / 8] && (1 << (index % 8)))
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) |= (1 << (y % 8));
|
||||
else
|
||||
MONO_PIXEL(FRAMEBUFFER, index, y) &= ~(1 << (y % 8));
|
||||
}
|
||||
}
|
||||
|
||||
const struct rtgui_graphic_driver_ops _framebuffer_mono_ops =
|
||||
const struct rtgui_graphic_driver_ops _framebuffer_mono_ops =
|
||||
{
|
||||
_mono_set_pixel,
|
||||
_mono_get_pixel,
|
||||
_mono_draw_hline,
|
||||
_mono_draw_vline,
|
||||
_mono_draw_raw_hline,
|
||||
_mono_set_pixel,
|
||||
_mono_get_pixel,
|
||||
_mono_draw_hline,
|
||||
_mono_draw_vline,
|
||||
_mono_draw_raw_hline,
|
||||
};
|
||||
|
||||
const struct rtgui_graphic_driver_ops *rtgui_framebuffer_get_ops(int pixel_format)
|
||||
{
|
||||
switch (pixel_format)
|
||||
{
|
||||
case RTGRAPHIC_PIXEL_FORMAT_MONO:
|
||||
return &_framebuffer_mono_ops;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_GRAY4:
|
||||
break;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_GRAY16:
|
||||
break;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
|
||||
return &_framebuffer_rgb565_ops;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
|
||||
return &_framebuffer_rgb565p_ops;
|
||||
}
|
||||
switch (pixel_format)
|
||||
{
|
||||
case RTGRAPHIC_PIXEL_FORMAT_MONO:
|
||||
return &_framebuffer_mono_ops;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_GRAY4:
|
||||
break;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_GRAY16:
|
||||
break;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
|
||||
return &_framebuffer_rgb565_ops;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
|
||||
return &_framebuffer_rgb565p_ops;
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,158 +8,163 @@
|
||||
|
||||
struct rtgui_image_hdc
|
||||
{
|
||||
rt_bool_t is_loaded;
|
||||
rt_bool_t is_loaded;
|
||||
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
rt_uint16_t pitch;
|
||||
|
||||
rt_size_t pixel_offset;
|
||||
rt_uint8_t *pixels;
|
||||
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 =
|
||||
{
|
||||
"hdc",
|
||||
{ RT_NULL },
|
||||
rtgui_image_hdc_check,
|
||||
rtgui_image_hdc_load,
|
||||
rtgui_image_hdc_unload,
|
||||
rtgui_image_hdc_blit,
|
||||
RT_NULL,
|
||||
RT_NULL
|
||||
"hdc",
|
||||
{ RT_NULL },
|
||||
rtgui_image_hdc_check,
|
||||
rtgui_image_hdc_load,
|
||||
rtgui_image_hdc_unload,
|
||||
rtgui_image_hdc_blit,
|
||||
RT_NULL,
|
||||
RT_NULL
|
||||
};
|
||||
|
||||
const struct rtgui_image_engine rtgui_image_hdcmm_engine =
|
||||
{
|
||||
"hdcmm",
|
||||
{RT_NULL},
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_image_hdcmm_blit,
|
||||
RT_NULL,
|
||||
RT_NULL
|
||||
"hdcmm",
|
||||
{RT_NULL},
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_image_hdcmm_blit,
|
||||
RT_NULL,
|
||||
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];
|
||||
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);
|
||||
start = rtgui_filerw_tell(file);
|
||||
|
||||
/* move to the beginning of file */
|
||||
rtgui_filerw_seek(file, 0, RTGUI_FILE_SEEK_SET);
|
||||
/* move to the beginning of 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 ( magic[0] == 'H' &&
|
||||
magic[1] == 'D' &&
|
||||
magic[2] == 'C' &&
|
||||
magic[3] == '\0' )
|
||||
{
|
||||
is_HDC = RT_TRUE;
|
||||
}
|
||||
}
|
||||
rtgui_filerw_seek(file, start, RTGUI_FILE_SEEK_SET);
|
||||
is_HDC = RT_FALSE;
|
||||
if (rtgui_filerw_read(file, magic, 1, sizeof(magic)) == sizeof(magic))
|
||||
{
|
||||
if (magic[0] == 'H' &&
|
||||
magic[1] == 'D' &&
|
||||
magic[2] == 'C' &&
|
||||
magic[3] == '\0')
|
||||
{
|
||||
is_HDC = RT_TRUE;
|
||||
}
|
||||
}
|
||||
rtgui_filerw_seek(file, start, RTGUI_FILE_SEEK_SET);
|
||||
|
||||
return(is_HDC);
|
||||
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; }
|
||||
hdc->hw_driver = rtgui_graphic_driver_get_default();
|
||||
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->engine = &rtgui_image_hdc_engine;
|
||||
image->data = hdc;
|
||||
hdc->filerw = file;
|
||||
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);
|
||||
/* set image information */
|
||||
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->pitch = image->w * hdc->byte_per_pixel;
|
||||
hdc->pixel_offset = rtgui_filerw_tell(file);
|
||||
|
||||
if (load == RT_TRUE)
|
||||
{
|
||||
/* load all pixels */
|
||||
hdc->pixels = rtgui_malloc(image->h * hdc->pitch);
|
||||
if (hdc->pixels == RT_NULL)
|
||||
{
|
||||
if (load == RT_TRUE)
|
||||
{
|
||||
/* load all pixels */
|
||||
hdc->pixels = rtgui_malloc(image->h * hdc->pitch);
|
||||
if (hdc->pixels == RT_NULL)
|
||||
{
|
||||
/* release data */
|
||||
rtgui_free(hdc);
|
||||
return RT_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
rtgui_filerw_read(hdc->filerw, hdc->pixels, 1, image->h * hdc->pitch);
|
||||
rtgui_filerw_close(hdc->filerw);
|
||||
hdc->filerw = RT_NULL;
|
||||
hdc->pixel_offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
hdc->pixels = RT_NULL;
|
||||
}
|
||||
rtgui_filerw_read(hdc->filerw, hdc->pixels, 1, image->h * hdc->pitch);
|
||||
rtgui_filerw_close(hdc->filerw);
|
||||
hdc->filerw = RT_NULL;
|
||||
hdc->pixel_offset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
hdc->pixels = RT_NULL;
|
||||
}
|
||||
|
||||
return RT_TRUE;
|
||||
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;
|
||||
if (image != RT_NULL)
|
||||
{
|
||||
hdc = (struct rtgui_image_hdc *) image->data;
|
||||
|
||||
if (hdc->pixels != RT_NULL) rtgui_free(hdc->pixels);
|
||||
if (hdc->filerw != RT_NULL)
|
||||
{
|
||||
rtgui_filerw_close(hdc->filerw);
|
||||
hdc->filerw = RT_NULL;
|
||||
}
|
||||
if (hdc->pixels != RT_NULL) rtgui_free(hdc->pixels);
|
||||
if (hdc->filerw != RT_NULL)
|
||||
{
|
||||
rtgui_filerw_close(hdc->filerw);
|
||||
hdc->filerw = RT_NULL;
|
||||
}
|
||||
|
||||
/* release data */
|
||||
rtgui_free(hdc);
|
||||
}
|
||||
/* release data */
|
||||
rtgui_free(hdc);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
rt_uint16_t y, w, h;
|
||||
struct rtgui_image_hdc *hdc;
|
||||
|
||||
RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);
|
||||
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;
|
||||
/* this dc is not visible */
|
||||
if (rtgui_dc_get_visible(dc) != RT_TRUE) return;
|
||||
|
||||
hdc = (struct rtgui_image_hdc*) image->data;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
hdc = (struct rtgui_image_hdc *) image->data;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* the minimum rect */
|
||||
/* the minimum rect */
|
||||
if (image->w < rtgui_rect_width(*dst_rect)) w = image->w;
|
||||
else w = rtgui_rect_width(*dst_rect);
|
||||
if (image->h < rtgui_rect_height(*dst_rect)) h = image->h;
|
||||
@@ -167,72 +172,72 @@ 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;
|
||||
/* get pixel pointer */
|
||||
ptr = hdc->pixels;
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_uint8_t* ptr;
|
||||
ptr = rtgui_malloc(hdc->pitch);
|
||||
if (ptr == RT_NULL) return; /* no memory */
|
||||
rt_uint8_t *ptr;
|
||||
ptr = rtgui_malloc(hdc->pitch);
|
||||
if (ptr == RT_NULL) return; /* no memory */
|
||||
|
||||
/* seek to the begin of pixel data */
|
||||
rtgui_filerw_seek(hdc->filerw, hdc->pixel_offset, RTGUI_FILE_SEEK_SET);
|
||||
/* seek to the begin of pixel data */
|
||||
rtgui_filerw_seek(hdc->filerw, hdc->pixel_offset, RTGUI_FILE_SEEK_SET);
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
/* read pixel data */
|
||||
if (rtgui_filerw_read(hdc->filerw, ptr, 1, hdc->pitch) != hdc->pitch)
|
||||
break; /* read data failed */
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
/* read pixel data */
|
||||
if (rtgui_filerw_read(hdc->filerw, ptr, 1, hdc->pitch) != hdc->pitch)
|
||||
break; /* read data failed */
|
||||
|
||||
dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
|
||||
}
|
||||
dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
|
||||
}
|
||||
|
||||
rtgui_free(ptr);
|
||||
rtgui_free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
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_uint16_t y, w, h;
|
||||
struct rtgui_image_hdcmm* hdc;
|
||||
rt_uint8_t *ptr;
|
||||
rt_uint16_t y, w, h;
|
||||
struct rtgui_image_hdcmm *hdc;
|
||||
|
||||
RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);
|
||||
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;
|
||||
/* this dc is not visible */
|
||||
if (rtgui_dc_get_visible(dc) != RT_TRUE) return;
|
||||
|
||||
hdc = (struct rtgui_image_hdcmm*) image;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
hdc = (struct rtgui_image_hdcmm *) image;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* the minimum rect */
|
||||
/* the minimum rect */
|
||||
if (image->w < rtgui_rect_width(*dst_rect)) w = image->w;
|
||||
else w = rtgui_rect_width(*dst_rect);
|
||||
if (image->h < rtgui_rect_height(*dst_rect)) h = image->h;
|
||||
else h = rtgui_rect_height(*dst_rect);
|
||||
|
||||
|
||||
/* get pixel pointer */
|
||||
ptr = hdc->pixels;
|
||||
/* get pixel pointer */
|
||||
ptr = hdc->pixels;
|
||||
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
for (y = 0; y < h; y ++)
|
||||
{
|
||||
dc->engine->blit_line(dc, dst_rect->x1, dst_rect->x1 + w, dst_rect->y1 + y, ptr);
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_image_hdc_init()
|
||||
{
|
||||
/* register hdc on image system */
|
||||
rtgui_image_register_engine(&rtgui_image_hdc_engine);
|
||||
/* register hdc on image system */
|
||||
rtgui_image_register_engine(&rtgui_image_hdc_engine);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,198 +6,198 @@
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/driver.h>
|
||||
|
||||
#define gfx_device (rtgui_graphic_get_device()->device)
|
||||
#define gfx_device_ops rt_graphix_ops(gfx_device)
|
||||
#define gfx_device (rtgui_graphic_get_device()->device)
|
||||
#define gfx_device_ops rt_graphix_ops(gfx_device)
|
||||
|
||||
static void _pixel_mono_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint8_t pixel;
|
||||
rt_uint8_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_mono(*c);
|
||||
gfx_device_ops->set_pixel((char*)&pixel, x, y);
|
||||
pixel = rtgui_color_to_mono(*c);
|
||||
gfx_device_ops->set_pixel((char *)&pixel, x, y);
|
||||
}
|
||||
|
||||
static void _pixel_rgb565p_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
gfx_device_ops->set_pixel((char*)&pixel, x, y);
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
gfx_device_ops->set_pixel((char *)&pixel, x, y);
|
||||
}
|
||||
|
||||
static void _pixel_rgb565_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
gfx_device_ops->set_pixel((char*)&pixel, x, y);
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
gfx_device_ops->set_pixel((char *)&pixel, x, y);
|
||||
}
|
||||
|
||||
static void _pixel_rgb888_set_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint32_t pixel;
|
||||
rt_uint32_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_888(*c);
|
||||
gfx_device_ops->set_pixel((char*)&pixel, x, y);
|
||||
pixel = rtgui_color_to_888(*c);
|
||||
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;
|
||||
rt_uint8_t pixel;
|
||||
|
||||
gfx_device_ops->get_pixel((char*)&pixel, x, y);
|
||||
*c = rtgui_color_from_mono(pixel);
|
||||
gfx_device_ops->get_pixel((char *)&pixel, x, y);
|
||||
*c = rtgui_color_from_mono(pixel);
|
||||
}
|
||||
|
||||
static void _pixel_rgb565p_get_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
gfx_device_ops->get_pixel((char*)&pixel, x, y);
|
||||
*c = rtgui_color_from_565p(pixel);
|
||||
gfx_device_ops->get_pixel((char *)&pixel, x, y);
|
||||
*c = rtgui_color_from_565p(pixel);
|
||||
}
|
||||
|
||||
static void _pixel_rgb565_get_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
gfx_device_ops->get_pixel((char*)&pixel, x, y);
|
||||
*c = rtgui_color_from_565(pixel);
|
||||
gfx_device_ops->get_pixel((char *)&pixel, x, y);
|
||||
*c = rtgui_color_from_565(pixel);
|
||||
}
|
||||
|
||||
static void _pixel_rgb888_get_pixel(rtgui_color_t *c, int x, int y)
|
||||
{
|
||||
rt_uint32_t pixel;
|
||||
rt_uint32_t pixel;
|
||||
|
||||
gfx_device_ops->get_pixel((char*)&pixel, x, y);
|
||||
*c = rtgui_color_from_888(pixel);
|
||||
gfx_device_ops->get_pixel((char *)&pixel, x, y);
|
||||
*c = rtgui_color_from_888(pixel);
|
||||
}
|
||||
|
||||
static void _pixel_mono_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||
{
|
||||
rt_uint8_t pixel;
|
||||
rt_uint8_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_mono(*c);
|
||||
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
|
||||
pixel = rtgui_color_to_mono(*c);
|
||||
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)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
gfx_device_ops->draw_hline((char *)&pixel, x1, x2, y);
|
||||
}
|
||||
|
||||
static void _pixel_rgb565_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
gfx_device_ops->draw_hline((char *)&pixel, x1, x2, y);
|
||||
}
|
||||
|
||||
static void _pixel_rgb888_draw_hline(rtgui_color_t *c, int x1, int x2, int y)
|
||||
{
|
||||
rt_uint32_t pixel;
|
||||
rt_uint32_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_888(*c);
|
||||
gfx_device_ops->draw_hline((char*)&pixel, x1, x2, y);
|
||||
pixel = rtgui_color_to_888(*c);
|
||||
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)
|
||||
{
|
||||
rt_uint8_t pixel;
|
||||
rt_uint8_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_mono(*c);
|
||||
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
|
||||
pixel = rtgui_color_to_mono(*c);
|
||||
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)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
|
||||
pixel = rtgui_color_to_565p(*c);
|
||||
gfx_device_ops->draw_vline((char *)&pixel, x, y1, y2);
|
||||
}
|
||||
|
||||
static void _pixel_rgb565_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
|
||||
pixel = rtgui_color_to_565(*c);
|
||||
gfx_device_ops->draw_vline((char *)&pixel, x, y1, y2);
|
||||
}
|
||||
|
||||
static void _pixel_rgb888_draw_vline(rtgui_color_t *c, int x, int y1, int y2)
|
||||
{
|
||||
rt_uint32_t pixel;
|
||||
rt_uint32_t pixel;
|
||||
|
||||
pixel = rtgui_color_to_888(*c);
|
||||
gfx_device_ops->draw_vline((char*)&pixel, x, y1, y2);
|
||||
pixel = rtgui_color_to_888(*c);
|
||||
gfx_device_ops->draw_vline((char *)&pixel, x, y1, y2);
|
||||
}
|
||||
|
||||
static void _pixel_draw_raw_hline(rt_uint8_t *pixels, int x1, int x2, int y)
|
||||
{
|
||||
if (x2 > x1)
|
||||
gfx_device_ops->blit_line((char*)pixels, x1, y, (x2 - x1));
|
||||
else
|
||||
gfx_device_ops->blit_line((char*)pixels, x2, y, (x1 - x2));
|
||||
if (x2 > x1)
|
||||
gfx_device_ops->blit_line((char *)pixels, x1, y, (x2 - x1));
|
||||
else
|
||||
gfx_device_ops->blit_line((char *)pixels, x2, y, (x1 - x2));
|
||||
}
|
||||
|
||||
/* pixel device */
|
||||
const struct rtgui_graphic_driver_ops _pixel_mono_ops =
|
||||
{
|
||||
_pixel_mono_set_pixel,
|
||||
_pixel_mono_get_pixel,
|
||||
_pixel_mono_draw_hline,
|
||||
_pixel_mono_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
_pixel_mono_set_pixel,
|
||||
_pixel_mono_get_pixel,
|
||||
_pixel_mono_draw_hline,
|
||||
_pixel_mono_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
};
|
||||
|
||||
const struct rtgui_graphic_driver_ops _pixel_rgb565p_ops =
|
||||
const struct rtgui_graphic_driver_ops _pixel_rgb565p_ops =
|
||||
{
|
||||
_pixel_rgb565p_set_pixel,
|
||||
_pixel_rgb565p_get_pixel,
|
||||
_pixel_rgb565p_draw_hline,
|
||||
_pixel_rgb565p_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
_pixel_rgb565p_set_pixel,
|
||||
_pixel_rgb565p_get_pixel,
|
||||
_pixel_rgb565p_draw_hline,
|
||||
_pixel_rgb565p_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
};
|
||||
|
||||
const struct rtgui_graphic_driver_ops _pixel_rgb565_ops =
|
||||
const struct rtgui_graphic_driver_ops _pixel_rgb565_ops =
|
||||
{
|
||||
_pixel_rgb565_set_pixel,
|
||||
_pixel_rgb565_get_pixel,
|
||||
_pixel_rgb565_draw_hline,
|
||||
_pixel_rgb565_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
_pixel_rgb565_set_pixel,
|
||||
_pixel_rgb565_get_pixel,
|
||||
_pixel_rgb565_draw_hline,
|
||||
_pixel_rgb565_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
};
|
||||
|
||||
const struct rtgui_graphic_driver_ops _pixel_rgb888_ops =
|
||||
const struct rtgui_graphic_driver_ops _pixel_rgb888_ops =
|
||||
{
|
||||
_pixel_rgb888_set_pixel,
|
||||
_pixel_rgb888_get_pixel,
|
||||
_pixel_rgb888_draw_hline,
|
||||
_pixel_rgb888_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
_pixel_rgb888_set_pixel,
|
||||
_pixel_rgb888_get_pixel,
|
||||
_pixel_rgb888_draw_hline,
|
||||
_pixel_rgb888_draw_vline,
|
||||
_pixel_draw_raw_hline,
|
||||
};
|
||||
|
||||
const struct rtgui_graphic_driver_ops *rtgui_pixel_device_get_ops(int pixel_format)
|
||||
{
|
||||
switch (pixel_format)
|
||||
{
|
||||
switch (pixel_format)
|
||||
{
|
||||
case RTGRAPHIC_PIXEL_FORMAT_MONO:
|
||||
return &_pixel_mono_ops;
|
||||
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
|
||||
return &_pixel_rgb565_ops;
|
||||
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
|
||||
return &_pixel_rgb565p_ops;
|
||||
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB888:
|
||||
return &_pixel_rgb888_ops;
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565:
|
||||
return &_pixel_rgb565_ops;
|
||||
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB565P:
|
||||
return &_pixel_rgb565p_ops;
|
||||
|
||||
case RTGRAPHIC_PIXEL_FORMAT_RGB888:
|
||||
return &_pixel_rgb888_ops;
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
454
components/rtgui/common/rtgui_mv_model.c
Normal file
454
components/rtgui/common/rtgui_mv_model.c
Normal 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);
|
||||
|
||||
@@ -17,185 +17,191 @@
|
||||
|
||||
static void _rtgui_object_constructor(rtgui_object_t *object)
|
||||
{
|
||||
if (!object)
|
||||
return;
|
||||
if (!object)
|
||||
return;
|
||||
|
||||
object->flag = RTGUI_OBJECT_FLAG_NONE;
|
||||
object->flag = RTGUI_OBJECT_FLAG_NONE;
|
||||
}
|
||||
|
||||
/* Destroys the object */
|
||||
static void _rtgui_object_destructor(rtgui_object_t *object)
|
||||
{
|
||||
/* nothing */
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
DEFINE_CLASS_TYPE(object, "object",
|
||||
RT_NULL,
|
||||
_rtgui_object_constructor,
|
||||
_rtgui_object_destructor,
|
||||
sizeof(struct rtgui_object));
|
||||
RT_NULL,
|
||||
_rtgui_object_constructor,
|
||||
_rtgui_object_destructor,
|
||||
sizeof(struct rtgui_object));
|
||||
RTM_EXPORT(_rtgui_object);
|
||||
|
||||
void rtgui_type_object_construct(const rtgui_type_t *type, rtgui_object_t *object)
|
||||
{
|
||||
/* first call parent's type */
|
||||
if (type->parent != RT_NULL)
|
||||
rtgui_type_object_construct(type->parent, object);
|
||||
/* first call parent's type */
|
||||
if (type->parent != RT_NULL)
|
||||
rtgui_type_object_construct(type->parent, object);
|
||||
|
||||
if (type->constructor) type->constructor(object);
|
||||
if (type->constructor) type->constructor(object);
|
||||
}
|
||||
|
||||
void rtgui_type_destructors_call(const rtgui_type_t *type, rtgui_object_t *object)
|
||||
{
|
||||
const rtgui_type_t *t;
|
||||
|
||||
t = type;
|
||||
while (t)
|
||||
{
|
||||
if (t->destructor) t->destructor(object);
|
||||
t = t->parent;
|
||||
}
|
||||
const rtgui_type_t *t;
|
||||
|
||||
t = type;
|
||||
while (t)
|
||||
{
|
||||
if (t->destructor) t->destructor(object);
|
||||
t = t->parent;
|
||||
}
|
||||
}
|
||||
|
||||
rt_bool_t rtgui_type_inherits_from(const rtgui_type_t *type, const rtgui_type_t *parent)
|
||||
{
|
||||
const rtgui_type_t *t;
|
||||
|
||||
t = type;
|
||||
while (t)
|
||||
{
|
||||
if (t == parent) return RT_TRUE;
|
||||
t = t->parent;
|
||||
}
|
||||
const rtgui_type_t *t;
|
||||
|
||||
return RT_FALSE;
|
||||
t = type;
|
||||
while (t)
|
||||
{
|
||||
if (t == parent) return RT_TRUE;
|
||||
t = t->parent;
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
const rtgui_type_t *rtgui_type_parent_type_get(const rtgui_type_t *type)
|
||||
{
|
||||
return type->parent;
|
||||
return type->parent;
|
||||
}
|
||||
|
||||
const char *rtgui_type_name_get(const rtgui_type_t *type)
|
||||
{
|
||||
if (!type) return RT_NULL;
|
||||
if (!type) return RT_NULL;
|
||||
|
||||
return type->name;
|
||||
return type->name;
|
||||
}
|
||||
|
||||
#ifdef RTGUI_OBJECT_TRACE
|
||||
struct rtgui_object_information
|
||||
{
|
||||
rt_uint32_t objs_number;
|
||||
rt_uint32_t allocated_size;
|
||||
rt_uint32_t max_allocated;
|
||||
rt_uint32_t objs_number;
|
||||
rt_uint32_t allocated_size;
|
||||
rt_uint32_t max_allocated;
|
||||
};
|
||||
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)
|
||||
{
|
||||
rtgui_object_t *new_object;
|
||||
rtgui_object_t *new_object;
|
||||
|
||||
if (!object_type)
|
||||
return RT_NULL;
|
||||
if (!object_type)
|
||||
return RT_NULL;
|
||||
|
||||
new_object = rtgui_malloc(object_type->size);
|
||||
if (new_object == RT_NULL) return RT_NULL;
|
||||
new_object = rtgui_malloc(object_type->size);
|
||||
if (new_object == RT_NULL) return RT_NULL;
|
||||
|
||||
#ifdef RTGUI_OBJECT_TRACE
|
||||
obj_info.objs_number ++;
|
||||
obj_info.allocated_size += object_type->size;
|
||||
if (obj_info.allocated_size > obj_info.max_allocated)
|
||||
obj_info.max_allocated = obj_info.allocated_size;
|
||||
obj_info.objs_number ++;
|
||||
obj_info.allocated_size += object_type->size;
|
||||
if (obj_info.allocated_size > obj_info.max_allocated)
|
||||
obj_info.max_allocated = obj_info.allocated_size;
|
||||
#endif
|
||||
|
||||
new_object->type = object_type;
|
||||
new_object->type = object_type;
|
||||
|
||||
rtgui_type_object_construct(object_type, new_object);
|
||||
rtgui_type_object_construct(object_type, new_object);
|
||||
|
||||
return new_object;
|
||||
return new_object;
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!object || object->flag & RTGUI_OBJECT_FLAG_STATIC)
|
||||
if (!object || object->flag & RTGUI_OBJECT_FLAG_STATIC)
|
||||
return;
|
||||
|
||||
#ifdef RTGUI_OBJECT_TRACE
|
||||
obj_info.objs_number --;
|
||||
obj_info.allocated_size -= object->type->size;
|
||||
obj_info.objs_number --;
|
||||
obj_info.allocated_size -= object->type->size;
|
||||
#endif
|
||||
|
||||
/* call destructor */
|
||||
RT_ASSERT(object->type != RT_NULL);
|
||||
rtgui_type_destructors_call(object->type, object);
|
||||
/* call destructor */
|
||||
RT_ASSERT(object->type != RT_NULL);
|
||||
rtgui_type_destructors_call(object->type, object);
|
||||
|
||||
/* release object */
|
||||
rtgui_free(object);
|
||||
/* release object */
|
||||
rtgui_free(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 (!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;
|
||||
return obj;
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!object) return RT_NULL;
|
||||
if (!object) return RT_NULL;
|
||||
|
||||
return object->type;
|
||||
return object->type;
|
||||
}
|
||||
RTM_EXPORT(rtgui_object_object_type_get);
|
||||
|
||||
void rtgui_object_set_event_handler(struct rtgui_object *object, rtgui_event_handler_ptr handler)
|
||||
{
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
RT_ASSERT(object != RT_NULL);
|
||||
|
||||
object->event_handler = handler;
|
||||
object->event_handler = handler;
|
||||
}
|
||||
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;
|
||||
return RT_FALSE;
|
||||
}
|
||||
RTM_EXPORT(rtgui_object_event_handler);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
#define RTGUI_ARGB(a, r, g, b) \
|
||||
((rtgui_color_t)(((rt_uint8_t)(r)|\
|
||||
(((unsigned)(rt_uint8_t)(g))<<8))|\
|
||||
(((unsigned long)(rt_uint8_t)(b))<<16)|\
|
||||
(((unsigned long)(rt_uint8_t)(a))<<24)))
|
||||
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
|
||||
#define RTGUI_ARGB(a, r, g, b) \
|
||||
((rtgui_color_t)(((rt_uint8_t)(r)|\
|
||||
(((unsigned)(rt_uint8_t)(g))<<8))|\
|
||||
(((unsigned long)(rt_uint8_t)(b))<<16)|\
|
||||
(((unsigned long)(rt_uint8_t)(a))<<24)))
|
||||
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
|
||||
|
||||
#define RTGUI_RGB_R(c) ((c) & 0xff)
|
||||
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
|
||||
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)
|
||||
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
|
||||
#define RTGUI_RGB_R(c) ((c) & 0xff)
|
||||
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
|
||||
#define RTGUI_RGB_B(c) (((c) >> 16) & 0xff)
|
||||
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
|
||||
|
||||
extern const rtgui_color_t default_foreground;
|
||||
extern const rtgui_color_t default_background;
|
||||
@@ -49,90 +49,90 @@ extern const rtgui_color_t light_grey;
|
||||
/* convert rtgui color to mono */
|
||||
rt_inline rt_uint8_t rtgui_color_to_mono(rtgui_color_t c)
|
||||
{
|
||||
rt_uint8_t pixel;
|
||||
rt_uint8_t pixel;
|
||||
|
||||
pixel = (RTGUI_RGB_R(c) | RTGUI_RGB_G(c) | RTGUI_RGB_B(c)) ? 0x01 : 0x00;
|
||||
return pixel;
|
||||
pixel = (RTGUI_RGB_R(c) | RTGUI_RGB_G(c) | RTGUI_RGB_B(c)) ? 0x01 : 0x00;
|
||||
return pixel;
|
||||
}
|
||||
|
||||
rt_inline rtgui_color_t rtgui_color_from_mono(rt_uint8_t pixel)
|
||||
{
|
||||
rtgui_color_t color;
|
||||
rtgui_color_t color;
|
||||
|
||||
if (pixel)
|
||||
{
|
||||
color = white;
|
||||
}
|
||||
if (pixel)
|
||||
{
|
||||
color = white;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = black;
|
||||
}
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
/* convert rtgui color to BBBBBGGGGGGRRRRR */
|
||||
rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
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;
|
||||
return pixel;
|
||||
}
|
||||
|
||||
rt_inline rtgui_color_t rtgui_color_from_565(rt_uint16_t pixel)
|
||||
{
|
||||
rt_uint16_t r, g, b;
|
||||
rtgui_color_t color;
|
||||
rt_uint16_t r, g, b;
|
||||
rtgui_color_t color;
|
||||
|
||||
r = pixel & 0x1f;
|
||||
g = (pixel >> 5) & 0x3f;
|
||||
b = (pixel >> 11) & 0x1f;
|
||||
r = pixel & 0x1f;
|
||||
g = (pixel >> 5) & 0x3f;
|
||||
b = (pixel >> 11) & 0x1f;
|
||||
|
||||
color = r * 255 / 31 + ((g * 255 / 63) << 8) + ((b * 255 / 31) << 16);
|
||||
color = r * 255 / 31 + ((g * 255 / 63) << 8) + ((b * 255 / 31) << 16);
|
||||
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
/* convert rtgui color to RRRRRGGGGGGBBBBB */
|
||||
rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c)>> 3));
|
||||
return pixel;
|
||||
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c) >> 3));
|
||||
return pixel;
|
||||
}
|
||||
|
||||
rt_inline rtgui_color_t rtgui_color_from_565p(rt_uint16_t pixel)
|
||||
{
|
||||
rt_uint8_t r, g, b;
|
||||
rtgui_color_t color;
|
||||
rt_uint8_t r, g, b;
|
||||
rtgui_color_t color;
|
||||
|
||||
r = (pixel >> 11) & 0x1f;
|
||||
g = (pixel >> 5) & 0x3f;
|
||||
b = pixel & 0x1f;
|
||||
r = (pixel >> 11) & 0x1f;
|
||||
g = (pixel >> 5) & 0x3f;
|
||||
b = pixel & 0x1f;
|
||||
|
||||
color = r * 255 / 31 + ((g * 255 / 63) << 8) + ((b * 255 / 31) << 16);
|
||||
color = r * 255 / 31 + ((g * 255 / 63) << 8) + ((b * 255 / 31) << 16);
|
||||
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
/* convert rtgui color to RGB */
|
||||
rt_inline rt_uint32_t rtgui_color_to_888(rtgui_color_t c)
|
||||
{
|
||||
rt_uint32_t pixel;
|
||||
rt_uint32_t pixel;
|
||||
|
||||
pixel = RTGUI_RGB_R(c) << 16 | RTGUI_RGB_G(c) << 8 | RTGUI_RGB_B(c);
|
||||
return pixel;
|
||||
pixel = RTGUI_RGB_R(c) << 16 | RTGUI_RGB_G(c) << 8 | RTGUI_RGB_B(c);
|
||||
return pixel;
|
||||
}
|
||||
|
||||
rt_inline rtgui_color_t rtgui_color_from_888(rt_uint32_t pixel)
|
||||
{
|
||||
rtgui_color_t color;
|
||||
rtgui_color_t color;
|
||||
|
||||
color = RTGUI_RGB(((pixel >> 16) & 0xff), ((pixel >> 8) & 0xff), pixel & 0xff);
|
||||
color = RTGUI_RGB(((pixel >> 16) & 0xff), ((pixel >> 8) & 0xff), pixel & 0xff);
|
||||
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,91 +21,91 @@
|
||||
|
||||
enum rtgui_dc_type
|
||||
{
|
||||
RTGUI_DC_HW,
|
||||
RTGUI_DC_CLIENT,
|
||||
RTGUI_DC_BUFFER,
|
||||
RTGUI_DC_HW,
|
||||
RTGUI_DC_CLIENT,
|
||||
RTGUI_DC_BUFFER,
|
||||
};
|
||||
|
||||
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);
|
||||
/* 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);
|
||||
|
||||
/* 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);
|
||||
/* 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);
|
||||
|
||||
/* get dc visible */
|
||||
rt_bool_t (*get_visible)(struct rtgui_dc* dc);
|
||||
/* get dc visible */
|
||||
rt_bool_t (*get_visible)(struct rtgui_dc *dc);
|
||||
|
||||
/* get dc rect */
|
||||
void (*get_rect )(struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
/* get dc 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 */
|
||||
struct rtgui_dc
|
||||
{
|
||||
/* type of device context */
|
||||
rt_uint32_t type;
|
||||
/* type of device context */
|
||||
rt_uint32_t type;
|
||||
|
||||
/* dc engine */
|
||||
const struct rtgui_dc_engine* engine;
|
||||
/* dc engine */
|
||||
const struct rtgui_dc_engine *engine;
|
||||
};
|
||||
|
||||
#define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(dc)->foreground)
|
||||
#define RTGUI_DC_BC(dc) (rtgui_dc_get_gc(dc)->background)
|
||||
#define RTGUI_DC_FONT(dc) (rtgui_dc_get_gc(dc)->font)
|
||||
#define RTGUI_DC_TEXTALIGN(dc) (rtgui_dc_get_gc(dc)->textalign)
|
||||
#define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(dc)->foreground)
|
||||
#define RTGUI_DC_BC(dc) (rtgui_dc_get_gc(dc)->background)
|
||||
#define RTGUI_DC_FONT(dc) (rtgui_dc_get_gc(dc)->font)
|
||||
#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,
|
||||
rtgui_color_t color_stroke, rtgui_color_t color_core);
|
||||
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,81 +118,81 @@ 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);
|
||||
dc->engine->draw_point(dc, x, 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);
|
||||
dc->engine->draw_color_point(dc, x, y, color);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
dc->engine->draw_vline(dc, x, y1, 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);
|
||||
dc->engine->draw_hline(dc, x1, x2, y);
|
||||
}
|
||||
|
||||
/*
|
||||
* fill a rect with background color
|
||||
* 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);
|
||||
dc->engine->fill_rect(dc, 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);
|
||||
dc->engine->blit(dc, dc_point, dest, rect);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
dc->engine->set_gc(dc, 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);
|
||||
return dc->engine->get_gc(dc);
|
||||
}
|
||||
|
||||
/*
|
||||
* get visible status of 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);
|
||||
return dc->engine->get_visible(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);
|
||||
dc->engine->get_rect(dc, rect);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -30,87 +30,87 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct rtgui_dlist_node
|
||||
{
|
||||
struct rtgui_dlist_node *next; /* point to next node. */
|
||||
struct rtgui_dlist_node *prev; /* point to prev 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)
|
||||
{
|
||||
l->next = l->prev = l;
|
||||
}
|
||||
/**
|
||||
* @brief initialize a list
|
||||
*
|
||||
* @param l list to be initialized
|
||||
*/
|
||||
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)
|
||||
{
|
||||
l->next->prev = n;
|
||||
n->next = l->next;
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
l->next->prev = n;
|
||||
n->next = l->next;
|
||||
|
||||
l->next = n;
|
||||
n->prev = l;
|
||||
}
|
||||
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)
|
||||
{
|
||||
l->prev->next = n;
|
||||
n->prev = l->prev;
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
l->prev->next = n;
|
||||
n->prev = l->prev;
|
||||
|
||||
l->prev = n;
|
||||
n->next = l;
|
||||
}
|
||||
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)
|
||||
{
|
||||
n->next->prev = n->prev;
|
||||
n->prev->next = n->next;
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
n->next->prev = n->prev;
|
||||
n->prev->next = n->next;
|
||||
|
||||
rtgui_dlist_init(n);
|
||||
}
|
||||
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)
|
||||
{
|
||||
return l->next == l;
|
||||
}
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
return l->next == l;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the struct for this entry
|
||||
* @param node the entry point
|
||||
* @param type the type of structure
|
||||
* @param member the name of list in structure
|
||||
*/
|
||||
/**
|
||||
* @brief get the struct for this entry
|
||||
* @param node the entry point
|
||||
* @param type the type of structure
|
||||
* @param member the name of list in structure
|
||||
*/
|
||||
#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
|
||||
* normal order, use next. If you want to iterate the list with reverse order,
|
||||
* use prev.*/
|
||||
#define rtgui_dlist_foreach(node, list, direction) \
|
||||
for ((node) = (list)->direction; (node) != list; (node) = (node)->direction)
|
||||
/* 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) \
|
||||
for ((node) = (list)->direction; (node) != list; (node) = (node)->direction)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -19,49 +19,49 @@
|
||||
|
||||
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);
|
||||
/* 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 (*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);
|
||||
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);
|
||||
|
||||
/* draw raw hline */
|
||||
void (*draw_raw_hline)(rt_uint8_t *pixels, int x1, int x2, int y);
|
||||
/* draw raw hline */
|
||||
void (*draw_raw_hline)(rt_uint8_t *pixels, int x1, int x2, int y);
|
||||
};
|
||||
|
||||
struct rtgui_graphic_driver
|
||||
{
|
||||
/* pixel format and byte per pixel */
|
||||
rt_uint8_t pixel_format;
|
||||
rt_uint8_t bits_per_pixel;
|
||||
rt_uint16_t pitch;
|
||||
/* pixel format and byte per pixel */
|
||||
rt_uint8_t pixel_format;
|
||||
rt_uint8_t bits_per_pixel;
|
||||
rt_uint16_t pitch;
|
||||
|
||||
/* screen width and height */
|
||||
rt_uint16_t width;
|
||||
rt_uint16_t height;
|
||||
/* screen width and height */
|
||||
rt_uint16_t width;
|
||||
rt_uint16_t height;
|
||||
|
||||
/* framebuffer address and ops */
|
||||
volatile rt_uint8_t *framebuffer;
|
||||
rt_device_t device;
|
||||
const struct rtgui_graphic_driver_ops *ops;
|
||||
/* framebuffer address and ops */
|
||||
volatile rt_uint8_t *framebuffer;
|
||||
rt_device_t device;
|
||||
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;
|
||||
extern struct rtgui_graphic_driver _driver;
|
||||
return &_driver;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,8 @@
|
||||
#ifndef __RTGUI_FILERW_H__
|
||||
#define __RTGUI_FILERW_H__
|
||||
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
#ifdef _WIN32
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
#ifdef _WIN32_NATIVE
|
||||
#pragma warning(disable: 4996)
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
@@ -28,33 +28,33 @@
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
#define RTGUI_FILE_SEEK_SET 0
|
||||
#define RTGUI_FILE_SEEK_CUR 1
|
||||
#define RTGUI_FILE_SEEK_END 2
|
||||
#define RTGUI_FILE_SEEK_SET 0
|
||||
#define RTGUI_FILE_SEEK_CUR 1
|
||||
#define RTGUI_FILE_SEEK_END 2
|
||||
|
||||
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 (*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 (*close)(struct rtgui_filerw *context);
|
||||
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 (*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
|
||||
|
||||
@@ -23,13 +23,13 @@ struct rtgui_rect;
|
||||
|
||||
struct rtgui_font_engine
|
||||
{
|
||||
/* font engine function */
|
||||
void (*font_init)(struct rtgui_font* font);
|
||||
void (*font_load)(struct rtgui_font* font);
|
||||
/* font engine function */
|
||||
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,15 +37,15 @@ 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 */
|
||||
rt_uint16_t width; /* font width */
|
||||
rt_uint16_t height; /* font height */
|
||||
|
||||
rt_uint8_t first_char;
|
||||
rt_uint8_t last_char;
|
||||
rt_uint8_t first_char;
|
||||
rt_uint8_t last_char;
|
||||
};
|
||||
extern const struct rtgui_font_engine bmp_font_engine;
|
||||
|
||||
@@ -65,50 +65,54 @@ struct rtgui_hz_file_font
|
||||
|
||||
/* font size */
|
||||
rt_uint16_t font_size;
|
||||
rt_uint16_t font_data_size;
|
||||
rt_uint16_t font_data_size;
|
||||
|
||||
/* file descriptor */
|
||||
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;
|
||||
/* font name */
|
||||
char *family;
|
||||
|
||||
/* font height */
|
||||
rt_uint16_t height;
|
||||
/* font height */
|
||||
rt_uint16_t height;
|
||||
|
||||
/* refer count */
|
||||
rt_uint32_t refer_count;
|
||||
/* refer count */
|
||||
rt_uint32_t refer_count;
|
||||
|
||||
/* font engine */
|
||||
const struct rtgui_font_engine* engine;
|
||||
/* font engine */
|
||||
const struct rtgui_font_engine *engine;
|
||||
|
||||
/* font private data */
|
||||
void* data;
|
||||
/* font private data */
|
||||
void *data;
|
||||
|
||||
/* the font list */
|
||||
rtgui_list_t list;
|
||||
/* the font list */
|
||||
rtgui_list_t list;
|
||||
};
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,48 +19,48 @@
|
||||
#include <rtgui/region.h>
|
||||
|
||||
enum rtgui_img_zoom
|
||||
{
|
||||
RTGUI_IMG_ZOOM_NEAREST,
|
||||
RTGUI_IMG_ZOOM_BILINEAR
|
||||
{
|
||||
RTGUI_IMG_ZOOM_NEAREST,
|
||||
RTGUI_IMG_ZOOM_BILINEAR
|
||||
};
|
||||
|
||||
struct rtgui_image;
|
||||
struct rtgui_image_engine
|
||||
{
|
||||
const char* name;
|
||||
struct rtgui_list_node list;
|
||||
const char *name;
|
||||
struct rtgui_list_node list;
|
||||
|
||||
/* image engine function */
|
||||
rt_bool_t (*image_check)(struct rtgui_filerw* file);
|
||||
/* image engine function */
|
||||
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;
|
||||
rt_uint32_t ncolors;
|
||||
rtgui_color_t *colors;
|
||||
rt_uint32_t ncolors;
|
||||
};
|
||||
typedef struct rtgui_image_palette rtgui_image_palette_t;
|
||||
|
||||
struct rtgui_image
|
||||
{
|
||||
/* image metrics */
|
||||
rt_uint16_t w, h;
|
||||
/* image metrics */
|
||||
rt_uint16_t w, h;
|
||||
|
||||
/* image engine */
|
||||
const struct rtgui_image_engine* engine;
|
||||
/* image engine */
|
||||
const struct rtgui_image_engine *engine;
|
||||
|
||||
/* image palette */
|
||||
rtgui_image_palette_t* palette;
|
||||
/* image palette */
|
||||
rtgui_image_palette_t *palette;
|
||||
|
||||
/* image private data */
|
||||
void* data;
|
||||
/* image private 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
|
||||
|
||||
|
||||
@@ -18,27 +18,27 @@
|
||||
|
||||
struct rtgui_image_bmp_header
|
||||
{
|
||||
/* The Win32 BMP file header (14 bytes) */
|
||||
rt_uint16_t bfType;
|
||||
rt_uint32_t bfSize;
|
||||
rt_uint16_t bfReserved1;
|
||||
rt_uint16_t bfReserved2;
|
||||
rt_uint32_t bfOffBits;
|
||||
/* The Win32 BMP file header (14 bytes) */
|
||||
rt_uint16_t bfType;
|
||||
rt_uint32_t bfSize;
|
||||
rt_uint16_t bfReserved1;
|
||||
rt_uint16_t bfReserved2;
|
||||
rt_uint32_t bfOffBits;
|
||||
|
||||
/* The Win32 BITMAPINFOHEADER struct (40 bytes) */
|
||||
rt_uint32_t biSize;
|
||||
rt_int32_t biWidth;
|
||||
rt_int32_t biHeight;
|
||||
rt_uint16_t biPlanes;
|
||||
rt_uint16_t biBitCount;
|
||||
rt_uint32_t biCompression;
|
||||
rt_uint32_t biSizeImage;
|
||||
rt_int32_t biXPelsPerMeter;
|
||||
rt_int32_t biYPelsPerMeter;
|
||||
rt_uint32_t biClrUsed;
|
||||
rt_uint32_t biClrImportant;
|
||||
/* The Win32 BITMAPINFOHEADER struct (40 bytes) */
|
||||
rt_uint32_t biSize;
|
||||
rt_int32_t biWidth;
|
||||
rt_int32_t biHeight;
|
||||
rt_uint16_t biPlanes;
|
||||
rt_uint16_t biBitCount;
|
||||
rt_uint32_t biCompression;
|
||||
rt_uint32_t biSizeImage;
|
||||
rt_int32_t biXPelsPerMeter;
|
||||
rt_int32_t biYPelsPerMeter;
|
||||
rt_uint32_t biClrUsed;
|
||||
rt_uint32_t biClrImportant;
|
||||
};
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32_NATIVE
|
||||
#pragma warning(disable : 4103)
|
||||
#endif
|
||||
void rtgui_image_bmp_init(void);
|
||||
|
||||
@@ -8,20 +8,20 @@
|
||||
/* image item in image container */
|
||||
struct rtgui_image_item
|
||||
{
|
||||
rtgui_image_t *image;
|
||||
char *filename;
|
||||
rtgui_image_t *image;
|
||||
char *filename;
|
||||
|
||||
rt_uint32_t refcount;
|
||||
rt_uint32_t refcount;
|
||||
};
|
||||
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);
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
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
|
||||
|
||||
@@ -18,20 +18,20 @@
|
||||
|
||||
struct rtgui_image_hdcmm
|
||||
{
|
||||
struct rtgui_image parent;
|
||||
struct rtgui_image parent;
|
||||
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
rt_uint16_t pitch;
|
||||
|
||||
rt_uint8_t *pixels;
|
||||
rt_uint8_t *pixels;
|
||||
};
|
||||
|
||||
void rtgui_image_hdc_init(void);
|
||||
extern const struct rtgui_image_engine rtgui_image_hdcmm_engine;
|
||||
|
||||
#define HDC_HEADER_SIZE (5 * 4)
|
||||
#define RTGUI_IMAGE_HDC_DEF(bpp, w, h, pixels) \
|
||||
{{w, h, &rtgui_image_hdcmm_engine, RT_NULL}, bpp, (bpp * w), ((rt_uint8_t*)pixels + HDC_HEADER_SIZE)}
|
||||
#define HDC_HEADER_SIZE (5 * 4)
|
||||
#define RTGUI_IMAGE_HDC_DEF(bpp, w, h, pixels) \
|
||||
{{w, h, &rtgui_image_hdcmm_engine, RT_NULL}, bpp, (bpp * w), ((rt_uint8_t*)pixels + HDC_HEADER_SIZE)}
|
||||
|
||||
#endif
|
||||
|
||||
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
Reference in New Issue
Block a user