mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-08 11:54:50 +08:00
add rtgui_win subfield,Highlight the ease of use
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1345 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
85
components/rtgui_win/SConscript
Normal file
85
components/rtgui_win/SConscript
Normal file
@@ -0,0 +1,85 @@
|
||||
Import('env')
|
||||
Import('rtconfig')
|
||||
Import('RTT_ROOT')
|
||||
Import('projects')
|
||||
|
||||
common_src = Split("""
|
||||
common/color.c
|
||||
common/region.c
|
||||
common/rtgui_object.c
|
||||
common/rtgui_system.c
|
||||
common/rtgui_theme.c
|
||||
common/rtgui_xml.c
|
||||
common/dc.c
|
||||
common/dc_buffer.c
|
||||
common/dc_hw.c
|
||||
common/filerw.c
|
||||
common/image.c
|
||||
common/image_xpm.c
|
||||
common/image_hdc.c
|
||||
common/font.c
|
||||
common/font_hz_file.c
|
||||
common/font_hz_bmp.c
|
||||
common/asc12font.c
|
||||
common/asc16font.c
|
||||
common/hz12font.c
|
||||
common/hz16font.c
|
||||
""")
|
||||
|
||||
server_src = Split("""
|
||||
server/driver.c
|
||||
server/mouse.c
|
||||
server/panel.c
|
||||
server/server.c
|
||||
server/topwin.c
|
||||
""")
|
||||
|
||||
widgets_src = Split("""
|
||||
widgets/button.c
|
||||
widgets/checkbox.c
|
||||
widgets/container.c
|
||||
widgets/iconbox.c
|
||||
widgets/label.c
|
||||
widgets/progressbar.c
|
||||
widgets/radiobox.c
|
||||
widgets/slider.c
|
||||
widgets/staticline.c
|
||||
widgets/textbox.c
|
||||
widgets/listbox.c
|
||||
widgets/view.c
|
||||
widgets/list_view.c
|
||||
widgets/filelist_view.c
|
||||
widgets/widget.c
|
||||
widgets/window.c
|
||||
widgets/combobox.c
|
||||
widgets/scrollbar.c
|
||||
""")
|
||||
|
||||
# The set of source files associated with this SConscript file.
|
||||
src_local = common_src + server_src + widgets_src
|
||||
|
||||
path = [RTT_ROOT + '/components/rtgui/include',
|
||||
RTT_ROOT + '/components/rgtui/common',
|
||||
RTT_ROOT + '/components/rtgui/server',
|
||||
RTT_ROOT + '/components/rtgui/widgets']
|
||||
|
||||
# group definitions
|
||||
group = {}
|
||||
group['name'] = 'GUI'
|
||||
group['src'] = File(src_local)
|
||||
group['CCFLAGS'] = ''
|
||||
group['CPPPATH'] = path
|
||||
group['CPPDEFINES'] = ''
|
||||
group['LINKFLAGS'] = ''
|
||||
|
||||
# add group to project list
|
||||
projects.append(group)
|
||||
|
||||
env.Append(CCFLAGS = group['CCFLAGS'])
|
||||
env.Append(CPPPATH = group['CPPPATH'])
|
||||
env.Append(CPPDEFINES = group['CPPDEFINES'])
|
||||
env.Append(LINKFLAGS = group['LINKFLAGS'])
|
||||
|
||||
objs = env.Object(group['src'])
|
||||
|
||||
Return('objs')
|
||||
173
components/rtgui_win/common/asc12font.c
Normal file
173
components/rtgui_win/common/asc12font.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* File : asc16font.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/font.h>
|
||||
|
||||
const unsigned char asc12_font[] =
|
||||
{//Tahoma趼极
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//諾啞
|
||||
0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00,//!
|
||||
0x00,0x00,0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//"
|
||||
0x00,0x00,0x00,0x50,0x50,0xF8,0x50,0xF8,0x50,0x50,0x00,0x00,//#
|
||||
0x00,0x00,0x20,0x78,0xA0,0x60,0x30,0x28,0xF0,0x20,0x00,0x00,//$
|
||||
0x00,0x00,0x48,0xA8,0xB0,0x50,0x28,0x34,0x54,0x48,0x00,0x00,//%
|
||||
0x00,0x00,0x00,0x60,0x90,0x90,0x60,0xA8,0x90,0x68,0x00,0x00,//&
|
||||
0x00,0x00,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//'
|
||||
0x00,0x00,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x10,0x00,//(
|
||||
0x00,0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00,//)
|
||||
0x00,0x00,0x00,0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,0x00,//*
|
||||
0x00,0x00,0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00,//+
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x40,0x00,//,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,//-
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x00,//.
|
||||
0x00,0x00,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x00,///
|
||||
0x00,0x00,0x00,0x70,0x88,0x98,0xA8,0xC8,0x88,0x70,0x00,0x00,//0
|
||||
0x00,0x00,0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00,0x00,//1
|
||||
0x00,0x00,0x00,0x70,0x88,0x88,0x30,0x40,0x80,0xF8,0x00,0x00,//2
|
||||
0x00,0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00,0x00,//3
|
||||
0x00,0x00,0x00,0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x00,0x00,//4
|
||||
0x00,0x00,0x00,0xF8,0x80,0x80,0x70,0x08,0x88,0x70,0x00,0x00,//5
|
||||
0x00,0x00,0x00,0x70,0x88,0x80,0xF0,0x88,0x88,0x70,0x00,0x00,//6
|
||||
0x00,0x00,0x00,0xF8,0x08,0x10,0x20,0x20,0x40,0x40,0x00,0x00,//7
|
||||
0x00,0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x00,//8
|
||||
0x00,0x00,0x00,0x70,0x88,0x88,0x78,0x08,0x88,0x70,0x00,0x00,//9
|
||||
0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x20,0x20,0x00,0x00,0x00,//:
|
||||
0x00,0x00,0x00,0x00,0x20,0x20,0x00,0x20,0x20,0x40,0x00,0x00,//;
|
||||
0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x00,//<
|
||||
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0xF8,0x00,0x00,0x00,0x00,//=
|
||||
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x80,0x00,//>
|
||||
0x00,0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x00,0x20,0x00,0x00,//?
|
||||
0x00,0x00,0x78,0x84,0xB4,0xD4,0xD4,0xB8,0x80,0x78,0x00,0x00,//@
|
||||
0x00,0x00,0x00,0x30,0x30,0x48,0x48,0x78,0x84,0x84,0x00,0x00,//A
|
||||
0x00,0x00,0x00,0xF0,0x88,0x88,0xF0,0x88,0x88,0xF0,0x00,0x00,//B
|
||||
0x00,0x00,0x00,0x38,0x40,0x80,0x80,0x80,0x40,0x38,0x00,0x00,//C
|
||||
0x00,0x00,0x00,0xE0,0x90,0x88,0x88,0x88,0x90,0xE0,0x00,0x00,//D
|
||||
0x00,0x00,0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00,0x00,//E
|
||||
0x00,0x00,0x00,0xF8,0x80,0x80,0xF8,0x80,0x80,0x80,0x00,0x00,//F
|
||||
0x00,0x00,0x00,0x78,0x80,0x80,0xB8,0x88,0x88,0x78,0x00,0x00,//G
|
||||
0x00,0x00,0x00,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x00,0x00,//H
|
||||
0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,//I
|
||||
0x00,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0,0x00,0x00,//J
|
||||
0x00,0x00,0x00,0x88,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x00,0x00,//K
|
||||
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xF8,0x00,0x00,//L
|
||||
0x00,0x00,0x00,0x88,0x88,0xD8,0xA8,0xA8,0x88,0x88,0x00,0x00,//M
|
||||
0x00,0x00,0x00,0x88,0x88,0xC8,0xA8,0x98,0x88,0x88,0x00,0x00,//N
|
||||
0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00,//O
|
||||
0x00,0x00,0x00,0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x00,0x00,//P
|
||||
0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0xA8,0x70,0x08,0x00,//Q
|
||||
0x00,0x00,0x00,0xE0,0x90,0x90,0xE0,0xA0,0x90,0x88,0x00,0x00,//R
|
||||
0x00,0x00,0x00,0x78,0x80,0x80,0x70,0x08,0x08,0xF0,0x00,0x00,//S
|
||||
0x00,0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,//T
|
||||
0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00,//U
|
||||
0x00,0x00,0x00,0x88,0x88,0x88,0x50,0x50,0x50,0x20,0x00,0x00,//V
|
||||
0x00,0x00,0x00,0xA8,0xA8,0xA8,0xA8,0x50,0x50,0x50,0x00,0x00,//W
|
||||
0x00,0x00,0x00,0x88,0x50,0x50,0x20,0x50,0x50,0x88,0x00,0x00,//X
|
||||
0x00,0x00,0x00,0x88,0x50,0x50,0x20,0x20,0x20,0x20,0x00,0x00,//Y
|
||||
0x00,0x00,0x00,0xF8,0x08,0x10,0x20,0x40,0x80,0xF8,0x00,0x00,//Z
|
||||
0x00,0x00,0x70,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,//[
|
||||
0x00,0x00,0x40,0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x10,0x00,//\
|
||||
0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00,//]
|
||||
0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00,//]
|
||||
0x00,0x00,0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,//^
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,//_
|
||||
0x00,0x00,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//`
|
||||
0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00,0x00,//a
|
||||
0x00,0x00,0x80,0x80,0x80,0xF0,0x88,0x88,0x88,0xF0,0x00,0x00,//b
|
||||
0x00,0x00,0x00,0x00,0x00,0x78,0x80,0x80,0x80,0x78,0x00,0x00,//c
|
||||
0x00,0x00,0x08,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,//d
|
||||
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0xF8,0x80,0x78,0x00,0x00,//e
|
||||
0x00,0x00,0x18,0x20,0x20,0x78,0x20,0x20,0x20,0x20,0x00,0x00,//f
|
||||
0x00,0x00,0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x78,0x08,0x70,//g
|
||||
0x00,0x00,0x80,0x80,0x80,0xF0,0x88,0x88,0x88,0x88,0x00,0x00,//h
|
||||
0x00,0x00,0x00,0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00,//i
|
||||
0x00,0x00,0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x60,//j
|
||||
0x00,0x00,0x40,0x40,0x40,0x48,0x50,0x60,0x50,0x48,0x00,0x00,//k
|
||||
0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x30,0x00,0x00,//l
|
||||
0x00,0x00,0x00,0x00,0x00,0xD0,0xA8,0xA8,0xA8,0xA8,0x00,0x00,//m
|
||||
0x00,0x00,0x00,0x00,0x00,0x70,0x48,0x48,0x48,0x48,0x00,0x00,//n
|
||||
0x00,0x00,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00,0x00,//o
|
||||
0x00,0x00,0x00,0x00,0x00,0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,//p
|
||||
0x00,0x00,0x00,0x00,0x00,0x78,0x88,0x88,0x88,0x78,0x08,0x08,//q
|
||||
0x00,0x00,0x00,0x00,0x00,0x58,0x60,0x40,0x40,0x40,0x00,0x00,//r
|
||||
0x00,0x00,0x00,0x00,0x00,0x38,0x40,0x30,0x08,0x70,0x00,0x00,//s
|
||||
0x00,0x00,0x00,0x20,0x20,0x78,0x20,0x20,0x20,0x18,0x00,0x00,//t
|
||||
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x88,0x88,0x78,0x00,0x00,//u
|
||||
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x00,0x00,//v
|
||||
0x00,0x00,0x00,0x00,0x00,0xA8,0xA8,0xA8,0x50,0x50,0x00,0x00,//w
|
||||
0x00,0x00,0x00,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,//x
|
||||
0x00,0x00,0x00,0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x20,0xC0,//y
|
||||
0x00,0x00,0x00,0x00,0x00,0xF8,0x10,0x20,0x40,0xF8,0x00,0x00,//z
|
||||
0x00,0x00,0x08,0x10,0x10,0x10,0x60,0x10,0x10,0x10,0x08,0x00,//{
|
||||
0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,//|
|
||||
0x00,0x00,0x40,0x20,0x20,0x20,0x18,0x20,0x20,0x20,0x40,0x00,//}
|
||||
0x00,0x00,0x00,0x00,0x00,0x48,0xA8,0x90,0x00,0x00,0x00,0x00,//~
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//
|
||||
|
||||
};
|
||||
|
||||
|
||||
const struct rtgui_font_bitmap asc12 =
|
||||
{
|
||||
(const rt_uint8_t*)asc12_font, /* bmp */
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
6, /* width */
|
||||
12, /* height */
|
||||
0, /* first char */
|
||||
127 /* last char */
|
||||
};
|
||||
|
||||
rtgui_font_t rtgui_font_asc12 =
|
||||
{
|
||||
"asc", /* family */
|
||||
12, /* height */
|
||||
1, /* refer count */
|
||||
&bmp_font_engine, /* font engine */
|
||||
(void *)&asc12, /* font private data */
|
||||
};
|
||||
|
||||
/* size = 4096 bytes */
|
||||
|
||||
297
components/rtgui_win/common/asc16font.c
Normal file
297
components/rtgui_win/common/asc16font.c
Normal file
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
* File : asc16font.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/font.h>
|
||||
|
||||
#ifdef RTGUI_USING_FONT16
|
||||
const unsigned char asc16_font[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
||||
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
|
||||
0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
|
||||
0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
|
||||
0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00,
|
||||
0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
|
||||
0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00,
|
||||
0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00,
|
||||
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
|
||||
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
|
||||
0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
|
||||
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
const struct rtgui_font_bitmap asc16 =
|
||||
{
|
||||
(const rt_uint8_t*)asc16_font, /* bmp */
|
||||
RT_NULL, /* each character width, NULL for fixed font */
|
||||
RT_NULL, /* offset for each character */
|
||||
8, /* width */
|
||||
16, /* height */
|
||||
0, /* first char */
|
||||
255 /* last char */
|
||||
};
|
||||
|
||||
rtgui_font_t rtgui_font_asc16 =
|
||||
{
|
||||
"asc", /* family */
|
||||
16, /* height */
|
||||
1, /* refer count */
|
||||
&bmp_font_engine, /* font engine */
|
||||
(void *)&asc16, /* font private data */
|
||||
};
|
||||
|
||||
/* size = 4096 bytes */
|
||||
#endif
|
||||
307
components/rtgui_win/common/blit.c
Normal file
307
components/rtgui_win/common/blit.c
Normal file
@@ -0,0 +1,307 @@
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/blit.h>
|
||||
|
||||
/* 2 bpp to 1 bpp */
|
||||
static void rtgui_blit_line_2_1(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* 3 bpp to 1 bpp */
|
||||
static void rtgui_blit_line_3_1(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
line = line / 3;
|
||||
while (line)
|
||||
{
|
||||
*dst_ptr = (rt_uint8_t)(((*src_ptr & 0x00E00000)>>16)|
|
||||
((*(src_ptr + 1) & 0x0000E000)>>11) |
|
||||
((*(src_ptr + 2) & 0x000000C0)>>6));
|
||||
|
||||
src_ptr += 3;
|
||||
dst_ptr ++;
|
||||
line --;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* 4 bpp to 1 bpp */
|
||||
static void rtgui_blit_line_4_1(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
struct _color {rt_uint8_t r, g, b, a;} *c;
|
||||
|
||||
c = (struct _color*)src_ptr;
|
||||
while (line-- > 0)
|
||||
{
|
||||
*dst_ptr = (c->r & 0xe0) | (c->g & 0xc0) >> 3 | (c->b & 0xe0) >> 5 ;
|
||||
|
||||
c ++;
|
||||
dst_ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
/* 1 bpp to 2 bpp */
|
||||
static void rtgui_blit_line_1_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* 3 bpp to 2 bpp */
|
||||
static void rtgui_blit_line_3_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
rt_uint16_t* dst;
|
||||
|
||||
dst = (rt_uint16_t*)dst_ptr;
|
||||
line = line / 3;
|
||||
while (line)
|
||||
{
|
||||
*dst = (((*(src_ptr + 0) << 8) & 0x0000F800) |
|
||||
((*(src_ptr + 1) << 3) & 0x000007E0) |
|
||||
((*(src_ptr + 2) >> 3) & 0x0000001F));
|
||||
|
||||
src_ptr += 3;
|
||||
dst ++;
|
||||
line --;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* 4 bpp to 2 bpp */
|
||||
static void rtgui_blit_line_4_2(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
struct _color {rt_uint8_t r, g, b, a;} *c;
|
||||
rt_uint16_t* ptr;
|
||||
|
||||
c = (struct _color*)src_ptr;
|
||||
ptr = (rt_uint16_t*)dst_ptr;
|
||||
|
||||
line = line / 4;
|
||||
while (line-- > 0)
|
||||
{
|
||||
*ptr = ((c->r & 0xf8) << 8) | ((c->g & 0xfc) << 3) | (c->b >> 3);
|
||||
|
||||
c ++;
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_blit_line_1_3(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#define HI 1
|
||||
#define LO 0
|
||||
|
||||
/* Special optimized blit for RTGUI_RGB 5-6-5 --> RGBA 8-8-8-8 */
|
||||
static const rt_uint32_t RGB565_RGBA8888_LUT[512] =
|
||||
{
|
||||
0x000000ff, 0x00000000, 0x000008ff, 0x00200000,
|
||||
0x000010ff, 0x00400000, 0x000018ff, 0x00610000,
|
||||
0x000020ff, 0x00810000, 0x000029ff, 0x00a10000,
|
||||
0x000031ff, 0x00c20000, 0x000039ff, 0x00e20000,
|
||||
0x000041ff, 0x08000000, 0x00004aff, 0x08200000,
|
||||
0x000052ff, 0x08400000, 0x00005aff, 0x08610000,
|
||||
0x000062ff, 0x08810000, 0x00006aff, 0x08a10000,
|
||||
0x000073ff, 0x08c20000, 0x00007bff, 0x08e20000,
|
||||
0x000083ff, 0x10000000, 0x00008bff, 0x10200000,
|
||||
0x000094ff, 0x10400000, 0x00009cff, 0x10610000,
|
||||
0x0000a4ff, 0x10810000, 0x0000acff, 0x10a10000,
|
||||
0x0000b4ff, 0x10c20000, 0x0000bdff, 0x10e20000,
|
||||
0x0000c5ff, 0x18000000, 0x0000cdff, 0x18200000,
|
||||
0x0000d5ff, 0x18400000, 0x0000deff, 0x18610000,
|
||||
0x0000e6ff, 0x18810000, 0x0000eeff, 0x18a10000,
|
||||
0x0000f6ff, 0x18c20000, 0x0000ffff, 0x18e20000,
|
||||
0x000400ff, 0x20000000, 0x000408ff, 0x20200000,
|
||||
0x000410ff, 0x20400000, 0x000418ff, 0x20610000,
|
||||
0x000420ff, 0x20810000, 0x000429ff, 0x20a10000,
|
||||
0x000431ff, 0x20c20000, 0x000439ff, 0x20e20000,
|
||||
0x000441ff, 0x29000000, 0x00044aff, 0x29200000,
|
||||
0x000452ff, 0x29400000, 0x00045aff, 0x29610000,
|
||||
0x000462ff, 0x29810000, 0x00046aff, 0x29a10000,
|
||||
0x000473ff, 0x29c20000, 0x00047bff, 0x29e20000,
|
||||
0x000483ff, 0x31000000, 0x00048bff, 0x31200000,
|
||||
0x000494ff, 0x31400000, 0x00049cff, 0x31610000,
|
||||
0x0004a4ff, 0x31810000, 0x0004acff, 0x31a10000,
|
||||
0x0004b4ff, 0x31c20000, 0x0004bdff, 0x31e20000,
|
||||
0x0004c5ff, 0x39000000, 0x0004cdff, 0x39200000,
|
||||
0x0004d5ff, 0x39400000, 0x0004deff, 0x39610000,
|
||||
0x0004e6ff, 0x39810000, 0x0004eeff, 0x39a10000,
|
||||
0x0004f6ff, 0x39c20000, 0x0004ffff, 0x39e20000,
|
||||
0x000800ff, 0x41000000, 0x000808ff, 0x41200000,
|
||||
0x000810ff, 0x41400000, 0x000818ff, 0x41610000,
|
||||
0x000820ff, 0x41810000, 0x000829ff, 0x41a10000,
|
||||
0x000831ff, 0x41c20000, 0x000839ff, 0x41e20000,
|
||||
0x000841ff, 0x4a000000, 0x00084aff, 0x4a200000,
|
||||
0x000852ff, 0x4a400000, 0x00085aff, 0x4a610000,
|
||||
0x000862ff, 0x4a810000, 0x00086aff, 0x4aa10000,
|
||||
0x000873ff, 0x4ac20000, 0x00087bff, 0x4ae20000,
|
||||
0x000883ff, 0x52000000, 0x00088bff, 0x52200000,
|
||||
0x000894ff, 0x52400000, 0x00089cff, 0x52610000,
|
||||
0x0008a4ff, 0x52810000, 0x0008acff, 0x52a10000,
|
||||
0x0008b4ff, 0x52c20000, 0x0008bdff, 0x52e20000,
|
||||
0x0008c5ff, 0x5a000000, 0x0008cdff, 0x5a200000,
|
||||
0x0008d5ff, 0x5a400000, 0x0008deff, 0x5a610000,
|
||||
0x0008e6ff, 0x5a810000, 0x0008eeff, 0x5aa10000,
|
||||
0x0008f6ff, 0x5ac20000, 0x0008ffff, 0x5ae20000,
|
||||
0x000c00ff, 0x62000000, 0x000c08ff, 0x62200000,
|
||||
0x000c10ff, 0x62400000, 0x000c18ff, 0x62610000,
|
||||
0x000c20ff, 0x62810000, 0x000c29ff, 0x62a10000,
|
||||
0x000c31ff, 0x62c20000, 0x000c39ff, 0x62e20000,
|
||||
0x000c41ff, 0x6a000000, 0x000c4aff, 0x6a200000,
|
||||
0x000c52ff, 0x6a400000, 0x000c5aff, 0x6a610000,
|
||||
0x000c62ff, 0x6a810000, 0x000c6aff, 0x6aa10000,
|
||||
0x000c73ff, 0x6ac20000, 0x000c7bff, 0x6ae20000,
|
||||
0x000c83ff, 0x73000000, 0x000c8bff, 0x73200000,
|
||||
0x000c94ff, 0x73400000, 0x000c9cff, 0x73610000,
|
||||
0x000ca4ff, 0x73810000, 0x000cacff, 0x73a10000,
|
||||
0x000cb4ff, 0x73c20000, 0x000cbdff, 0x73e20000,
|
||||
0x000cc5ff, 0x7b000000, 0x000ccdff, 0x7b200000,
|
||||
0x000cd5ff, 0x7b400000, 0x000cdeff, 0x7b610000,
|
||||
0x000ce6ff, 0x7b810000, 0x000ceeff, 0x7ba10000,
|
||||
0x000cf6ff, 0x7bc20000, 0x000cffff, 0x7be20000,
|
||||
0x001000ff, 0x83000000, 0x001008ff, 0x83200000,
|
||||
0x001010ff, 0x83400000, 0x001018ff, 0x83610000,
|
||||
0x001020ff, 0x83810000, 0x001029ff, 0x83a10000,
|
||||
0x001031ff, 0x83c20000, 0x001039ff, 0x83e20000,
|
||||
0x001041ff, 0x8b000000, 0x00104aff, 0x8b200000,
|
||||
0x001052ff, 0x8b400000, 0x00105aff, 0x8b610000,
|
||||
0x001062ff, 0x8b810000, 0x00106aff, 0x8ba10000,
|
||||
0x001073ff, 0x8bc20000, 0x00107bff, 0x8be20000,
|
||||
0x001083ff, 0x94000000, 0x00108bff, 0x94200000,
|
||||
0x001094ff, 0x94400000, 0x00109cff, 0x94610000,
|
||||
0x0010a4ff, 0x94810000, 0x0010acff, 0x94a10000,
|
||||
0x0010b4ff, 0x94c20000, 0x0010bdff, 0x94e20000,
|
||||
0x0010c5ff, 0x9c000000, 0x0010cdff, 0x9c200000,
|
||||
0x0010d5ff, 0x9c400000, 0x0010deff, 0x9c610000,
|
||||
0x0010e6ff, 0x9c810000, 0x0010eeff, 0x9ca10000,
|
||||
0x0010f6ff, 0x9cc20000, 0x0010ffff, 0x9ce20000,
|
||||
0x001400ff, 0xa4000000, 0x001408ff, 0xa4200000,
|
||||
0x001410ff, 0xa4400000, 0x001418ff, 0xa4610000,
|
||||
0x001420ff, 0xa4810000, 0x001429ff, 0xa4a10000,
|
||||
0x001431ff, 0xa4c20000, 0x001439ff, 0xa4e20000,
|
||||
0x001441ff, 0xac000000, 0x00144aff, 0xac200000,
|
||||
0x001452ff, 0xac400000, 0x00145aff, 0xac610000,
|
||||
0x001462ff, 0xac810000, 0x00146aff, 0xaca10000,
|
||||
0x001473ff, 0xacc20000, 0x00147bff, 0xace20000,
|
||||
0x001483ff, 0xb4000000, 0x00148bff, 0xb4200000,
|
||||
0x001494ff, 0xb4400000, 0x00149cff, 0xb4610000,
|
||||
0x0014a4ff, 0xb4810000, 0x0014acff, 0xb4a10000,
|
||||
0x0014b4ff, 0xb4c20000, 0x0014bdff, 0xb4e20000,
|
||||
0x0014c5ff, 0xbd000000, 0x0014cdff, 0xbd200000,
|
||||
0x0014d5ff, 0xbd400000, 0x0014deff, 0xbd610000,
|
||||
0x0014e6ff, 0xbd810000, 0x0014eeff, 0xbda10000,
|
||||
0x0014f6ff, 0xbdc20000, 0x0014ffff, 0xbde20000,
|
||||
0x001800ff, 0xc5000000, 0x001808ff, 0xc5200000,
|
||||
0x001810ff, 0xc5400000, 0x001818ff, 0xc5610000,
|
||||
0x001820ff, 0xc5810000, 0x001829ff, 0xc5a10000,
|
||||
0x001831ff, 0xc5c20000, 0x001839ff, 0xc5e20000,
|
||||
0x001841ff, 0xcd000000, 0x00184aff, 0xcd200000,
|
||||
0x001852ff, 0xcd400000, 0x00185aff, 0xcd610000,
|
||||
0x001862ff, 0xcd810000, 0x00186aff, 0xcda10000,
|
||||
0x001873ff, 0xcdc20000, 0x00187bff, 0xcde20000,
|
||||
0x001883ff, 0xd5000000, 0x00188bff, 0xd5200000,
|
||||
0x001894ff, 0xd5400000, 0x00189cff, 0xd5610000,
|
||||
0x0018a4ff, 0xd5810000, 0x0018acff, 0xd5a10000,
|
||||
0x0018b4ff, 0xd5c20000, 0x0018bdff, 0xd5e20000,
|
||||
0x0018c5ff, 0xde000000, 0x0018cdff, 0xde200000,
|
||||
0x0018d5ff, 0xde400000, 0x0018deff, 0xde610000,
|
||||
0x0018e6ff, 0xde810000, 0x0018eeff, 0xdea10000,
|
||||
0x0018f6ff, 0xdec20000, 0x0018ffff, 0xdee20000,
|
||||
0x001c00ff, 0xe6000000, 0x001c08ff, 0xe6200000,
|
||||
0x001c10ff, 0xe6400000, 0x001c18ff, 0xe6610000,
|
||||
0x001c20ff, 0xe6810000, 0x001c29ff, 0xe6a10000,
|
||||
0x001c31ff, 0xe6c20000, 0x001c39ff, 0xe6e20000,
|
||||
0x001c41ff, 0xee000000, 0x001c4aff, 0xee200000,
|
||||
0x001c52ff, 0xee400000, 0x001c5aff, 0xee610000,
|
||||
0x001c62ff, 0xee810000, 0x001c6aff, 0xeea10000,
|
||||
0x001c73ff, 0xeec20000, 0x001c7bff, 0xeee20000,
|
||||
0x001c83ff, 0xf6000000, 0x001c8bff, 0xf6200000,
|
||||
0x001c94ff, 0xf6400000, 0x001c9cff, 0xf6610000,
|
||||
0x001ca4ff, 0xf6810000, 0x001cacff, 0xf6a10000,
|
||||
0x001cb4ff, 0xf6c20000, 0x001cbdff, 0xf6e20000,
|
||||
0x001cc5ff, 0xff000000, 0x001ccdff, 0xff200000,
|
||||
0x001cd5ff, 0xff400000, 0x001cdeff, 0xff610000,
|
||||
0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000,
|
||||
0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000,
|
||||
};
|
||||
|
||||
static void rtgui_blit_line_2_3(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
rt_uint16_t *src;
|
||||
rt_uint32_t *dst;
|
||||
|
||||
src = (rt_uint16_t*)src_ptr;
|
||||
dst = (rt_uint32_t*)dst_ptr;
|
||||
|
||||
line = line / 2;
|
||||
while (line)
|
||||
{
|
||||
*dst++ = RGB565_RGBA8888_LUT[src[LO]*2] + RGB565_RGBA8888_LUT[src[HI]*2+1];
|
||||
line--;
|
||||
src ++;
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_blit_line_direct(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
rt_memcpy(dst_ptr, src_ptr, line);
|
||||
}
|
||||
|
||||
/* convert 4bpp to 3bpp */
|
||||
static void rtgui_blit_line_4_3(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
line = line / 4;
|
||||
while (line)
|
||||
{
|
||||
*dst_ptr++ = *src_ptr++;
|
||||
*dst_ptr++ = *src_ptr++;
|
||||
*dst_ptr++ = *src_ptr++;
|
||||
src_ptr ++;
|
||||
line --;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_blit_line_1_4(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
}
|
||||
|
||||
static void rtgui_blit_line_2_4(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
}
|
||||
|
||||
/* convert 3bpp to 4bpp */
|
||||
static void rtgui_blit_line_3_4(rt_uint8_t* dst_ptr, rt_uint8_t* src_ptr, int line)
|
||||
{
|
||||
line = line / 4;
|
||||
while (line)
|
||||
{
|
||||
*dst_ptr++ = *src_ptr++;
|
||||
*dst_ptr++ = *src_ptr++;
|
||||
*dst_ptr++ = *src_ptr++;
|
||||
*dst_ptr++ = 0;
|
||||
line --;
|
||||
}
|
||||
}
|
||||
|
||||
static const rtgui_blit_line_func _blit_table[5][5] =
|
||||
{
|
||||
/* 0_0, 1_0, 2_0, 3_0, 4_0 */
|
||||
{RT_NULL, RT_NULL, RT_NULL, RT_NULL, RT_NULL },
|
||||
/* 0_1, 1_1, 2_1, 3_1, 4_1 */
|
||||
{RT_NULL, rtgui_blit_line_direct, rtgui_blit_line_2_1, rtgui_blit_line_3_1, rtgui_blit_line_4_1 },
|
||||
/* 0_2, 1_2, 2_2, 3_2, 4_2 */
|
||||
{RT_NULL, rtgui_blit_line_1_2, rtgui_blit_line_direct, rtgui_blit_line_3_2, rtgui_blit_line_4_2 },
|
||||
/* 0_3, 1_3, 2_3, 3_3, 4_3 */
|
||||
{RT_NULL, rtgui_blit_line_1_3, rtgui_blit_line_2_3, rtgui_blit_line_direct, rtgui_blit_line_4_3 },
|
||||
/* 0_4, 1_4, 2_4, 3_4, 4_4 */
|
||||
{RT_NULL, rtgui_blit_line_1_4, rtgui_blit_line_2_4, rtgui_blit_line_3_4, rtgui_blit_line_direct },
|
||||
};
|
||||
|
||||
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp)
|
||||
{
|
||||
RT_ASSERT(dst_bpp>0 && dst_bpp < 5);
|
||||
RT_ASSERT(src_bpp>0 && src_bpp < 5);
|
||||
|
||||
return _blit_table[dst_bpp][src_bpp];
|
||||
}
|
||||
32
components/rtgui_win/common/color.c
Normal file
32
components/rtgui_win/common/color.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* File : color.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/color.h>
|
||||
|
||||
const rtgui_color_t red = RTGUI_RGB(0xff, 0x00, 0x00);
|
||||
const rtgui_color_t green = RTGUI_RGB(0x00, 0xff, 0x00);
|
||||
const rtgui_color_t blue = RTGUI_RGB(0x00, 0x00, 0xff);
|
||||
const rtgui_color_t black = RTGUI_RGB(0x00, 0x00, 0x00);
|
||||
const rtgui_color_t white = RTGUI_RGB(0xff, 0xff, 0xff);
|
||||
const rtgui_color_t yellow = RTGUI_RGB(0xff, 0xff, 0x00);
|
||||
const rtgui_color_t cyan = RTGUI_RGB(0x00, 80, 80); /*ÇŕÉŤ*/
|
||||
const rtgui_color_t purple = RTGUI_RGB(0xff, 0x00, 0xff); /*×ĎÉŤ*/
|
||||
|
||||
const rtgui_color_t high_light = RTGUI_RGB(0xff, 0xff, 0xff);
|
||||
const rtgui_color_t dark = RTGUI_RGB(0x40, 0x40, 0x40);
|
||||
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 selected_color = RTGUI_RGB(10, 36, 106);
|
||||
|
||||
|
||||
1283
components/rtgui_win/common/dc.c
Normal file
1283
components/rtgui_win/common/dc.c
Normal file
File diff suppressed because it is too large
Load Diff
323
components/rtgui_win/common/dc_buffer.c
Normal file
323
components/rtgui_win/common/dc_buffer.c
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
* File : dc_buffer.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/blit.h>
|
||||
#include <rtgui/dc_hw.h>
|
||||
#include <rtgui/color.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#define hw_driver (rtgui_graphic_driver_get_default())
|
||||
|
||||
struct rtgui_dc_buffer
|
||||
{
|
||||
struct rtgui_dc parent;
|
||||
|
||||
/* graphic context */
|
||||
rtgui_gc_t gc;
|
||||
|
||||
/* width and height */
|
||||
rt_uint16_t width, height;
|
||||
rt_uint16_t pitch;
|
||||
|
||||
/* blit info */
|
||||
rtgui_region_t clip;
|
||||
|
||||
/* pixel data */
|
||||
rt_uint8_t* pixel;
|
||||
};
|
||||
|
||||
static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc* dc);
|
||||
static void rtgui_dc_buffer_draw_point(struct rtgui_dc* dc, int x, int y);
|
||||
static void rtgui_dc_buffer_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgui_color_t color);
|
||||
static void rtgui_dc_buffer_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2);
|
||||
static void rtgui_dc_buffer_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y);
|
||||
static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* dc, struct rtgui_rect* rect);
|
||||
static void rtgui_dc_buffer_blit_line(struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data);
|
||||
static void rtgui_dc_buffer_blit(struct rtgui_dc* self, struct rtgui_point* dc_point,
|
||||
struct rtgui_dc* dest, rtgui_rect_t* rect);
|
||||
|
||||
static void rtgui_dc_buffer_set_gc (struct rtgui_dc* dc, rtgui_gc_t *gc);
|
||||
static rtgui_gc_t* rtgui_dc_buffer_get_gc(struct rtgui_dc* dc);
|
||||
|
||||
static rt_bool_t rtgui_dc_buffer_get_visible(struct rtgui_dc* dc);
|
||||
static void rtgui_dc_buffer_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
|
||||
const static struct rtgui_dc_engine dc_buffer_engine =
|
||||
{
|
||||
rtgui_dc_buffer_draw_point,
|
||||
rtgui_dc_buffer_draw_color_point,
|
||||
rtgui_dc_buffer_draw_vline,
|
||||
rtgui_dc_buffer_draw_hline,
|
||||
rtgui_dc_buffer_fill_rect,
|
||||
rtgui_dc_buffer_blit_line,
|
||||
rtgui_dc_buffer_blit,
|
||||
|
||||
rtgui_dc_buffer_set_gc,
|
||||
rtgui_dc_buffer_get_gc,
|
||||
|
||||
rtgui_dc_buffer_get_visible,
|
||||
rtgui_dc_buffer_get_rect,
|
||||
|
||||
rtgui_dc_buffer_fini,
|
||||
};
|
||||
|
||||
struct rtgui_dc* rtgui_dc_buffer_create(int w, int h)
|
||||
{
|
||||
struct rtgui_dc_buffer* dc;
|
||||
|
||||
dc = (struct rtgui_dc_buffer*)rtgui_malloc(sizeof(struct rtgui_dc_buffer));
|
||||
dc->parent.type = RTGUI_DC_BUFFER;
|
||||
dc->parent.engine = &dc_buffer_engine;
|
||||
dc->gc.foreground = default_foreground;
|
||||
dc->gc.background = default_background;
|
||||
dc->gc.font = rtgui_font_default();
|
||||
dc->gc.textalign = RTGUI_ALIGN_LEFT | RTGUI_ALIGN_TOP;
|
||||
|
||||
dc->width = w;
|
||||
dc->height = h;
|
||||
dc->pitch = w * sizeof(rtgui_color_t);
|
||||
|
||||
rtgui_region_init(&(dc->clip));
|
||||
|
||||
dc->pixel = rtgui_malloc(h * dc->pitch);
|
||||
rt_memset(dc->pixel, 0, h * dc->pitch);
|
||||
|
||||
return &(dc->parent);
|
||||
}
|
||||
|
||||
rt_uint8_t* rtgui_dc_buffer_get_pixel(struct rtgui_dc* dc)
|
||||
{
|
||||
struct rtgui_dc_buffer* dc_buffer;
|
||||
|
||||
dc_buffer = (struct rtgui_dc_buffer*)dc;
|
||||
|
||||
return dc_buffer->pixel;
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_buffer_fini(struct rtgui_dc* dc)
|
||||
{
|
||||
struct rtgui_dc_buffer* buffer = (struct rtgui_dc_buffer*)dc;
|
||||
|
||||
if (dc->type != RTGUI_DC_BUFFER) return RT_FALSE;
|
||||
|
||||
rtgui_free(buffer->pixel);
|
||||
buffer->pixel = RT_NULL;
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_draw_point(struct rtgui_dc* self, int x, int y)
|
||||
{
|
||||
rtgui_color_t* ptr;
|
||||
struct rtgui_dc_buffer* dc;
|
||||
|
||||
dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
/* note: there is no parameter check in this function */
|
||||
ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x * sizeof(rtgui_color_t));
|
||||
|
||||
*ptr = dc->gc.foreground;
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color)
|
||||
{
|
||||
rtgui_color_t* ptr;
|
||||
struct rtgui_dc_buffer* dc;
|
||||
|
||||
dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
/* note: there is no parameter check in this function */
|
||||
ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x * sizeof(rtgui_color_t));
|
||||
|
||||
*ptr = color;
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_draw_vline(struct rtgui_dc* self, int x, int y1, int y2)
|
||||
{
|
||||
rtgui_color_t* ptr;
|
||||
register rt_base_t index;
|
||||
struct rtgui_dc_buffer* dc;
|
||||
|
||||
dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
if (x >= dc->width) return;
|
||||
if (y1 > dc->height) y1 = dc->height;
|
||||
if (y2 > dc->height) y2 = dc->height;
|
||||
|
||||
ptr = (rtgui_color_t*)(dc->pixel + y1 * dc->pitch + x * sizeof(rtgui_color_t));
|
||||
for (index = y1; index < y2; index ++)
|
||||
{
|
||||
/* draw this point */
|
||||
*ptr = dc->gc.foreground;
|
||||
ptr += dc->width;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
|
||||
{
|
||||
rtgui_color_t* ptr;
|
||||
register rt_base_t index;
|
||||
struct rtgui_dc_buffer* dc;
|
||||
|
||||
dc = (struct rtgui_dc_buffer*)self;
|
||||
if (y >= dc->height) return;
|
||||
if (x1 > dc->width) x1 = dc->width;
|
||||
if (x2 > dc->width) x2 = dc->width;
|
||||
|
||||
ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x1 * sizeof(rtgui_color_t));
|
||||
for (index = x1; index < x2; index ++)
|
||||
{
|
||||
/* draw this point */
|
||||
*ptr++ = dc->gc.foreground;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
|
||||
{
|
||||
rtgui_rect_t r;
|
||||
struct rtgui_dc_buffer* dc;
|
||||
|
||||
r = *rect;
|
||||
dc = (struct rtgui_dc_buffer*)self;
|
||||
if (r.x1 > dc->width) r.x1 = dc->width;
|
||||
if (r.x2 > dc->width) r.x2 = dc->width;
|
||||
if (r.y1 > dc->height) r.y1 = dc->height;
|
||||
if (r.y2 > dc->height) r.y2 = dc->height;
|
||||
|
||||
/* fill first line */
|
||||
rtgui_dc_buffer_draw_hline(&(dc->parent), r.x1, r.x2, r.y1);
|
||||
|
||||
/* memory copy other lines */
|
||||
if (r.y2 > r.y1)
|
||||
{
|
||||
register rt_base_t index;
|
||||
for (index = r.y1 + 1; index < r.y2; index ++)
|
||||
{
|
||||
rt_memcpy(dc->pixel + index * dc->pitch,
|
||||
dc->pixel + r.y1 * dc->pitch,
|
||||
(r.x2 - r.x1) * sizeof(rtgui_color_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* blit a dc to a hardware dc */
|
||||
static void rtgui_dc_buffer_blit(struct rtgui_dc* self, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect)
|
||||
{
|
||||
struct rtgui_dc_buffer* dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
if (dc_point == RT_NULL) dc_point = &rtgui_empty_point;
|
||||
if (rtgui_dc_get_visible(dest) == RT_FALSE) return;
|
||||
|
||||
if ((dest->type == RTGUI_DC_HW) || (dest->type == RTGUI_DC_CLIENT))
|
||||
{
|
||||
rt_uint8_t *line_ptr, *pixels;
|
||||
rt_uint16_t rect_width, rect_height, index, pitch;
|
||||
rtgui_blit_line_func blit_line;
|
||||
|
||||
/* calculate correct width and height */
|
||||
if (rtgui_rect_width(*rect) > (dc->width - dc_point->x))
|
||||
rect_width = dc->width - dc_point->x;
|
||||
else
|
||||
rect_width = rtgui_rect_width(*rect);
|
||||
|
||||
if (rtgui_rect_height(*rect) > (dc->height - dc_point->y))
|
||||
rect_height = dc->height - dc_point->y;
|
||||
else
|
||||
rect_height = rtgui_rect_height(*rect);
|
||||
|
||||
/* prepare pixel line */
|
||||
pixels = dc->pixel + dc_point->y * dc->pitch + dc_point->x * sizeof(rtgui_color_t);
|
||||
|
||||
if (hw_driver->byte_per_pixel == sizeof(rtgui_color_t))
|
||||
{
|
||||
/* it's the same byte per pixel, draw it directly */
|
||||
for (index = rect->y1; index < rect->y1 + rect_height; index++)
|
||||
{
|
||||
dest->engine->blit_line(dest, rect->x1, rect->x1 + rect_width, index, pixels);
|
||||
pixels += dc->width * sizeof(rtgui_color_t);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get blit line function */
|
||||
blit_line = rtgui_blit_line_get(hw_driver->byte_per_pixel, 4);
|
||||
/* calculate pitch */
|
||||
pitch = rect_width * sizeof(rtgui_color_t);
|
||||
/* create line buffer */
|
||||
line_ptr = (rt_uint8_t*) rtgui_malloc(rect_width * hw_driver->byte_per_pixel);
|
||||
|
||||
/* draw each line */
|
||||
for (index = rect->y1; index < rect->y1 + rect_height; index ++)
|
||||
{
|
||||
/* blit on line buffer */
|
||||
blit_line(line_ptr, (rt_uint8_t*)pixels, pitch);
|
||||
pixels += dc->width * sizeof(rtgui_color_t);
|
||||
|
||||
/* draw on hardware dc */
|
||||
dest->engine->blit_line(dest, rect->x1, rect->x1 + rect_width, index, line_ptr);
|
||||
}
|
||||
|
||||
/* release line buffer */
|
||||
rtgui_free(line_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_blit_line(struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data)
|
||||
{
|
||||
rtgui_color_t* color_ptr;
|
||||
struct rtgui_dc_buffer* dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
RT_ASSERT(dc != RT_NULL);
|
||||
RT_ASSERT(line_data != RT_NULL);
|
||||
|
||||
/* out of range */
|
||||
if ((x1 > dc->width) || (y > dc->height)) return;
|
||||
/* check range */
|
||||
if (x2 > dc->width) x2 = dc->width;
|
||||
|
||||
color_ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x1 * sizeof(rtgui_color_t));
|
||||
rt_memcpy(color_ptr, line_data, (x2 - x1) * sizeof(rtgui_color_t));
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_set_gc(struct rtgui_dc* self, rtgui_gc_t *gc)
|
||||
{
|
||||
struct rtgui_dc_buffer* dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
dc->gc = *gc;
|
||||
}
|
||||
|
||||
static rtgui_gc_t *rtgui_dc_buffer_get_gc(struct rtgui_dc* self)
|
||||
{
|
||||
struct rtgui_dc_buffer* dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
return &dc->gc;
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_buffer_get_visible(struct rtgui_dc* dc)
|
||||
{
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static void rtgui_dc_buffer_get_rect(struct rtgui_dc* self, rtgui_rect_t* rect)
|
||||
{
|
||||
struct rtgui_dc_buffer* dc = (struct rtgui_dc_buffer*)self;
|
||||
|
||||
rect->x1 = rect->y1 = 0;
|
||||
|
||||
rect->x2 = dc->width;
|
||||
rect->y2 = dc->height;
|
||||
}
|
||||
|
||||
442
components/rtgui_win/common/dc_client.c
Normal file
442
components/rtgui_win/common/dc_client.c
Normal file
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* File : dc_client.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
* 2010-08-09 Bernard rename hardware dc to client dc
|
||||
* 2010-09-13 Bernard fix rtgui_dc_client_blit_line issue, which found
|
||||
* by appele
|
||||
* 2010-09-14 Bernard fix vline and hline coordinate issue
|
||||
*/
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/dc_hw.h>
|
||||
#include <rtgui/dc_client.h>
|
||||
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/widgets/view.h>
|
||||
#include <rtgui/widgets/window.h>
|
||||
#include <panel.h>
|
||||
|
||||
static void rtgui_dc_client_draw_point(struct rtgui_dc* dc, int x, int y);
|
||||
static void rtgui_dc_client_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgui_color_t color);
|
||||
static void rtgui_dc_client_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y);
|
||||
static void rtgui_dc_client_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2);
|
||||
static void rtgui_dc_client_fill_rect (struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
static void rtgui_dc_client_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data);
|
||||
static void rtgui_dc_client_blit (struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect);
|
||||
static void rtgui_dc_client_set_gc (struct rtgui_dc* dc, rtgui_gc_t *gc);
|
||||
static rtgui_gc_t *rtgui_dc_client_get_gc (struct rtgui_dc* dc);
|
||||
static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc);
|
||||
static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc* dc);
|
||||
static void rtgui_dc_client_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
|
||||
#define hw_driver (rtgui_graphic_driver_get_default())
|
||||
#define dc_set_foreground(c) dc->gc.foreground = c
|
||||
#define dc_set_background(c) dc->gc.background = c
|
||||
#define _int_swap(x, y) do {x ^= y; y ^= x; x ^= y;} while (0)
|
||||
|
||||
struct rtgui_dc* rtgui_dc_begin_drawing(PVOID wdt)
|
||||
{
|
||||
rtgui_widget_t *owner = (rtgui_widget_t*)wdt;
|
||||
|
||||
RT_ASSERT(owner != RT_NULL);
|
||||
|
||||
if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
|
||||
rtgui_rect_is_equal(&(owner->extent), &(owner->clip.extents)) == RT_EOK)
|
||||
{
|
||||
/* use hardware DC */
|
||||
return rtgui_dc_hw_create(owner);
|
||||
}
|
||||
|
||||
return rtgui_dc_client_create(owner);
|
||||
}
|
||||
|
||||
void rtgui_dc_end_drawing(struct rtgui_dc* dc)
|
||||
{
|
||||
dc->engine->fini(dc);
|
||||
}
|
||||
|
||||
const struct rtgui_dc_engine dc_client_engine =
|
||||
{
|
||||
rtgui_dc_client_draw_point,
|
||||
rtgui_dc_client_draw_color_point,
|
||||
rtgui_dc_client_draw_vline,
|
||||
rtgui_dc_client_draw_hline,
|
||||
rtgui_dc_client_fill_rect,
|
||||
rtgui_dc_client_blit_line,
|
||||
rtgui_dc_client_blit,
|
||||
|
||||
rtgui_dc_client_set_gc,
|
||||
rtgui_dc_client_get_gc,
|
||||
|
||||
rtgui_dc_client_get_visible,
|
||||
rtgui_dc_client_get_rect,
|
||||
|
||||
rtgui_dc_client_fini,
|
||||
};
|
||||
|
||||
void rtgui_dc_client_init(rtgui_widget_t* owner)
|
||||
{
|
||||
struct rtgui_dc* dc;
|
||||
|
||||
RT_ASSERT(owner != RT_NULL);
|
||||
|
||||
dc = RTGUI_WIDGET_DC(owner);
|
||||
dc->type = RTGUI_DC_CLIENT;
|
||||
dc->engine = &dc_client_engine;
|
||||
}
|
||||
|
||||
extern struct rt_mutex cursor_mutex;
|
||||
extern void rtgui_mouse_show_cursor(void);
|
||||
extern void rtgui_mouse_hide_cursor(void);
|
||||
struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner)
|
||||
{
|
||||
struct rtgui_dc* dc;
|
||||
rtgui_widget_t* widget;
|
||||
|
||||
/* adjudge owner */
|
||||
if(owner == RT_NULL)return RT_NULL;
|
||||
|
||||
dc = RTGUI_WIDGET_DC(owner);
|
||||
/* set init visible as true */
|
||||
RTGUI_WIDGET_DC_SET_VISIBLE(owner);
|
||||
|
||||
/* check widget visible */
|
||||
widget = owner;
|
||||
while (widget != RT_NULL)
|
||||
{
|
||||
if (RTGUI_WIDGET_IS_HIDE(widget))
|
||||
{
|
||||
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
|
||||
break;
|
||||
}
|
||||
|
||||
widget = widget->parent;
|
||||
}
|
||||
|
||||
return dc;
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_client_fini(struct rtgui_dc* dc)
|
||||
{
|
||||
// rtgui_widget_t* owner;
|
||||
//
|
||||
// if (dc == RT_NULL || dc->type != RTGUI_DC_CLIENT) return RT_FALSE;
|
||||
//
|
||||
// /* get owner */
|
||||
// owner = RTGUI_CONTAINER_OF(dc, struct rtgui_widget, dc_type);
|
||||
|
||||
// if(RTGUI_WIDGET_IS_DC_VISIBLE(owner))
|
||||
// {
|
||||
// /* send to server to end drawing */
|
||||
// rtgui_event_update_t eupdate;
|
||||
// RTGUI_EVENT_UPDATE_INIT(&(eupdate));
|
||||
// eupdate.rect = owner->extent;
|
||||
//
|
||||
// rtgui_thread_send(rtgui_thread_get_server(), (struct rtgui_event*)&eupdate, sizeof(eupdate));
|
||||
// }
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* draw a logic point on device
|
||||
*/
|
||||
static void rtgui_dc_client_draw_point(struct rtgui_dc* self, int x, int y)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
|
||||
|
||||
x = x + owner->extent.x1;
|
||||
y = y + owner->extent.y1;
|
||||
|
||||
if (rtgui_region_contains_point(&(owner->clip), x, y, &rect) == RT_EOK)
|
||||
{
|
||||
/* draw this point */
|
||||
hw_driver->set_pixel(&(owner->gc.foreground), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_client_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
|
||||
|
||||
x = x + owner->extent.x1;
|
||||
y = y + owner->extent.y1;
|
||||
|
||||
if (rtgui_region_contains_point(&(owner->clip), x, y, &rect) == RT_EOK)
|
||||
{
|
||||
/* draw this point */
|
||||
hw_driver->set_pixel(&color, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* draw a logic vertical line on device
|
||||
*/
|
||||
static void rtgui_dc_client_draw_vline(struct rtgui_dc* self, int x, int y1, int y2)
|
||||
{
|
||||
register rt_base_t index;
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
|
||||
|
||||
x = x + owner->extent.x1;
|
||||
y1 = y1 + owner->extent.y1;
|
||||
y2 = y2 + owner->extent.y1;
|
||||
if (y1 > y2) _int_swap(y1, y2);
|
||||
|
||||
if (owner->clip.data == RT_NULL)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
|
||||
prect = &(owner->clip.extents);
|
||||
|
||||
/* calculate vline intersect */
|
||||
if (prect->x1 > x || prect->x2 <= x) return;
|
||||
if (prect->y2 <= y1 || prect->y1 > y2) return;
|
||||
|
||||
if (prect->y1 > y1) y1 = prect->y1;
|
||||
if (prect->y2 < y2) y2 = prect->y2;
|
||||
|
||||
/* draw vline */
|
||||
hw_driver->draw_vline(&(owner->gc.foreground), x, y1, y2);
|
||||
}
|
||||
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
register rt_base_t draw_y1, draw_y2;
|
||||
|
||||
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
|
||||
draw_y1 = y1;
|
||||
draw_y2 = y2;
|
||||
|
||||
/* calculate vline clip */
|
||||
if (prect->x1 > x || prect->x2 <= x) continue;
|
||||
if (prect->y2 <= y1 || prect->y1 > y2) continue;
|
||||
|
||||
if (prect->y1 > y1) draw_y1 = prect->y1;
|
||||
if (prect->y2 < y2) draw_y2 = prect->y2;
|
||||
|
||||
/* draw vline */
|
||||
hw_driver->draw_vline(&(owner->gc.foreground), x, draw_y1, draw_y2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* draw a logic horizontal line on device
|
||||
*/
|
||||
static void rtgui_dc_client_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
|
||||
{
|
||||
register rt_base_t index;
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
|
||||
|
||||
/* convert logic to device */
|
||||
x1 = x1 + owner->extent.x1;
|
||||
x2 = x2 + owner->extent.x1;
|
||||
if (x1 > x2) _int_swap(x1, x2);
|
||||
y = y + owner->extent.y1;
|
||||
|
||||
if (owner->clip.data == RT_NULL)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
|
||||
prect = &(owner->clip.extents);
|
||||
|
||||
/* calculate vline intersect */
|
||||
if (prect->y1 > y || prect->y2 <= y ) return;
|
||||
if (prect->x2 <= x1 || prect->x1 > x2) return;
|
||||
|
||||
if (prect->x1 > x1) x1 = prect->x1;
|
||||
if (prect->x2 < x2) x2 = prect->x2;
|
||||
|
||||
/* draw hline */
|
||||
hw_driver->draw_hline(&(owner->gc.foreground), x1, x2, y);
|
||||
}
|
||||
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
register rt_base_t draw_x1, draw_x2;
|
||||
|
||||
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
|
||||
draw_x1 = x1;
|
||||
draw_x2 = x2;
|
||||
|
||||
/* calculate hline clip */
|
||||
if (prect->y1 > y || prect->y2 <= y ) continue;
|
||||
if (prect->x2 <= x1 || prect->x1 > x2) continue;
|
||||
|
||||
if (prect->x1 > x1) draw_x1 = prect->x1;
|
||||
if (prect->x2 < x2) draw_x2 = prect->x2;
|
||||
|
||||
/* draw hline */
|
||||
hw_driver->draw_hline(&(owner->gc.foreground), draw_x1, draw_x2, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_client_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
|
||||
{
|
||||
rtgui_color_t foreground;
|
||||
register rt_base_t index;
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
|
||||
|
||||
/* save foreground color */
|
||||
foreground = owner->gc.foreground;
|
||||
|
||||
/* set background color as foreground color */
|
||||
owner->gc.foreground = owner->gc.background;
|
||||
|
||||
/* fill rect */
|
||||
for (index = rect->y1; index < rect->y2; index ++)
|
||||
{
|
||||
rtgui_dc_client_draw_hline(self, rect->x1, rect->x2, index);
|
||||
}
|
||||
|
||||
/* restore foreground color */
|
||||
owner->gc.foreground = foreground;
|
||||
}
|
||||
|
||||
static void rtgui_dc_client_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data)
|
||||
{
|
||||
register rt_base_t index;
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return;
|
||||
|
||||
/* convert logic to device */
|
||||
x1 = x1 + owner->extent.x1;
|
||||
x2 = x2 + owner->extent.x1;
|
||||
if (x1 > x2) _int_swap(x1, x2);
|
||||
y = y + owner->extent.y1;
|
||||
|
||||
if (rtgui_region_is_flat(&(owner->clip)) == RT_EOK)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
|
||||
prect = &(owner->clip.extents);
|
||||
|
||||
/* calculate vline intersect */
|
||||
if (prect->y1 > y || prect->y2 <= y ) return;
|
||||
if (prect->x2 <= x1 || prect->x1 > x2) return;
|
||||
|
||||
if (prect->x1 > x1) x1 = prect->x1;
|
||||
if (prect->x2 < x2) x2 = prect->x2;
|
||||
|
||||
/* draw hline */
|
||||
hw_driver->draw_raw_hline(line_data, x1, x2, y);
|
||||
}
|
||||
else for (index = 0; index < rtgui_region_num_rects(&(owner->clip)); index ++)
|
||||
{
|
||||
rtgui_rect_t* prect;
|
||||
register rt_base_t draw_x1, draw_x2;
|
||||
|
||||
prect = ((rtgui_rect_t *)(owner->clip.data + index + 1));
|
||||
draw_x1 = x1;
|
||||
draw_x2 = x2;
|
||||
|
||||
/* calculate hline clip */
|
||||
if (prect->y1 > y || prect->y2 <= y ) continue;
|
||||
if (prect->x2 <= x1 || prect->x1 > x2) continue;
|
||||
|
||||
if (prect->x1 > x1) draw_x1 = prect->x1;
|
||||
if (prect->x2 < x2) draw_x2 = prect->x2;
|
||||
|
||||
/* draw hline */
|
||||
hw_driver->draw_raw_hline(line_data + (draw_x1 - x1) * hw_driver->byte_per_pixel, draw_x1, draw_x2, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_client_blit(struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect)
|
||||
{
|
||||
/* not blit in hardware dc */
|
||||
return ;
|
||||
}
|
||||
|
||||
static void rtgui_dc_client_set_gc(struct rtgui_dc* self, rtgui_gc_t *gc)
|
||||
{
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
owner->gc = *gc;
|
||||
}
|
||||
|
||||
static rtgui_gc_t* rtgui_dc_client_get_gc(struct rtgui_dc* self)
|
||||
{
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
|
||||
return &(owner->gc);
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_client_get_visible(struct rtgui_dc* self)
|
||||
{
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return RT_FALSE;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return RT_FALSE;
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static void rtgui_dc_client_get_rect(struct rtgui_dc* self, rtgui_rect_t* rect)
|
||||
{
|
||||
rtgui_widget_t *owner;
|
||||
|
||||
if (self == RT_NULL) return;
|
||||
|
||||
/* get owner */
|
||||
owner = RTGUI_CONTAINER_OF(self, struct rtgui_widget, dc_type);
|
||||
rtgui_widget_get_rect(owner, rect);
|
||||
}
|
||||
|
||||
267
components/rtgui_win/common/dc_hw.c
Normal file
267
components/rtgui_win/common/dc_hw.c
Normal file
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* File : dc_hw.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/dc_hw.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/widgets/view.h>
|
||||
#include <rtgui/widgets/window.h>
|
||||
|
||||
static void rtgui_dc_hw_draw_point(struct rtgui_dc* dc, int x, int y);
|
||||
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgui_color_t color);
|
||||
static void rtgui_dc_hw_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y);
|
||||
static void rtgui_dc_hw_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2);
|
||||
static void rtgui_dc_hw_fill_rect (struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data);
|
||||
static void rtgui_dc_hw_blit (struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect);
|
||||
static void rtgui_dc_hw_set_gc (struct rtgui_dc* dc, rtgui_gc_t *gc);
|
||||
static rtgui_gc_t *rtgui_dc_hw_get_gc (struct rtgui_dc* dc);
|
||||
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc);
|
||||
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc* dc);
|
||||
static void rtgui_dc_hw_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
|
||||
struct rtgui_dc_hw
|
||||
{
|
||||
struct rtgui_dc parent;
|
||||
rtgui_widget_t *owner;
|
||||
const struct rtgui_graphic_driver* hw_driver;
|
||||
};
|
||||
|
||||
const struct rtgui_dc_engine dc_hw_engine =
|
||||
{
|
||||
rtgui_dc_hw_draw_point,
|
||||
rtgui_dc_hw_draw_color_point,
|
||||
rtgui_dc_hw_draw_vline,
|
||||
rtgui_dc_hw_draw_hline,
|
||||
rtgui_dc_hw_fill_rect,
|
||||
rtgui_dc_hw_blit_line,
|
||||
rtgui_dc_hw_blit,
|
||||
|
||||
rtgui_dc_hw_set_gc,
|
||||
rtgui_dc_hw_get_gc,
|
||||
|
||||
rtgui_dc_hw_get_visible,
|
||||
rtgui_dc_hw_get_rect,
|
||||
|
||||
rtgui_dc_hw_fini,
|
||||
};
|
||||
|
||||
extern struct rt_mutex cursor_mutex;
|
||||
extern void rtgui_mouse_show_cursor(void);
|
||||
extern void rtgui_mouse_hide_cursor(void);
|
||||
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
rtgui_widget_t* widget;
|
||||
|
||||
/* adjudge owner */
|
||||
if (owner == RT_NULL) return RT_NULL;
|
||||
|
||||
/* set init visible as true */
|
||||
RTGUI_WIDGET_DC_SET_VISIBLE(owner);
|
||||
/* check widget visible */
|
||||
widget = owner;
|
||||
while (widget != RT_NULL)
|
||||
{
|
||||
if (RTGUI_WIDGET_IS_HIDE(widget))
|
||||
{
|
||||
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
|
||||
break;
|
||||
}
|
||||
|
||||
widget = widget->parent;
|
||||
}
|
||||
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return RT_NULL;
|
||||
|
||||
/* create DC */
|
||||
dc = (struct rtgui_dc_hw*) rtgui_malloc(sizeof(struct rtgui_dc_hw));
|
||||
if(dc == RT_NULL)return RT_NULL;
|
||||
|
||||
dc->parent.type = RTGUI_DC_HW;
|
||||
dc->parent.engine = &dc_hw_engine;
|
||||
dc->owner = owner;
|
||||
dc->hw_driver = rtgui_graphic_driver_get_default();
|
||||
|
||||
return &(dc->parent);
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
|
||||
{
|
||||
struct rtgui_dc_hw* self;
|
||||
|
||||
if (dc == RT_NULL || dc->type != RTGUI_DC_HW) return RT_FALSE;
|
||||
|
||||
self = (struct rtgui_dc_hw*)dc;
|
||||
|
||||
/* release hardware dc */
|
||||
rtgui_free(self);
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* draw a logic point on device
|
||||
*/
|
||||
static void rtgui_dc_hw_draw_point(struct rtgui_dc* self, int x, int y)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
x = x + dc->owner->extent.x1;
|
||||
y = y + dc->owner->extent.y1;
|
||||
|
||||
/* draw this point */
|
||||
dc->hw_driver->set_pixel(&(dc->owner->gc.foreground), x, y);
|
||||
}
|
||||
|
||||
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
x = x + dc->owner->extent.x1;
|
||||
y = y + dc->owner->extent.y1;
|
||||
|
||||
/* draw this point */
|
||||
dc->hw_driver->set_pixel(&color, x, y);
|
||||
}
|
||||
|
||||
/*
|
||||
* draw a logic vertical line on device
|
||||
*/
|
||||
static void rtgui_dc_hw_draw_vline(struct rtgui_dc* self, int x, int y1, int y2)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
x = x + dc->owner->extent.x1;
|
||||
y1 = y1 + dc->owner->extent.y1;
|
||||
y2 = y2 + dc->owner->extent.y1;
|
||||
|
||||
/* draw vline */
|
||||
dc->hw_driver->draw_vline(&(dc->owner->gc.foreground), x, y1, y2);
|
||||
}
|
||||
|
||||
/*
|
||||
* draw a logic horizontal line on device
|
||||
*/
|
||||
static void rtgui_dc_hw_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
/* convert logic to device */
|
||||
x1 = x1 + dc->owner->extent.x1;
|
||||
x2 = x2 + dc->owner->extent.x1;
|
||||
y = y + dc->owner->extent.y1;
|
||||
|
||||
/* draw hline */
|
||||
dc->hw_driver->draw_hline(&(dc->owner->gc.foreground), x1, x2, y);
|
||||
}
|
||||
|
||||
static void rtgui_dc_hw_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
|
||||
{
|
||||
rtgui_color_t color;
|
||||
register rt_base_t index, x1, x2;
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
/* get background color */
|
||||
color = dc->owner->gc.background;
|
||||
/* convert logic to device */
|
||||
x1 = rect->x1 + dc->owner->extent.x1;
|
||||
x2 = rect->x2 + dc->owner->extent.x1;
|
||||
|
||||
/* fill rect */
|
||||
for (index = dc->owner->extent.y1 + rect->y1; index < dc->owner->extent.y1 + rect->y2; index ++)
|
||||
{
|
||||
dc->hw_driver->draw_hline(&color, x1, x2, index);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
/* convert logic to device */
|
||||
x1 = x1 + dc->owner->extent.x1;
|
||||
x2 = x2 + dc->owner->extent.x1;
|
||||
y = y + dc->owner->extent.y1;
|
||||
|
||||
dc->hw_driver->draw_raw_hline(line_data, x1, x2, y);
|
||||
}
|
||||
|
||||
static void rtgui_dc_hw_blit(struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect)
|
||||
{
|
||||
/* not blit in hardware dc */
|
||||
return ;
|
||||
}
|
||||
|
||||
static void rtgui_dc_hw_set_gc(struct rtgui_dc* self, rtgui_gc_t *gc)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
/* set gc */
|
||||
dc->owner->gc = *gc;
|
||||
}
|
||||
|
||||
static rtgui_gc_t* rtgui_dc_hw_get_gc(struct rtgui_dc* self)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
return &(dc->owner->gc);
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc* self)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
if (!RTGUI_WIDGET_IS_DC_VISIBLE(dc->owner)) return RT_FALSE;
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static void rtgui_dc_hw_get_rect(struct rtgui_dc* self, rtgui_rect_t* rect)
|
||||
{
|
||||
struct rtgui_dc_hw* dc;
|
||||
|
||||
RT_ASSERT(self != RT_NULL);
|
||||
dc = (struct rtgui_dc_hw*) self;
|
||||
|
||||
/* get owner */
|
||||
rtgui_widget_get_rect(dc->owner, rect);
|
||||
}
|
||||
463
components/rtgui_win/common/filerw.c
Normal file
463
components/rtgui_win/common/filerw.c
Normal file
@@ -0,0 +1,463 @@
|
||||
/*
|
||||
* File : filerw.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtgui/filerw.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
#include <dfs_posix.h>
|
||||
|
||||
/* standard file read/write */
|
||||
struct rtgui_filerw_stdio
|
||||
{
|
||||
/* inherit from rtgui_filerw */
|
||||
struct rtgui_filerw parent;
|
||||
|
||||
int fd;
|
||||
rt_bool_t eof;
|
||||
};
|
||||
|
||||
static int stdio_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
int stdio_whence[3] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
|
||||
if (whence < RTGUI_FILE_SEEK_SET || whence > RTGUI_FILE_SEEK_END)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return lseek(stdio_filerw->fd, offset, stdio_whence[whence]);
|
||||
}
|
||||
|
||||
static int stdio_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, rt_size_t maxnum)
|
||||
{
|
||||
int result;
|
||||
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
/* end of file */
|
||||
if (stdio_filerw->eof == RT_TRUE) return -1;
|
||||
|
||||
result = read(stdio_filerw->fd, ptr, size * maxnum);
|
||||
if (result == 0) stdio_filerw->eof = RT_TRUE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int stdio_write(struct rtgui_filerw *context, const void *ptr, rt_size_t size, rt_size_t num)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
return write(stdio_filerw->fd, (char*)ptr, size * num);
|
||||
}
|
||||
|
||||
static int stdio_tell(struct rtgui_filerw* context)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
return lseek(stdio_filerw->fd, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
static int stdio_eof(struct rtgui_filerw* context)
|
||||
{
|
||||
int result;
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
if (stdio_filerw->eof == RT_TRUE) result = 1;
|
||||
else result = -1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int stdio_close(struct rtgui_filerw *context)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
if (stdio_filerw)
|
||||
{
|
||||
close(stdio_filerw->fd);
|
||||
rtgui_free(stdio_filerw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#elif defined(RTGUI_USING_STDIO_FILERW)
|
||||
#include <stdio.h>
|
||||
|
||||
/* standard file read/write */
|
||||
struct rtgui_filerw_stdio
|
||||
{
|
||||
/* inherit from rtgui_filerw */
|
||||
struct rtgui_filerw parent;
|
||||
|
||||
FILE* fp;
|
||||
};
|
||||
|
||||
static int stdio_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
int stdio_whence[3] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
|
||||
if (whence < RTGUI_FILE_SEEK_SET || whence > RTGUI_FILE_SEEK_END)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fseek(stdio_filerw->fp, offset, stdio_whence[whence]) == 0)
|
||||
{
|
||||
return ftell(stdio_filerw->fp);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int stdio_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, rt_size_t maxnum)
|
||||
{
|
||||
size_t nread;
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
nread = fread(ptr, size, maxnum, stdio_filerw->fp);
|
||||
if (nread == 0 && ferror(stdio_filerw->fp))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
static int stdio_write(struct rtgui_filerw *context, const void *ptr, rt_size_t size, rt_size_t num)
|
||||
{
|
||||
size_t nwrote;
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
nwrote = fwrite(ptr, size, num, stdio_filerw->fp);
|
||||
|
||||
if ( nwrote == 0 && ferror(stdio_filerw->fp) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return nwrote;
|
||||
}
|
||||
|
||||
static int stdio_tell(struct rtgui_filerw* context)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
return ftell(stdio_filerw->fp);
|
||||
}
|
||||
|
||||
static int stdio_eof(struct rtgui_filerw* context)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
return feof(stdio_filerw->fp);
|
||||
}
|
||||
|
||||
static int stdio_close(struct rtgui_filerw *context)
|
||||
{
|
||||
struct rtgui_filerw_stdio* stdio_filerw = (struct rtgui_filerw_stdio *)context;
|
||||
|
||||
if (stdio_filerw)
|
||||
{
|
||||
fclose(stdio_filerw->fp);
|
||||
rtgui_free(stdio_filerw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* memory file read/write */
|
||||
struct rtgui_filerw_mem
|
||||
{
|
||||
/* inherit from rtgui_filerw */
|
||||
struct rtgui_filerw parent;
|
||||
|
||||
const rt_uint8_t *mem_base, *mem_position, *mem_end;
|
||||
};
|
||||
|
||||
static int mem_seek(struct rtgui_filerw *context, rt_off_t offset, int whence)
|
||||
{
|
||||
const rt_uint8_t* newpos;
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
RT_ASSERT(mem != RT_NULL);
|
||||
|
||||
switch (whence) {
|
||||
case RTGUI_FILE_SEEK_SET:
|
||||
newpos = mem->mem_base + offset;
|
||||
break;
|
||||
|
||||
case RTGUI_FILE_SEEK_CUR:
|
||||
newpos = mem->mem_position + offset;
|
||||
break;
|
||||
|
||||
case RTGUI_FILE_SEEK_END:
|
||||
newpos = mem->mem_end + offset;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( newpos < mem->mem_base )
|
||||
newpos = mem->mem_base;
|
||||
|
||||
if ( newpos > mem->mem_end )
|
||||
newpos = mem->mem_end;
|
||||
|
||||
mem->mem_position = newpos;
|
||||
return mem->mem_position- mem->mem_base;
|
||||
}
|
||||
|
||||
static int mem_read(struct rtgui_filerw *context, void *ptr, rt_size_t size, rt_size_t maxnum)
|
||||
{
|
||||
int total_bytes;
|
||||
int mem_available;
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
total_bytes = (maxnum * size);
|
||||
if ( (maxnum <= 0) || (size <= 0) || ((total_bytes / maxnum) != size) )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
mem_available = mem->mem_end - mem->mem_position;
|
||||
if (total_bytes > mem_available)
|
||||
total_bytes = mem_available;
|
||||
|
||||
rt_memcpy(ptr, mem->mem_position, total_bytes);
|
||||
mem->mem_position += total_bytes;
|
||||
|
||||
return (total_bytes / size);
|
||||
}
|
||||
|
||||
static int mem_write(struct rtgui_filerw *context, const void *ptr, rt_size_t size, rt_size_t num)
|
||||
{
|
||||
#if 0
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
if ((mem->mem_position + (num * size)) > mem->mem_end)
|
||||
{
|
||||
num = (mem->mem_end - mem->mem_position)/size;
|
||||
}
|
||||
|
||||
rt_memcpy(mem->mem_position, ptr, num*size);
|
||||
mem->mem_position += num*size;
|
||||
|
||||
return num;
|
||||
#else
|
||||
return 0; /* not support memory write */
|
||||
#endif
|
||||
}
|
||||
|
||||
static int mem_tell(struct rtgui_filerw* context)
|
||||
{
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
return mem->mem_position - mem->mem_base;
|
||||
}
|
||||
|
||||
static int mem_eof(struct rtgui_filerw* context)
|
||||
{
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
return mem->mem_position >= mem->mem_end;
|
||||
}
|
||||
|
||||
static int mem_close(struct rtgui_filerw *context)
|
||||
{
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
if (mem != RT_NULL)
|
||||
{
|
||||
rtgui_free(mem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context)
|
||||
{
|
||||
struct rtgui_filerw_mem* mem = (struct rtgui_filerw_mem*)context;
|
||||
|
||||
/* check whether it's a memory filerw */
|
||||
if (mem->parent.read != mem_read) return RT_NULL;
|
||||
|
||||
return mem->mem_base;
|
||||
}
|
||||
|
||||
/* file read/write public interface */
|
||||
#ifdef RTGUI_USING_DFS_FILERW
|
||||
static int parse_mode(const char *mode)
|
||||
{
|
||||
int f=0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
switch (*mode)
|
||||
{
|
||||
case 0: return f;
|
||||
case 'b': break;
|
||||
case 'r': f=O_RDONLY; break;
|
||||
case 'w': f=O_WRONLY|O_CREAT|O_TRUNC; break;
|
||||
case 'a': f=O_WRONLY|O_CREAT|O_APPEND; break;
|
||||
case '+': f=(f&(~O_WRONLY))|O_RDWR; break;
|
||||
}
|
||||
|
||||
++mode;
|
||||
}
|
||||
}
|
||||
|
||||
struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char* mode)
|
||||
{
|
||||
int fd;
|
||||
struct rtgui_filerw_stdio *rw;
|
||||
|
||||
RT_ASSERT(filename != RT_NULL);
|
||||
|
||||
rw = RT_NULL;
|
||||
fd = open(filename, parse_mode(mode), 0);
|
||||
|
||||
if ( fd >= 0 )
|
||||
{
|
||||
rw = (struct rtgui_filerw_stdio*) rtgui_malloc(sizeof(struct rtgui_filerw_stdio));
|
||||
if (rw != RT_NULL)
|
||||
{
|
||||
rw->parent.seek = stdio_seek;
|
||||
rw->parent.read = stdio_read;
|
||||
rw->parent.write = stdio_write;
|
||||
rw->parent.tell = stdio_tell;
|
||||
rw->parent.close = stdio_close;
|
||||
rw->parent.eof = stdio_eof;
|
||||
|
||||
rw->fd = fd;
|
||||
rw->eof = RT_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return &(rw->parent);
|
||||
}
|
||||
#elif defined(RTGUI_USING_STDIO_FILERW)
|
||||
struct rtgui_filerw* rtgui_filerw_create_file(const char* filename, const char* mode)
|
||||
{
|
||||
FILE *fp;
|
||||
struct rtgui_filerw_stdio *rw;
|
||||
|
||||
RT_ASSERT(filename != RT_NULL);
|
||||
|
||||
rw = RT_NULL;
|
||||
fp = fopen(filename, mode);
|
||||
|
||||
if ( fp != RT_NULL )
|
||||
{
|
||||
rw = (struct rtgui_filerw_stdio*) rtgui_malloc(sizeof(struct rtgui_filerw_stdio));
|
||||
if (rw != RT_NULL)
|
||||
{
|
||||
rw->parent.seek = stdio_seek;
|
||||
rw->parent.read = stdio_read;
|
||||
rw->parent.write = stdio_write;
|
||||
rw->parent.tell = stdio_tell;
|
||||
rw->parent.close = stdio_close;
|
||||
rw->parent.eof = stdio_eof;
|
||||
|
||||
rw->fp = fp;
|
||||
}
|
||||
}
|
||||
|
||||
return &(rw->parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct rtgui_filerw* rtgui_filerw_create_mem(const rt_uint8_t* mem, rt_size_t size)
|
||||
{
|
||||
struct rtgui_filerw_mem* rw;
|
||||
RT_ASSERT(mem != RT_NULL);
|
||||
|
||||
rw = (struct rtgui_filerw_mem*) rtgui_malloc(sizeof(struct rtgui_filerw_mem));
|
||||
if (rw != RT_NULL)
|
||||
{
|
||||
rw->parent.seek = mem_seek;
|
||||
rw->parent.read = mem_read;
|
||||
rw->parent.write = mem_write;
|
||||
rw->parent.tell = mem_tell;
|
||||
rw->parent.eof = mem_eof;
|
||||
rw->parent.close = mem_close;
|
||||
|
||||
rw->mem_base = mem;
|
||||
rw->mem_position = mem;
|
||||
rw->mem_end = mem + size;
|
||||
}
|
||||
|
||||
return &(rw->parent);
|
||||
}
|
||||
|
||||
int rtgui_filerw_seek(struct rtgui_filerw* context, rt_off_t offset, int whence)
|
||||
{
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
return context->seek(context, offset, whence);
|
||||
}
|
||||
|
||||
int rtgui_filerw_read(struct rtgui_filerw* context, void* buffer, rt_size_t size, rt_size_t count)
|
||||
{
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
return context->read(context, buffer, size, count);
|
||||
}
|
||||
|
||||
int rtgui_filerw_write(struct rtgui_filerw* context, const void* buffer, rt_size_t size, rt_size_t count)
|
||||
{
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
return context->write(context, buffer, size, count);
|
||||
}
|
||||
|
||||
int rtgui_filerw_eof (struct rtgui_filerw* context)
|
||||
{
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
return context->eof(context);
|
||||
}
|
||||
|
||||
int rtgui_filerw_tell(struct rtgui_filerw* context)
|
||||
{
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
return context->tell(context);
|
||||
}
|
||||
|
||||
int rtgui_filerw_close(struct rtgui_filerw* context)
|
||||
{
|
||||
int result;
|
||||
|
||||
RT_ASSERT(context != RT_NULL);
|
||||
|
||||
/* close context */
|
||||
result = context->close(context);
|
||||
if (result != 0)
|
||||
{
|
||||
/* close file failed */
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
350
components/rtgui_win/common/font.c
Normal file
350
components/rtgui_win/common/font.c
Normal file
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* File : font.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtgui/font.h>
|
||||
#include <rtgui/dc.h>
|
||||
|
||||
static rtgui_list_t _rtgui_font_list;
|
||||
static rtgui_font_t* rtgui_default_font;
|
||||
|
||||
extern rtgui_font_t rtgui_font_asc12;
|
||||
extern rtgui_font_t rtgui_font_asc16;
|
||||
/* extern rtgui_font_t rtgui_font_arial16; */
|
||||
/* extern rtgui_font_t rtgui_font_arial12; */
|
||||
#ifdef RTGUI_USING_FONTHZ
|
||||
extern rtgui_font_t rtgui_font_hz16;
|
||||
extern rtgui_font_t rtgui_font_hz12;
|
||||
#endif
|
||||
|
||||
void rtgui_font_system_init()
|
||||
{
|
||||
rtgui_list_init(&(_rtgui_font_list));
|
||||
|
||||
/* set default font to RT_NULL */
|
||||
rtgui_default_font = RT_NULL;
|
||||
|
||||
#ifdef RTGUI_USING_FONT16
|
||||
rtgui_font_system_add_font(&rtgui_font_asc16);
|
||||
#ifdef RTGUI_USING_FONTHZ
|
||||
rtgui_font_system_add_font(&rtgui_font_hz16);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RTGUI_USING_FONT12
|
||||
rtgui_font_system_add_font(&rtgui_font_asc12);
|
||||
#ifdef RTGUI_USING_FONTHZ
|
||||
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);
|
||||
#endif
|
||||
#ifdef RTGUI_USING_FONT16
|
||||
if (rtgui_default_font == RT_NULL)
|
||||
rtgui_font_set_defaut(&rtgui_font_asc16);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void rtgui_font_system_add_font(rtgui_font_t* font)
|
||||
{
|
||||
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);
|
||||
|
||||
/* first refer, load it */
|
||||
if(font->engine->font_load != RT_NULL)
|
||||
font->engine->font_load(font);
|
||||
}
|
||||
|
||||
void rtgui_font_system_remove_font(rtgui_font_t* font)
|
||||
{
|
||||
rtgui_list_remove(&_rtgui_font_list, &(font->list));
|
||||
}
|
||||
|
||||
rtgui_font_t* rtgui_font_default(void)
|
||||
{
|
||||
return rtgui_default_font;
|
||||
}
|
||||
|
||||
void rtgui_font_set_defaut(rtgui_font_t* font)
|
||||
{
|
||||
rtgui_default_font = font;
|
||||
}
|
||||
|
||||
rtgui_font_t* rtgui_font_refer(const rt_uint8_t* family, rt_uint16_t height)
|
||||
{
|
||||
/* search font */
|
||||
rtgui_list_t* node;
|
||||
rtgui_font_t* font;
|
||||
|
||||
rtgui_list_foreach(node, &_rtgui_font_list)
|
||||
{
|
||||
font = rtgui_list_entry(node, rtgui_font_t, list);
|
||||
if((rt_strncmp((const char*)font->family, (const char*)family, RTGUI_NAME_MAX) == 0) &&
|
||||
font->height == height)
|
||||
{
|
||||
font->refer_count ++;
|
||||
return font;
|
||||
}
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
void rtgui_font_derefer(rtgui_font_t* font)
|
||||
{
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
|
||||
font->refer_count --;
|
||||
|
||||
/* no refer, remove font */
|
||||
if(font->refer_count == 0)
|
||||
{
|
||||
rtgui_font_system_remove_font(font);
|
||||
}
|
||||
}
|
||||
|
||||
/* draw a text */
|
||||
void rtgui_font_draw(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
int rtgui_font_get_string_width(rtgui_font_t *font, const char* text)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
|
||||
/* get metrics */
|
||||
rtgui_font_get_string_rect(font, text, &rect);
|
||||
|
||||
return rect.x2 - rect.x1;
|
||||
}
|
||||
|
||||
int rtgui_font_get_font_width(rtgui_font_t* font)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
char *text = "H";
|
||||
/* get metrics */
|
||||
rtgui_font_get_string_rect(font, text, &rect);
|
||||
|
||||
return rect.x2 - rect.x1;
|
||||
}
|
||||
|
||||
int rtgui_font_get_font_height(rtgui_font_t* font)
|
||||
{
|
||||
rtgui_rect_t rect;
|
||||
char *text = "H";
|
||||
/* get metrics */
|
||||
rtgui_font_get_string_rect(font, text, &rect);
|
||||
|
||||
return rect.y2 - rect.y1;
|
||||
}
|
||||
|
||||
void rtgui_font_get_string_rect(rtgui_font_t* font, const char* text, rtgui_rect_t* rect)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_bitmap_font_draw_text(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect);
|
||||
static void rtgui_bitmap_font_get_metrics(rtgui_font_t* 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
|
||||
};
|
||||
|
||||
void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, rtgui_dc_t *dc, const char ch, rtgui_rect_t* rect)
|
||||
{
|
||||
const rt_uint8_t* font_ptr;
|
||||
rt_uint16_t x, y, h;
|
||||
register rt_int32_t i, j, k, word_bytes;
|
||||
|
||||
/* check first and last char */
|
||||
if(ch < font->first_char || ch > font->last_char) return;
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
h = (font->height + y > rect->y2) ? rect->y2 - rect->y1 : font->height;
|
||||
|
||||
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)
|
||||
{
|
||||
/* draw a pixel */
|
||||
rtgui_dc_draw_point(dc,k + 8 * j + x, i + y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_bitmap_font_draw_text(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect)
|
||||
{
|
||||
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;
|
||||
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
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);
|
||||
|
||||
/* 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 ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rtgui_font_derefer(hz_font);
|
||||
#else
|
||||
while ((rect->x1 < rect->x2) && len)
|
||||
{
|
||||
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 ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rtgui_bitmap_font_get_metrics(rtgui_font_t* 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_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
/* set init metrics rect */
|
||||
rect->x1 = rect->y1 = 0;rect->x2 = 0;
|
||||
rect->y2 = bmp_font->height;
|
||||
|
||||
while (*text)
|
||||
{
|
||||
length = 0;
|
||||
while (*(text + length) >= 0x80) length ++; /* it's not a ascii character */
|
||||
rect->x2 += (font->height/2) * length;
|
||||
text += length;
|
||||
|
||||
length = 0;
|
||||
while ((*(text + length) < 0x80) && *(text + length)) length ++;
|
||||
if (bmp_font->char_width != RT_NULL)
|
||||
{
|
||||
/* get width for each character */
|
||||
while (*text && (*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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
237
components/rtgui_win/common/font_freetype.c
Normal file
237
components/rtgui_win/common/font_freetype.c
Normal file
@@ -0,0 +1,237 @@
|
||||
#include <rtgui/font_freetype.h>
|
||||
|
||||
#ifdef RTGUI_USING_TTF
|
||||
#include <ft2build.h>
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
|
||||
static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect);
|
||||
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
|
||||
|
||||
struct rtgui_font_engine freetype_font_engine =
|
||||
{
|
||||
RT_NULL,
|
||||
RT_NULL,
|
||||
rtgui_freetype_font_draw_text,
|
||||
rtgui_freetype_font_get_metrics
|
||||
};
|
||||
|
||||
struct rtgui_freetype_font
|
||||
{
|
||||
int bold;
|
||||
int italic;
|
||||
|
||||
FT_Face face;
|
||||
FT_Library library;
|
||||
};
|
||||
|
||||
static void gbk_to_unicode(rt_uint16_t *unicode, const unsigned char *text, int len)
|
||||
{
|
||||
int i;
|
||||
unsigned short wch;
|
||||
extern unsigned short ff_convert(unsigned short wch, int direction);
|
||||
|
||||
for (i = 0; i < len; )
|
||||
{
|
||||
if (*text < 0x80)
|
||||
{
|
||||
wch = *text;
|
||||
*unicode = ff_convert(wch, 1);
|
||||
text ++;
|
||||
i ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wch = wch = *(text + 1) | (*text << 8);
|
||||
*unicode = ff_convert(wch, 1);
|
||||
text += 2;
|
||||
i += 2;
|
||||
}
|
||||
|
||||
unicode ++;
|
||||
}
|
||||
|
||||
*unicode = '\0';
|
||||
}
|
||||
|
||||
static void rtgui_freetype_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
|
||||
{
|
||||
int index = 0;
|
||||
FT_Error err = 0;
|
||||
rt_uint16_t *text_short, *text_ptr;
|
||||
struct rtgui_freetype_font* freetype;
|
||||
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font*) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
|
||||
/* allocate unicode buffer */
|
||||
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
|
||||
if (text_short == RT_NULL) return ; /* out of memory */
|
||||
|
||||
/* convert gbk to unicode */
|
||||
gbk_to_unicode(text_short, text, len);
|
||||
text_ptr = text_short;
|
||||
|
||||
while (*text_ptr)
|
||||
{
|
||||
index = FT_Get_Char_Index(freetype->face, *text_ptr);
|
||||
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT|FT_LOAD_RENDER);
|
||||
if (err == 0)
|
||||
{
|
||||
int rows, x;
|
||||
rt_uint8_t* ptr;
|
||||
|
||||
/* render font */
|
||||
ptr = (rt_uint8_t*)freetype->face->glyph->bitmap.buffer;
|
||||
|
||||
for (rows = 0; rows < freetype->face->glyph->bitmap.rows; rows ++)
|
||||
for (x = 0; x < freetype->face->glyph->bitmap.width; x++)
|
||||
{
|
||||
if (*ptr > 0)
|
||||
rtgui_dc_draw_color_point(dc, rect->x1 + x, rect->y1 + rows, RTGUI_RGB(0xff - *ptr, 0xff - *ptr, 0xff - *ptr));
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
text_ptr ++;
|
||||
rect->x1 += freetype->face->glyph->bitmap.width;
|
||||
}
|
||||
|
||||
/* release unicode buffer */
|
||||
rtgui_free(text_short);
|
||||
}
|
||||
|
||||
static void rtgui_freetype_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect)
|
||||
{
|
||||
int index = 0, len;
|
||||
FT_Error err = 0;
|
||||
rt_uint16_t w = 0, h = 0;
|
||||
rt_uint16_t *text_short, *text_ptr;
|
||||
struct rtgui_freetype_font* freetype;
|
||||
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
RT_ASSERT(rect != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font*) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
|
||||
len = strlen(text);
|
||||
memset(rect, 0, sizeof(struct rtgui_rect));
|
||||
|
||||
/* allocate unicode buffer */
|
||||
text_short = (rt_uint16_t*)rtgui_malloc((len + 1)* 2);
|
||||
if (text_short == RT_NULL) return ; /* out of memory */
|
||||
|
||||
/* convert gbk to unicode */
|
||||
gbk_to_unicode(text_short, text, len);
|
||||
text_ptr = text_short;
|
||||
|
||||
while (*text_ptr)
|
||||
{
|
||||
index = FT_Get_Char_Index(freetype->face, *text_ptr);
|
||||
err = FT_Load_Glyph(freetype->face, index, FT_LOAD_DEFAULT);
|
||||
|
||||
if (err == 0)
|
||||
{
|
||||
w += freetype->face->glyph->bitmap.width;
|
||||
if (freetype->face->glyph->bitmap.rows > h)
|
||||
{
|
||||
h = freetype->face->glyph->bitmap.rows;
|
||||
}
|
||||
}
|
||||
|
||||
text_ptr ++;
|
||||
}
|
||||
|
||||
rect->x1 = 0; rect->y1 = 0;
|
||||
rect->x2 = w; rect->y2 = h;
|
||||
|
||||
/* release unicode buffer */
|
||||
rtgui_free(text_short);
|
||||
}
|
||||
|
||||
rtgui_font_t* rtgui_freetype_font_create(const char* filename, int bold, int italic, rt_size_t size)
|
||||
{
|
||||
FT_Error err = 0;
|
||||
struct rtgui_font* font;
|
||||
|
||||
font = (struct rtgui_font*) rtgui_malloc (sizeof(struct rtgui_font));
|
||||
if (font != RT_NULL)
|
||||
{
|
||||
struct rtgui_freetype_font* freetype;
|
||||
|
||||
freetype = (struct rtgui_freetype_font*) rtgui_malloc (sizeof(struct rtgui_freetype_font));
|
||||
if (freetype == RT_NULL)
|
||||
{
|
||||
rt_free(font);
|
||||
font = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = FT_Init_FreeType(&freetype->library);
|
||||
if((err = FT_New_Face(freetype->library, filename, 0, &freetype->face)))
|
||||
{
|
||||
FT_Done_FreeType(freetype->library);
|
||||
|
||||
rt_free(font);
|
||||
font = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
err = FT_Select_Charmap(freetype->face, ft_encoding_unicode);
|
||||
if(err)
|
||||
{
|
||||
err = FT_Select_Charmap(freetype->face, ft_encoding_latin_1 );
|
||||
}
|
||||
|
||||
err = FT_Set_Pixel_Sizes(freetype->face, 0, size);
|
||||
if (err != 0)
|
||||
{
|
||||
rtgui_free(font);
|
||||
font = RT_NULL;
|
||||
|
||||
FT_Done_FreeType(freetype->library);
|
||||
rtgui_free(freetype);
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
freetype->bold = bold;
|
||||
freetype->italic = italic;
|
||||
|
||||
rt_kprintf("fonfile:%s\n", filename);
|
||||
rt_kprintf("font family_name:%s\n", freetype->face->family_name);
|
||||
rt_kprintf("font style_name:%s\n", freetype->face->style_name);
|
||||
|
||||
/* set user data */
|
||||
font->data = freetype;
|
||||
font->family = rt_strdup(freetype->face->family_name);
|
||||
font->height = (rt_uint16_t)size;
|
||||
font->refer_count = 0;
|
||||
font->engine = &freetype_font_engine;
|
||||
|
||||
/* add to system */
|
||||
rtgui_font_system_add_font(font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
void rtgui_freetype_font_destroy(rtgui_font_t* font)
|
||||
{
|
||||
struct rtgui_freetype_font* freetype;
|
||||
|
||||
RT_ASSERT(font != RT_NULL);
|
||||
freetype = (struct rtgui_freetype_font*) font->data;
|
||||
RT_ASSERT(freetype != RT_NULL);
|
||||
|
||||
rtgui_font_system_remove_font(font);
|
||||
|
||||
FT_Done_Face (freetype->face);
|
||||
FT_Done_FreeType(freetype->library);
|
||||
rtgui_free(freetype);
|
||||
rtgui_free(font);
|
||||
}
|
||||
#endif
|
||||
115
components/rtgui_win/common/font_hz_bmp.c
Normal file
115
components/rtgui_win/common/font_hz_bmp.c
Normal file
@@ -0,0 +1,115 @@
|
||||
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/font.h>
|
||||
|
||||
#ifdef RTGUI_USING_HZ_BMP
|
||||
|
||||
static void rtgui_hz_bitmap_font_draw_text(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect);
|
||||
static void rtgui_hz_bitmap_font_get_metrics(rtgui_font_t* 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
|
||||
};
|
||||
|
||||
static void _rtgui_hz_bitmap_font_draw_text(struct rtgui_font_bitmap* bmp_font, rtgui_dc_t *dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect)
|
||||
{
|
||||
register rt_base_t h, word_bytes;
|
||||
rt_uint8_t* str;
|
||||
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
/* drawing height */
|
||||
h = (bmp_font->height + rect->y1 > rect->y2)? rect->y2 - rect->y1 : bmp_font->height;
|
||||
word_bytes = (bmp_font->width + 7)/8;
|
||||
|
||||
str = (rt_uint8_t*)text;
|
||||
|
||||
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;
|
||||
|
||||
/* calculate section and index */
|
||||
sect = *str - 0xA0;
|
||||
index = *(str+1) - 0xA0;
|
||||
|
||||
/* get font pixel data */
|
||||
font_ptr = bmp_font->bmp + ( 94*(sect-1) + (index-1) )*(bmp_font->width + bmp_font->height);
|
||||
|
||||
/* 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*2 + 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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, rtgui_dc_t *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_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 */
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
len = 0;
|
||||
while (((rt_uint8_t)*(text + len)) < 0x80 && *(text + len)) len ++;
|
||||
/* draw text with English font */
|
||||
if (len > 0)
|
||||
{
|
||||
rtgui_font_draw(efont, dc, text, len, rect);
|
||||
|
||||
text += len;
|
||||
length -= len;
|
||||
}
|
||||
|
||||
len = 0;
|
||||
while (((rt_uint8_t)*(text + len)) >= 0x80) len ++;
|
||||
if (len > 0)
|
||||
{
|
||||
_rtgui_hz_bitmap_font_draw_text(bmp_font, dc, text, len, rect);
|
||||
|
||||
text += len;
|
||||
length -= len;
|
||||
}
|
||||
}
|
||||
|
||||
rtgui_font_derefer(efont);
|
||||
}
|
||||
|
||||
static void rtgui_hz_bitmap_font_get_metrics(rtgui_font_t* font, const char* text, rtgui_rect_t* rect)
|
||||
{
|
||||
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
|
||||
|
||||
RT_ASSERT(bmp_font != RT_NULL);
|
||||
|
||||
/* set metrics rect */
|
||||
rect->x1 = rect->y1 = 0;
|
||||
rect->x2 = (rt_int16_t)(bmp_font->width * rt_strlen((const char*)text));
|
||||
rect->y2 = bmp_font->height;
|
||||
}
|
||||
|
||||
#endif
|
||||
147
components/rtgui_win/common/font_hz_file.c
Normal file
147
components/rtgui_win/common/font_hz_file.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Cached HZ font engine
|
||||
*/
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/font.h>
|
||||
#include <rtgui/tree.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#ifdef RTGUI_USING_HZ_FILE
|
||||
#include <dfs_posix.h>
|
||||
|
||||
#define HZ_CACHE_MAX 64
|
||||
|
||||
static int _font_cache_compare(struct hz_cache* node1, struct hz_cache* node2);
|
||||
|
||||
static void rtgui_hz_file_font_load(rtgui_font_t* font);
|
||||
static void rtgui_hz_file_font_draw_text(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect);
|
||||
static void rtgui_hz_file_font_get_metrics(rtgui_font_t* font, const char* text, rtgui_rect_t* rect);
|
||||
const struct rtgui_font_engine rtgui_hz_file_font_engine =
|
||||
{
|
||||
RT_NULL,
|
||||
rtgui_hz_file_font_load,
|
||||
rtgui_hz_file_font_draw_text,
|
||||
rtgui_hz_file_font_get_metrics
|
||||
};
|
||||
|
||||
SPLAY_PROTOTYPE(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)
|
||||
{
|
||||
if(cache_1->hz_id > cache_2->hz_id) return 1;
|
||||
if(cache_1->hz_id < cache_2->hz_id) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
search.hz_id = hz_id;
|
||||
cache = SPLAY_FIND(cache_tree, &(font->cache_root), &search);
|
||||
if(cache != RT_NULL)
|
||||
{
|
||||
/* find it */
|
||||
return (rt_uint8_t*)(cache + 1);
|
||||
}
|
||||
|
||||
/* can not find it, load to cache */
|
||||
cache = (struct hz_cache*) rt_malloc(sizeof(struct hz_cache) + font->font_data_size);
|
||||
if(cache == RT_NULL) return RT_NULL; /* no memory yet */
|
||||
|
||||
cache->hz_id = hz_id;
|
||||
seek = 94 * (((hz_id & 0xff) - 0xA0) - 1) + ((hz_id >> 8) - 0xA0) - 1;
|
||||
seek *= font->font_data_size;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
rt_free(cache);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
/* insert to cache */
|
||||
SPLAY_INSERT(cache_tree, &(font->cache_root), cache);
|
||||
font->cache_size ++;
|
||||
|
||||
if(font->cache_size > HZ_CACHE_MAX)
|
||||
{
|
||||
/* remove a cache */
|
||||
struct hz_cache* left;
|
||||
left = font->cache_root.sph_root;
|
||||
while(SPLAY_LEFT(left, hz_node) != RT_NULL) left = SPLAY_LEFT(left, hz_node);
|
||||
|
||||
/* remove the left node */
|
||||
SPLAY_REMOVE(cache_tree, &(font->cache_root), left);
|
||||
font->cache_size --;
|
||||
}
|
||||
|
||||
return (rt_uint8_t*)(cache + 1);
|
||||
}
|
||||
|
||||
static void rtgui_hz_file_font_load(rtgui_font_t* font)
|
||||
{
|
||||
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(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect)
|
||||
{
|
||||
register rt_int32_t h, word_bytes;
|
||||
rt_uint8_t* str;
|
||||
struct rtgui_hz_file_font* hz_file_font = (struct rtgui_hz_file_font*)font->data;
|
||||
RT_ASSERT(hz_file_font != RT_NULL);
|
||||
|
||||
/* drawing height */
|
||||
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;
|
||||
|
||||
while(len > 0 && rect->x1 < rect->x2)
|
||||
{
|
||||
const rt_uint8_t* font_ptr;
|
||||
register rt_int32_t i, j, k;
|
||||
|
||||
/* get font pixel data */
|
||||
font_ptr = _font_cache_get(hz_file_font, *str | (*(str+1) << 8));
|
||||
|
||||
/* 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*2 + j] >> (7-k)) & 0x01) != 0 &&
|
||||
(rect->x1 + 8 * j + k < rect->x2))
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, rect->x1 + 8*j + k, rect->y1 + i, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* move x to next character */
|
||||
rect->x1 += hz_file_font->font_size;
|
||||
str += 2;
|
||||
len -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_hz_file_font_get_metrics(rtgui_font_t* font, const char* text, rtgui_rect_t* rect)
|
||||
{
|
||||
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->y2 = hz_file_font->font_size;
|
||||
}
|
||||
#endif
|
||||
12317
components/rtgui_win/common/hz12font.c
Normal file
12317
components/rtgui_win/common/hz12font.c
Normal file
File diff suppressed because it is too large
Load Diff
16775
components/rtgui_win/common/hz16font.c
Normal file
16775
components/rtgui_win/common/hz16font.c
Normal file
File diff suppressed because it is too large
Load Diff
217
components/rtgui_win/common/image.c
Normal file
217
components/rtgui_win/common/image.c
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* File : image.c
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <rtgui/image.h>
|
||||
|
||||
#include <rtgui/image_xpm.h>
|
||||
#include <rtgui/image_hdc.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef RTGUI_IMAGE_BMP
|
||||
#include <rtgui/image_bmp.h>
|
||||
#endif
|
||||
#ifdef RTGUI_IMAGE_JPEG
|
||||
#include <rtgui/image_jpeg.h>
|
||||
#endif
|
||||
#ifdef RTGUI_IMAGE_PNG
|
||||
#include <rtgui/image_png.h>
|
||||
#endif
|
||||
|
||||
static rtgui_list_t _rtgui_system_image_list = {RT_NULL};
|
||||
|
||||
/* init rtgui image system */
|
||||
void rtgui_system_image_init(void)
|
||||
{
|
||||
/* always support XPM image */
|
||||
rtgui_image_xpm_init();
|
||||
rtgui_image_hdc_init();
|
||||
|
||||
#ifdef RTGUI_IMAGE_BMP
|
||||
rtgui_image_bmp_init();
|
||||
#endif
|
||||
|
||||
#ifdef RTGUI_IMAGE_JPEG
|
||||
rtgui_image_jpeg_init();
|
||||
#endif
|
||||
|
||||
#ifdef RTGUI_IMAGE_PNG
|
||||
rtgui_image_png_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct rtgui_image_engine* rtgui_image_get_engine(const char* type)
|
||||
{
|
||||
rtgui_list_t *node;
|
||||
struct rtgui_image_engine *engine;
|
||||
|
||||
rtgui_list_foreach(node, &_rtgui_system_image_list)
|
||||
{
|
||||
engine = rtgui_list_entry(node, struct rtgui_image_engine, list);
|
||||
|
||||
if(strncasecmp(engine->name, type, strlen(engine->name)) ==0)
|
||||
return engine;
|
||||
}
|
||||
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
#if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
|
||||
rtgui_image_t* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load)
|
||||
{
|
||||
struct rtgui_filerw* file;
|
||||
struct rtgui_image_engine* engine;
|
||||
rtgui_image_t* image = RT_NULL;
|
||||
|
||||
/* create filerw context */
|
||||
file = rtgui_filerw_create_file(filename, "rb");
|
||||
if(file == RT_NULL) return RT_NULL;
|
||||
|
||||
/* get image engine */
|
||||
engine = rtgui_image_get_engine(type);
|
||||
if(engine == RT_NULL)
|
||||
{
|
||||
/* close filerw context */
|
||||
rtgui_filerw_close(file);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
if(engine->image_check(file) == RT_TRUE)
|
||||
{
|
||||
image = (rtgui_image_t*) rt_malloc(sizeof(rtgui_image_t));
|
||||
if(image == RT_NULL)
|
||||
{
|
||||
/* close filerw context */
|
||||
rtgui_filerw_close(file);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
if(engine->image_load(image, file, load) != RT_TRUE)
|
||||
{
|
||||
/* close filerw context */
|
||||
rtgui_filerw_close(file);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
/* set image engine */
|
||||
image->engine = engine;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtgui_filerw_close(file);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
#endif
|
||||
|
||||
rtgui_image_t* rtgui_image_create_from_mem(const char* type, const rt_uint8_t* data, rt_size_t length, rt_bool_t load)
|
||||
{
|
||||
struct rtgui_filerw* file;
|
||||
struct rtgui_image_engine* engine;
|
||||
rtgui_image_t* image = RT_NULL;
|
||||
|
||||
/* create filerw context */
|
||||
file = rtgui_filerw_create_mem(data, length);
|
||||
if(file == RT_NULL) return RT_NULL;
|
||||
|
||||
/* È¡µÃͼÏñÒýÇæget image engine */
|
||||
engine = rtgui_image_get_engine(type);
|
||||
if(engine == RT_NULL)
|
||||
{
|
||||
/* close filerw context */
|
||||
rtgui_filerw_close(file);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
if(engine->image_check(file) == RT_TRUE)
|
||||
{
|
||||
image = (rtgui_image_t*)rt_malloc(sizeof(rtgui_image_t));
|
||||
if(image == RT_NULL)
|
||||
{
|
||||
/* close filerw context */
|
||||
rtgui_filerw_close(file);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
if(engine->image_load(image, file, load) != RT_TRUE)
|
||||
{
|
||||
/* close filerw context */
|
||||
rtgui_filerw_close(file);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
/* set image engine */
|
||||
image->engine = engine;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtgui_filerw_close(file);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
void rtgui_image_destroy(rtgui_image_t* image)
|
||||
{
|
||||
RT_ASSERT(image != RT_NULL);
|
||||
|
||||
image->engine->image_unload(image);
|
||||
rt_free(image);
|
||||
}
|
||||
|
||||
/* register an image engine */
|
||||
void rtgui_image_register_engine(struct rtgui_image_engine* engine)
|
||||
{
|
||||
RT_ASSERT(engine!= RT_NULL);
|
||||
|
||||
rtgui_list_append(&_rtgui_system_image_list, &(engine->list));
|
||||
}
|
||||
|
||||
void rtgui_image_blit(rtgui_image_t *image, rtgui_dc_t *dc, rtgui_rect_t *rect)
|
||||
{
|
||||
RT_ASSERT(rect != RT_NULL);
|
||||
|
||||
if(image != RT_NULL && image->engine != RT_NULL)
|
||||
{
|
||||
/* use image engine to blit */
|
||||
image->engine->image_blit(image, dc, rect);
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_image_paste(rtgui_image_t *image, rtgui_dc_t *dc, rtgui_rect_t *rect, rtgui_color_t shield_color)
|
||||
{
|
||||
RT_ASSERT(rect != RT_NULL);
|
||||
|
||||
if(image != RT_NULL && image->engine != RT_NULL)
|
||||
{
|
||||
/* use image engine to blit */
|
||||
image->engine->image_paste(image, dc, rect, shield_color);
|
||||
}
|
||||
}
|
||||
|
||||
struct rtgui_image_palette* rtgui_image_palette_create(rt_uint32_t ncolors)
|
||||
{
|
||||
struct rtgui_image_palette* palette = RT_NULL;
|
||||
|
||||
if (ncolors > 0)
|
||||
{
|
||||
palette = (struct rtgui_image_palette*) rt_malloc(sizeof(struct rtgui_image_palette) + sizeof(rtgui_color_t) * ncolors);
|
||||
if (palette != RT_NULL) palette->colors = (rtgui_color_t*)(palette + 1);
|
||||
}
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
642
components/rtgui_win/common/image_bmp.c
Normal file
642
components/rtgui_win/common/image_bmp.c
Normal file
File diff suppressed because it is too large
Load Diff
445
components/rtgui_win/common/image_container.c
Normal file
445
components/rtgui_win/common/image_container.c
Normal file
@@ -0,0 +1,445 @@
|
||||
#include <rtgui/image_container.h>
|
||||
|
||||
#ifdef RTGUI_IMAGE_CONTAINER
|
||||
typedef unsigned int (*rtgui_hash_func_t) (const void* key);
|
||||
typedef struct _rtgui_hash_table rtgui_hash_table_t;
|
||||
typedef rt_bool_t (*rtgui_equal_func_t) (const void* a, const void* b);
|
||||
typedef void (*rtgui_user_func_t) (const void* value, const void* data);
|
||||
|
||||
/*
|
||||
*Hash tables
|
||||
*/
|
||||
rtgui_hash_table_t* hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_func_t key_equal_func);
|
||||
void hash_table_destroy (rtgui_hash_table_t* hash_table);
|
||||
|
||||
void* hash_table_find (rtgui_hash_table_t* hash_table, void* key);
|
||||
void hash_table_insert (rtgui_hash_table_t* hash_table, void* key, void* value);
|
||||
rt_bool_t hash_table_remove (rtgui_hash_table_t* hash_table, void* key);
|
||||
|
||||
void hash_table_foreach(rtgui_hash_table_t* hash_table, rtgui_user_func_t user_func, void* data);
|
||||
unsigned int hash_table_get_size (rtgui_hash_table_t* hash_table);
|
||||
|
||||
/* Hash Functions
|
||||
*/
|
||||
unsigned int direct_hash (void* v);
|
||||
|
||||
#define HASH_TABLE_MIN_SIZE 11
|
||||
#define HASH_TABLE_MAX_SIZE 6247
|
||||
|
||||
typedef struct _gui_hash_node rtgui_hash_node_t;
|
||||
struct _gui_hash_node
|
||||
{
|
||||
void* key;
|
||||
void* value;
|
||||
rtgui_hash_node_t *next;
|
||||
};
|
||||
|
||||
struct _rtgui_hash_table
|
||||
{
|
||||
rt_uint16_t size;
|
||||
rt_uint16_t nnodes;
|
||||
|
||||
rtgui_hash_node_t **nodes;
|
||||
rtgui_hash_func_t hash_func;
|
||||
rtgui_equal_func_t key_equal_func;
|
||||
};
|
||||
|
||||
static const unsigned int primes[] =
|
||||
{
|
||||
11,
|
||||
19,
|
||||
37,
|
||||
73,
|
||||
109,
|
||||
163,
|
||||
251,
|
||||
367,
|
||||
557,
|
||||
823,
|
||||
1237,
|
||||
1861,
|
||||
2777,
|
||||
4177,
|
||||
6247,
|
||||
/*
|
||||
9371,
|
||||
14057,
|
||||
21089,
|
||||
31627,
|
||||
47431,
|
||||
71143,
|
||||
106721,
|
||||
160073,
|
||||
240101,
|
||||
360163,
|
||||
540217,
|
||||
810343,
|
||||
1215497,
|
||||
1823231,
|
||||
2734867,
|
||||
4102283,
|
||||
6153409,
|
||||
9230113,
|
||||
13845163,
|
||||
*/
|
||||
};
|
||||
|
||||
static const unsigned int nprimes = sizeof (primes) / sizeof (primes[0]);
|
||||
|
||||
static void hash_table_resize (rtgui_hash_table_t *hash_table);
|
||||
static rtgui_hash_node_t** hash_table_find_node (rtgui_hash_table_t *hash_table, void* key);
|
||||
static rtgui_hash_node_t* hash_node_create (void* key, void* value);
|
||||
static void hash_node_destroy (rtgui_hash_node_t *hash_node);
|
||||
static void hash_nodes_destroy (rtgui_hash_node_t *hash_node);
|
||||
static unsigned int primes_closest (unsigned int num);
|
||||
static void hash_table_needresize(rtgui_hash_table_t *hash_table);
|
||||
|
||||
rt_inline unsigned int primes_closest (unsigned int num)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nprimes; i++)
|
||||
if (primes[i] > num)
|
||||
return primes[i];
|
||||
|
||||
return primes[nprimes - 1];
|
||||
}
|
||||
|
||||
/* directly hash */
|
||||
unsigned int direct_hash (void* v)
|
||||
{
|
||||
return (unsigned int)v;
|
||||
}
|
||||
|
||||
rtgui_hash_table_t* hash_table_create(rtgui_hash_func_t hash_func, rtgui_equal_func_t key_equal_func)
|
||||
{
|
||||
rtgui_hash_table_t *hash_table;
|
||||
|
||||
hash_table = (rtgui_hash_table_t*) rt_malloc (sizeof(rtgui_hash_table_t));
|
||||
if (hash_table != RT_NULL)
|
||||
{
|
||||
hash_table->size = HASH_TABLE_MIN_SIZE;
|
||||
hash_table->nnodes = 0;
|
||||
hash_table->hash_func = hash_func ? hash_func : direct_hash;
|
||||
hash_table->key_equal_func = key_equal_func;
|
||||
hash_table->nodes = (rtgui_hash_node_t **)rt_malloc ( sizeof(rtgui_hash_node_t*) * hash_table->size);
|
||||
if (hash_table->nodes == RT_NULL)
|
||||
{
|
||||
/* no memory yet */
|
||||
rt_free(hash_table);
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
rt_memset(hash_table->nodes, 0, sizeof(rtgui_hash_node_t*) * hash_table->size);
|
||||
}
|
||||
|
||||
return hash_table;
|
||||
}
|
||||
|
||||
void hash_table_destroy (rtgui_hash_table_t *hash_table)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
RT_ASSERT(hash_table != RT_NULL);
|
||||
|
||||
for (i = 0; i < hash_table->size; i++)
|
||||
hash_nodes_destroy (hash_table->nodes[i]);
|
||||
|
||||
rt_free (hash_table->nodes);
|
||||
rt_free (hash_table);
|
||||
}
|
||||
|
||||
static rtgui_hash_node_t** hash_table_find_node (rtgui_hash_table_t *hash_table, void* key)
|
||||
{
|
||||
rtgui_hash_node_t **node;
|
||||
|
||||
node = &hash_table->nodes [(* hash_table->hash_func) (key) % hash_table->size];
|
||||
|
||||
if (hash_table->key_equal_func)
|
||||
while (*node && !(*hash_table->key_equal_func) ((*node)->key, key))
|
||||
node = &(*node)->next;
|
||||
else
|
||||
while (*node && (*node)->key != key)
|
||||
node = &(*node)->next;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
void* hash_table_find (rtgui_hash_table_t* hash_table, void* key)
|
||||
{
|
||||
rtgui_hash_node_t *node;
|
||||
|
||||
RT_ASSERT(hash_table != RT_NULL);
|
||||
RT_ASSERT(key != RT_NULL);
|
||||
|
||||
node = *hash_table_find_node (hash_table, key);
|
||||
|
||||
if (node) return node->value;
|
||||
else return RT_NULL;
|
||||
}
|
||||
|
||||
void hash_table_insert (rtgui_hash_table_t *hash_table, void* key, void* value)
|
||||
{
|
||||
rtgui_hash_node_t **node;
|
||||
|
||||
if (hash_table == RT_NULL)return;
|
||||
|
||||
node = hash_table_find_node (hash_table, key);
|
||||
if (*node)
|
||||
{
|
||||
(*node)->value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
*node = hash_node_create (key, value);
|
||||
hash_table->nnodes++;
|
||||
hash_table_needresize (hash_table);
|
||||
}
|
||||
}
|
||||
|
||||
rt_bool_t hash_table_remove (rtgui_hash_table_t *hash_table, void* key)
|
||||
{
|
||||
rtgui_hash_node_t **node, *dest;
|
||||
|
||||
if (hash_table == RT_NULL) return RT_FALSE;
|
||||
|
||||
node = hash_table_find_node (hash_table, key);
|
||||
if (*node)
|
||||
{
|
||||
dest = *node;
|
||||
(*node) = dest->next;
|
||||
hash_node_destroy (dest);
|
||||
hash_table->nnodes--;
|
||||
|
||||
hash_table_needresize (hash_table);
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
void hash_table_foreach(rtgui_hash_table_t *hash_table, rtgui_user_func_t user_func, void* data)
|
||||
{
|
||||
rtgui_hash_node_t *node;
|
||||
int i;
|
||||
|
||||
RT_ASSERT(hash_table != RT_NULL);
|
||||
RT_ASSERT(user_func != RT_NULL);
|
||||
|
||||
for (i = 0; i < hash_table->size; i++)
|
||||
for (node = hash_table->nodes[i]; node; node = node->next)
|
||||
(* user_func) (node->value, data);
|
||||
}
|
||||
|
||||
unsigned int hash_table_get_size (rtgui_hash_table_t *hash_table)
|
||||
{
|
||||
if ( hash_table ==NULL ) return 0;
|
||||
|
||||
return hash_table->nnodes;
|
||||
}
|
||||
|
||||
static void hash_table_needresize(rtgui_hash_table_t *hash_table)
|
||||
{
|
||||
if ((hash_table->size >= 3*hash_table->nnodes && hash_table->size > HASH_TABLE_MIN_SIZE) ||
|
||||
(3 * hash_table->size <= hash_table->nnodes && hash_table->size < HASH_TABLE_MAX_SIZE))
|
||||
hash_table_resize (hash_table);
|
||||
}
|
||||
|
||||
static void hash_table_resize (rtgui_hash_table_t *hash_table)
|
||||
{
|
||||
rtgui_hash_node_t **new_nodes;
|
||||
rtgui_hash_node_t *node;
|
||||
rtgui_hash_node_t *next;
|
||||
unsigned int hash_val;
|
||||
int new_size;
|
||||
int i;
|
||||
|
||||
i = primes_closest(hash_table->nnodes);
|
||||
new_size = i > HASH_TABLE_MAX_SIZE ? HASH_TABLE_MAX_SIZE : i < HASH_TABLE_MIN_SIZE ? HASH_TABLE_MIN_SIZE : i ;
|
||||
|
||||
new_nodes = (rtgui_hash_node_t **)rt_malloc ( sizeof(rtgui_hash_node_t*) * new_size);
|
||||
if (new_nodes == RT_NULL) return; /* no memory yet */
|
||||
rt_memset(new_nodes, 0, sizeof(rtgui_hash_node_t*) * new_size);
|
||||
|
||||
for (i = 0; i < hash_table->size; i++)
|
||||
{
|
||||
for (node = hash_table->nodes[i]; node; node = next)
|
||||
{
|
||||
next = node->next;
|
||||
|
||||
hash_val = (* hash_table->hash_func) (node->key) % new_size;
|
||||
|
||||
node->next = new_nodes[hash_val];
|
||||
new_nodes[hash_val] = node;
|
||||
}
|
||||
}
|
||||
|
||||
rt_free (hash_table->nodes);
|
||||
hash_table->nodes = new_nodes;
|
||||
hash_table->size = new_size;
|
||||
}
|
||||
|
||||
static rtgui_hash_node_t* hash_node_create (void* key, void* value)
|
||||
{
|
||||
rtgui_hash_node_t *hash_node;
|
||||
|
||||
hash_node = (rtgui_hash_node_t*) rt_malloc ( sizeof(rtgui_hash_node_t) );
|
||||
if (hash_node != RT_NULL)
|
||||
{
|
||||
/* set value and key */
|
||||
hash_node->key = key;
|
||||
hash_node->value = value;;
|
||||
|
||||
hash_node->next = RT_NULL;
|
||||
}
|
||||
|
||||
return hash_node;
|
||||
}
|
||||
|
||||
static void hash_node_destroy (rtgui_hash_node_t *hash_node)
|
||||
{
|
||||
rt_free(hash_node);
|
||||
}
|
||||
|
||||
static void hash_nodes_destroy (rtgui_hash_node_t *hash_node)
|
||||
{
|
||||
if (hash_node)
|
||||
{
|
||||
rtgui_hash_node_t *node = hash_node;
|
||||
rtgui_hash_node_t *temp;
|
||||
|
||||
while (node->next)
|
||||
{
|
||||
node->key = NULL;
|
||||
node->value = NULL;
|
||||
|
||||
temp = node;
|
||||
node = node->next;
|
||||
rt_free(temp);
|
||||
}
|
||||
|
||||
node->key = NULL;
|
||||
node->value = NULL;
|
||||
rt_free(node);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int string_hash_func(const void* self)
|
||||
{
|
||||
const char *p;
|
||||
int h=0, g;
|
||||
|
||||
for(p = self; *p != '\0'; p += 1)
|
||||
{
|
||||
h = ( h << 4 ) + *p;
|
||||
if ( ( g = h & 0xf0000000 ) )
|
||||
{
|
||||
h = h ^ (g >> 24);
|
||||
h = h ^ g;
|
||||
}
|
||||
}
|
||||
|
||||
return h ;
|
||||
}
|
||||
rt_bool_t string_equal_func(const void* a, const void* b)
|
||||
{
|
||||
const char *str1, *str2;
|
||||
|
||||
str1 = (const char*)a;
|
||||
str2 = (const char*)b;
|
||||
|
||||
if (strcmp(str1, str2) == 0) return RT_TRUE;
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
static rtgui_hash_table_t* image_hash_table;
|
||||
static rt_bool_t load_image = RT_FALSE;
|
||||
void rtgui_system_image_container_init(rt_bool_t load)
|
||||
{
|
||||
/* create image hash table */
|
||||
image_hash_table = hash_table_create(string_hash_func, string_equal_func);
|
||||
RT_ASSERT(image_hash_table != RT_NULL);
|
||||
|
||||
/* set load type */
|
||||
load_image = load;
|
||||
}
|
||||
|
||||
rtgui_image_item_t* rtgui_image_container_get(const char* filename)
|
||||
{
|
||||
struct rtgui_image_item* item;
|
||||
|
||||
item = hash_table_find(image_hash_table, filename);
|
||||
if (item == RT_NULL)
|
||||
{
|
||||
item = (struct rtgui_image_item*) rt_malloc (sizeof(struct rtgui_image_item));
|
||||
if (item == RT_NULL) return RT_NULL;
|
||||
|
||||
/* create a image object */
|
||||
item->image = rtgui_image_create(filename, load_image);
|
||||
if (item->image == RT_NULL)
|
||||
{
|
||||
rt_free(item);
|
||||
return RT_NULL; /* create image failed */
|
||||
}
|
||||
|
||||
item->refcount = 1;
|
||||
item->filename = rt_strdup(filename);
|
||||
hash_table_insert(image_hash_table, item->filename, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->refcount ++; /* increase refcount */
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
rtgui_image_item_t* rtgui_image_container_get_memref(const char* type, const rt_uint8_t* memory, rt_uint32_t length)
|
||||
{
|
||||
char filename[32];
|
||||
struct rtgui_image_item* item;
|
||||
|
||||
/* create filename for image identification */
|
||||
rt_snprintf(filename, sizeof(filename), "0x%08x_%s", memory, type);
|
||||
|
||||
/* search in container */
|
||||
item = hash_table_find(image_hash_table, filename);
|
||||
if (item == RT_NULL)
|
||||
{
|
||||
item = (struct rtgui_image_item*) rt_malloc (sizeof(struct rtgui_image_item));
|
||||
if (item == RT_NULL) return RT_NULL;
|
||||
|
||||
/* create image object */
|
||||
item->image = rtgui_image_create_from_mem(type, memory, length, load_image);
|
||||
if (item->image == RT_NULL)
|
||||
{
|
||||
rt_free(item);
|
||||
return RT_NULL; /* create image failed */
|
||||
}
|
||||
|
||||
item->refcount = 1;
|
||||
item->filename = rt_strdup(filename);
|
||||
hash_table_insert(image_hash_table, item->filename, item);
|
||||
}
|
||||
else item->refcount ++;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void rtgui_image_container_put(rtgui_image_item_t* item)
|
||||
{
|
||||
item->refcount --;
|
||||
if (item->refcount == 0)
|
||||
{
|
||||
/* remove item from container */
|
||||
hash_table_remove(image_hash_table, item->filename);
|
||||
|
||||
/* destroy image and image item */
|
||||
rt_free(item->filename);
|
||||
rtgui_image_destroy(item->image);
|
||||
rt_free(item);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
340
components/rtgui_win/common/image_hdc.c
Normal file
340
components/rtgui_win/common/image_hdc.c
Normal file
@@ -0,0 +1,340 @@
|
||||
#include <rtthread.h>
|
||||
#include <rtgui/image.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/image_hdc.h>
|
||||
|
||||
#define HDC_MAGIC_LEN 4
|
||||
|
||||
struct rtgui_image_hdc
|
||||
{
|
||||
rt_bool_t is_loaded;
|
||||
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;//像素位数
|
||||
rt_uint16_t pitch;
|
||||
|
||||
rt_size_t pixel_offset; //像素偏移量
|
||||
rt_uint8_t *pixels; //像素指针
|
||||
|
||||
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(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load);
|
||||
static void rtgui_image_hdc_unload(rtgui_image_t* image);
|
||||
static void rtgui_image_hdc_blit (rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* rect);
|
||||
static void rtgui_image_hdc_paste(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect, rtgui_color_t shield_color);
|
||||
static void rtgui_image_hdc_mem_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect);
|
||||
static void rtgui_image_hdc_mem_paste(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect, rtgui_color_t shield_color);
|
||||
|
||||
//hdc image engine
|
||||
struct rtgui_image_engine image_hdc_engine =
|
||||
{
|
||||
"hdc",
|
||||
{RT_NULL},
|
||||
rtgui_image_hdc_check,
|
||||
rtgui_image_hdc_load,
|
||||
rtgui_image_hdc_unload,
|
||||
rtgui_image_hdc_blit,
|
||||
rtgui_image_hdc_paste
|
||||
};
|
||||
|
||||
const struct rtgui_image_engine rtgui_image_hdcmm_engine =
|
||||
{
|
||||
"hdcmm",
|
||||
{RT_NULL},
|
||||
{RT_NULL},
|
||||
{RT_NULL},
|
||||
{RT_NULL},
|
||||
rtgui_image_hdc_mem_blit,
|
||||
rtgui_image_hdc_mem_paste
|
||||
};
|
||||
|
||||
static rt_bool_t rtgui_image_hdc_check(struct rtgui_filerw* file)
|
||||
{
|
||||
int start;
|
||||
rt_bool_t is_HDC;
|
||||
rt_uint8_t magic[4];
|
||||
|
||||
if( !file ) return 0;
|
||||
|
||||
start = rtgui_filerw_tell(file);
|
||||
|
||||
/* 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);
|
||||
|
||||
return(is_HDC);
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_hdc_load(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load)
|
||||
{
|
||||
rt_uint32_t header[5];
|
||||
struct rtgui_image_hdc* hdc;
|
||||
|
||||
hdc = (struct rtgui_image_hdc*) rt_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; }
|
||||
|
||||
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 = &image_hdc_engine;
|
||||
image->data = hdc;
|
||||
hdc->filerw = file;
|
||||
hdc->byte_per_pixel = hdc->hw_driver->byte_per_pixel;
|
||||
hdc->pitch = image->w * hdc->byte_per_pixel;
|
||||
hdc->pixel_offset = rtgui_filerw_tell(file);
|
||||
|
||||
if(load == RT_TRUE)
|
||||
{
|
||||
/* load all pixels */
|
||||
hdc->pixels = rt_malloc(image->h * hdc->pitch);
|
||||
if(hdc->pixels == RT_NULL)
|
||||
{
|
||||
/* release data */
|
||||
rt_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;
|
||||
}
|
||||
|
||||
return RT_TRUE;
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_unload(rtgui_image_t* image)
|
||||
{
|
||||
struct rtgui_image_hdc* hdc;
|
||||
|
||||
if(image != RT_NULL)
|
||||
{
|
||||
hdc = (struct rtgui_image_hdc*) image->data;
|
||||
|
||||
if(hdc->pixels != RT_NULL) rt_free(hdc->pixels);
|
||||
if(hdc->filerw != RT_NULL)
|
||||
{
|
||||
rtgui_filerw_close(hdc->filerw);
|
||||
hdc->filerw = RT_NULL;
|
||||
}
|
||||
|
||||
/* release data */
|
||||
rt_free(hdc);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect)
|
||||
{
|
||||
rt_uint16_t y, w, h;
|
||||
struct rtgui_image_hdc* hdc;
|
||||
|
||||
RT_ASSERT(image != RT_NULL || dc != RT_NULL || dst_rect != RT_NULL);
|
||||
|
||||
hdc = (struct rtgui_image_hdc*) image->data;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* 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);
|
||||
|
||||
if(hdc->pixels != RT_NULL)
|
||||
{
|
||||
rt_uint8_t* ptr;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_uint8_t* ptr;
|
||||
ptr = rt_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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
rt_free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_paste(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect, rtgui_color_t shield_color)
|
||||
{
|
||||
rt_uint16_t x, y, w, h;
|
||||
struct rtgui_image_hdc* hdc;
|
||||
|
||||
RT_ASSERT(dc != RT_NULL || image != RT_NULL || dst_rect != RT_NULL);
|
||||
|
||||
hdc = (struct rtgui_image_hdc*)image->data;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* 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);
|
||||
|
||||
shield_color &= 0xFFFFFF;
|
||||
|
||||
if(hdc->pixels != RT_NULL)
|
||||
{
|
||||
rt_uint8_t* ptr;
|
||||
|
||||
/* get pixel pointer */
|
||||
ptr = hdc->pixels;
|
||||
|
||||
for(y = 0; y < h; y ++)
|
||||
{
|
||||
for(x = 0; x <w; x ++)
|
||||
{
|
||||
rtgui_color_t color = *(ptr+x*hdc->byte_per_pixel);
|
||||
color += *(ptr+x*hdc->byte_per_pixel+1)<<8;
|
||||
if(hdc->byte_per_pixel==2)
|
||||
color = rtgui_color_from_565(color);
|
||||
|
||||
if(color != shield_color)
|
||||
rtgui_dc_draw_color_point(dc, dst_rect->x1 + x, dst_rect->y1 + y, color);
|
||||
}
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_uint8_t* ptr;
|
||||
ptr = rt_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);
|
||||
|
||||
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(x = 0; x <w; x ++)
|
||||
{
|
||||
rtgui_color_t color = *(ptr+x*hdc->byte_per_pixel);
|
||||
color += *(ptr+x*hdc->byte_per_pixel+1)<<8;
|
||||
if(hdc->byte_per_pixel==2)
|
||||
color = rtgui_color_from_565(color);
|
||||
|
||||
if(color != shield_color)
|
||||
rtgui_dc_draw_color_point(dc, dst_rect->x1 + x, dst_rect->y1 + y, color);
|
||||
}
|
||||
}
|
||||
|
||||
rt_free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_mem_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect)
|
||||
{
|
||||
rt_uint8_t *ptr;
|
||||
rt_uint16_t y, w, h;
|
||||
struct rtgui_image_hdcmm *hdc;
|
||||
|
||||
RT_ASSERT(dc != RT_NULL || image != RT_NULL || dst_rect != RT_NULL);
|
||||
|
||||
hdc = (struct rtgui_image_hdcmm*) image;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* 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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_hdc_mem_paste(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* dst_rect, rtgui_color_t shield_color)
|
||||
{
|
||||
rt_uint8_t* ptr;
|
||||
rt_uint16_t x,y, w, h;
|
||||
struct rtgui_image_hdcmm *hdc;
|
||||
|
||||
RT_ASSERT(dc != RT_NULL || image != RT_NULL || dst_rect != RT_NULL);
|
||||
|
||||
hdc = (struct rtgui_image_hdcmm*)image;
|
||||
RT_ASSERT(hdc != RT_NULL);
|
||||
|
||||
/* 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;
|
||||
shield_color &= 0xFFFFFF;
|
||||
|
||||
for(y = 0; y < h; y ++)
|
||||
{
|
||||
for(x = 0; x <w; x ++)
|
||||
{
|
||||
rtgui_color_t color = *(ptr+x*hdc->byte_per_pixel);
|
||||
color += *(ptr+x*hdc->byte_per_pixel+1)<<8;
|
||||
if(hdc->byte_per_pixel==2)
|
||||
color = rtgui_color_from_565(color);
|
||||
|
||||
if(color != shield_color)
|
||||
rtgui_dc_draw_color_point(dc, dst_rect->x1 + x, dst_rect->y1 + y, color);
|
||||
}
|
||||
ptr += hdc->pitch;
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_image_hdc_init()
|
||||
{
|
||||
/* register hdc on image system */
|
||||
rtgui_image_register_engine(&image_hdc_engine);
|
||||
}
|
||||
|
||||
479
components/rtgui_win/common/image_jpg.c
Normal file
479
components/rtgui_win/common/image_jpg.c
Normal file
@@ -0,0 +1,479 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "jpeg/jpeglib.h"
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
#include <rtgui/filerw.h>
|
||||
#include <rtgui/image_jpeg.h>
|
||||
|
||||
static rt_bool_t rtgui_image_jpeg_check(struct rtgui_filerw* file);
|
||||
static rt_bool_t rtgui_image_jpeg_load(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load);
|
||||
static void rtgui_image_jpeg_unload(rtgui_image_t* image);
|
||||
static void rtgui_image_jpeg_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* rect);
|
||||
|
||||
struct rtgui_jpeg_error_mgr
|
||||
{
|
||||
struct jpeg_error_mgr pub; /* "public" fields */
|
||||
};
|
||||
|
||||
struct rtgui_image_jpeg
|
||||
{
|
||||
rt_bool_t is_loaded;
|
||||
|
||||
struct rtgui_filerw* filerw;
|
||||
|
||||
/* jpeg structure */
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct rtgui_jpeg_error_mgr errmgr;
|
||||
|
||||
rt_uint8_t *pixels;
|
||||
rt_uint8_t *line_pixels;
|
||||
};
|
||||
|
||||
struct rtgui_image_engine rtgui_image_jpeg_engine =
|
||||
{
|
||||
"jpeg",
|
||||
{RT_NULL},
|
||||
rtgui_image_jpeg_check,
|
||||
rtgui_image_jpeg_load,
|
||||
rtgui_image_jpeg_unload,
|
||||
rtgui_image_jpeg_blit,
|
||||
RT_NULL,
|
||||
};
|
||||
|
||||
#define INPUT_BUFFER_SIZE 4096
|
||||
typedef struct {
|
||||
struct jpeg_source_mgr pub;
|
||||
|
||||
struct rtgui_filerw* ctx;
|
||||
rt_uint8_t buffer[INPUT_BUFFER_SIZE];
|
||||
} rtgui_jpeg_source_mgr;
|
||||
|
||||
/*
|
||||
* Initialize source --- called by jpeg_read_header
|
||||
* before any data is actually read.
|
||||
*/
|
||||
static void init_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
/* We don't actually need to do anything */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill the input buffer --- called whenever buffer is emptied.
|
||||
*/
|
||||
static boolean fill_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
rtgui_jpeg_source_mgr * src = (rtgui_jpeg_source_mgr *) cinfo->src;
|
||||
int nbytes;
|
||||
|
||||
nbytes = rtgui_filerw_read(src->ctx, src->buffer, 1, INPUT_BUFFER_SIZE);
|
||||
if(nbytes <= 0)
|
||||
{
|
||||
/* Insert a fake EOI marker */
|
||||
src->buffer[0] = (rt_uint8_t) 0xFF;
|
||||
src->buffer[1] = (rt_uint8_t) JPEG_EOI;
|
||||
nbytes = 2;
|
||||
}
|
||||
|
||||
src->pub.next_input_byte = src->buffer;
|
||||
src->pub.bytes_in_buffer = nbytes;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Skip data --- used to skip over a potentially large amount of
|
||||
* uninteresting data (such as an APPn marker).
|
||||
*
|
||||
* Writers of suspendable-input applications must note that skip_input_data
|
||||
* is not granted the right to give a suspension return. If the skip extends
|
||||
* beyond the data currently in the buffer, the buffer can be marked empty so
|
||||
* that the next read will cause a fill_input_buffer call that can suspend.
|
||||
* Arranging for additional bytes to be discarded before reloading the input
|
||||
* buffer is the application writer's problem.
|
||||
*/
|
||||
static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
rtgui_jpeg_source_mgr * src = (rtgui_jpeg_source_mgr *) cinfo->src;
|
||||
|
||||
/* Just a dumb implementation for now. Could use fseek() except
|
||||
* it doesn't work on pipes. Not clear that being smart is worth
|
||||
* any trouble anyway --- large skips are infrequent.
|
||||
*/
|
||||
if(num_bytes > 0)
|
||||
{
|
||||
while(num_bytes > (long) src->pub.bytes_in_buffer)
|
||||
{
|
||||
num_bytes -= (long) src->pub.bytes_in_buffer;
|
||||
(void) src->pub.fill_input_buffer(cinfo);
|
||||
/* note we assume that fill_input_buffer will never
|
||||
* return FALSE, so suspension need not be handled.
|
||||
*/
|
||||
}
|
||||
src->pub.next_input_byte += (rt_size_t) num_bytes;
|
||||
src->pub.bytes_in_buffer -= (rt_size_t) num_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate source --- called by jpeg_finish_decompress
|
||||
* after all data has been read.
|
||||
*/
|
||||
static void term_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
/* We don't actually need to do anything */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare for input from a stdio stream.
|
||||
* The caller must have already opened the stream, and is responsible
|
||||
* for closing it after finishing decompression.
|
||||
*/
|
||||
static void rtgui_jpeg_filerw_src_init(j_decompress_ptr cinfo, struct rtgui_filerw *ctx)
|
||||
{
|
||||
rtgui_jpeg_source_mgr *src;
|
||||
|
||||
/* The source object and input buffer are made permanent so that a series
|
||||
* of JPEG images can be read from the same file by calling jpeg_stdio_src
|
||||
* only before the first one. (If we discarded the buffer at the end of
|
||||
* one image, we'd likely lose the start of the next one.)
|
||||
* This makes it unsafe to use this manager and a different source
|
||||
* manager serially with the same JPEG object. Caveat programmer.
|
||||
*/
|
||||
if(cinfo->src == RT_NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
sizeof(rtgui_jpeg_source_mgr));
|
||||
src = (rtgui_jpeg_source_mgr *) cinfo->src;
|
||||
}
|
||||
|
||||
src = (rtgui_jpeg_source_mgr *) cinfo->src;
|
||||
src->pub.init_source = init_source;
|
||||
src->pub.fill_input_buffer = fill_input_buffer;
|
||||
src->pub.skip_input_data = skip_input_data;
|
||||
src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
|
||||
src->pub.term_source = term_source;
|
||||
src->ctx = ctx;
|
||||
src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
|
||||
src->pub.next_input_byte = RT_NULL; /* until buffer loaded */
|
||||
}
|
||||
|
||||
/* get line data of a jpeg image */
|
||||
static rt_uint8_t *rtgui_image_get_line(rtgui_image_t* image, int h)
|
||||
{
|
||||
struct rtgui_image_jpeg* jpeg;
|
||||
rt_uint8_t *result_ptr;
|
||||
|
||||
JSAMPARRAY buffer; /* Output row buffer */
|
||||
int row_stride;
|
||||
|
||||
RT_ASSERT(image != RT_NULL);
|
||||
jpeg = (struct rtgui_image_jpeg*) image->data;
|
||||
RT_ASSERT(jpeg != RT_NULL);
|
||||
|
||||
if(h < 0 || h > image->h) return RT_NULL;
|
||||
|
||||
/* if the image is loaded, */
|
||||
if(jpeg->is_loaded == TRUE)
|
||||
{
|
||||
result_ptr = jpeg->pixels + (image->w * sizeof(rtgui_color_t)) * h;
|
||||
|
||||
return result_ptr;
|
||||
}
|
||||
|
||||
if(jpeg->line_pixels == RT_NULL)
|
||||
jpeg->line_pixels = rt_malloc(image->w * sizeof(rtgui_color_t));
|
||||
|
||||
row_stride = jpeg->cinfo.output_width * jpeg->cinfo.output_components;
|
||||
buffer = (*jpeg->cinfo.mem->alloc_sarray)
|
||||
((j_common_ptr) &jpeg->cinfo, JPOOL_IMAGE, row_stride, 1);
|
||||
|
||||
/* decompress line data */
|
||||
jpeg->cinfo.output_scanline = h;
|
||||
jpeg_read_scanlines(&jpeg->cinfo, buffer, (JDIMENSION) 1);
|
||||
|
||||
/* copy pixels memory */
|
||||
{
|
||||
int index;
|
||||
rtgui_color_t *ptr;
|
||||
|
||||
ptr = (rtgui_color_t*)jpeg->line_pixels;
|
||||
for(index = 0; index < image->w; index ++)
|
||||
ptr[index] = RTGUI_ARGB(0, buffer[0][index*3], buffer[0][index*3+1], buffer[0][index*3+2]);
|
||||
}
|
||||
|
||||
return jpeg->line_pixels;
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_jpeg_loadall(rtgui_image_t* image)
|
||||
{
|
||||
struct rtgui_image_jpeg* jpeg;
|
||||
rt_uint8_t* line_ptr;
|
||||
JSAMPARRAY buffer; /* Output row buffer */
|
||||
int row_stride;
|
||||
|
||||
jpeg = (struct rtgui_image_jpeg*) image->data;
|
||||
RT_ASSERT(jpeg != RT_NULL);
|
||||
|
||||
/* already load */
|
||||
if(jpeg->pixels != RT_NULL) return TRUE;
|
||||
|
||||
/* allocate all pixels */
|
||||
jpeg->pixels = rt_malloc(image->h * image->w * sizeof(rtgui_color_t));
|
||||
if(jpeg->pixels == RT_NULL) return FALSE;
|
||||
|
||||
/* reset scan line to zero */
|
||||
jpeg->cinfo.output_scanline = 0;
|
||||
line_ptr = jpeg->pixels;
|
||||
|
||||
row_stride = jpeg->cinfo.output_width * jpeg->cinfo.output_components;
|
||||
buffer = (*jpeg->cinfo.mem->alloc_sarray)
|
||||
((j_common_ptr) &jpeg->cinfo, JPOOL_IMAGE, row_stride, 1);
|
||||
|
||||
/* decompress all pixels */
|
||||
while(jpeg->cinfo.output_scanline < jpeg->cinfo.output_height)
|
||||
{
|
||||
/* jpeg_read_scanlines expects an array of pointers to scanlines.
|
||||
* Here the array is only one element long, but you could ask for
|
||||
* more than one scanline at a time if that's more convenient.
|
||||
*/
|
||||
(void) jpeg_read_scanlines(&jpeg->cinfo, buffer, 1);
|
||||
|
||||
/* copy pixels memory */
|
||||
{
|
||||
int index;
|
||||
rtgui_color_t *ptr;
|
||||
|
||||
ptr = (rtgui_color_t*)line_ptr;
|
||||
for(index = 0; index < image->w; index ++)
|
||||
ptr[index] = RTGUI_ARGB(0, buffer[0][index*3], buffer[0][index*3+1], buffer[0][index*3+2]);
|
||||
}
|
||||
|
||||
/* move to next line */
|
||||
line_ptr += image->w * sizeof(rtgui_color_t);
|
||||
}
|
||||
|
||||
/* decompress done */
|
||||
rtgui_filerw_close(jpeg->filerw);
|
||||
jpeg_finish_decompress(&jpeg->cinfo);
|
||||
|
||||
jpeg->is_loaded = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void rtgui_image_jpeg_init()
|
||||
{
|
||||
/* register jpeg on image system */
|
||||
rtgui_image_register_engine(&rtgui_image_jpeg_engine);
|
||||
}
|
||||
|
||||
static void my_error_exit(j_common_ptr cinfo)
|
||||
{
|
||||
}
|
||||
|
||||
static void output_no_message(j_common_ptr cinfo)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_jpeg_load(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load)
|
||||
{
|
||||
struct rtgui_image_jpeg* jpeg;
|
||||
|
||||
jpeg = (struct rtgui_image_jpeg*) rt_malloc(sizeof(struct rtgui_image_jpeg));
|
||||
if(jpeg == RT_NULL) return FALSE;
|
||||
|
||||
jpeg->filerw = file;
|
||||
|
||||
/* read file header */
|
||||
/* Create a decompression structure and load the JPEG header */
|
||||
jpeg->cinfo.err = jpeg_std_error(&jpeg->errmgr.pub);
|
||||
jpeg->errmgr.pub.error_exit = my_error_exit;
|
||||
jpeg->errmgr.pub.output_message = output_no_message;
|
||||
|
||||
jpeg_create_decompress(&jpeg->cinfo);
|
||||
rtgui_jpeg_filerw_src_init(&jpeg->cinfo, jpeg->filerw);
|
||||
(void)jpeg_read_header(&jpeg->cinfo, TRUE);
|
||||
|
||||
image->w = jpeg->cinfo.image_width;
|
||||
image->h = jpeg->cinfo.image_height;
|
||||
|
||||
/* set image private data and engine */
|
||||
image->data = jpeg;
|
||||
image->engine = &rtgui_image_jpeg_engine;
|
||||
|
||||
/* start decompression */
|
||||
(void) jpeg_start_decompress(&jpeg->cinfo);
|
||||
|
||||
jpeg->cinfo.out_color_space = JCS_RGB;
|
||||
jpeg->cinfo.quantize_colors = FALSE;
|
||||
/* use fast jpeg */
|
||||
jpeg->cinfo.scale_num = 1;
|
||||
jpeg->cinfo.scale_denom = 1;
|
||||
jpeg->cinfo.dct_method = JDCT_FASTEST;
|
||||
jpeg->cinfo.do_fancy_upsampling = FALSE;
|
||||
|
||||
jpeg->pixels = RT_NULL;
|
||||
jpeg->is_loaded = FALSE;
|
||||
|
||||
/* allocate line pixels */
|
||||
jpeg->line_pixels = rt_malloc(image->w * sizeof(rtgui_color_t));
|
||||
if(jpeg->line_pixels == RT_NULL)
|
||||
{
|
||||
/* no memory */
|
||||
jpeg_finish_decompress(&jpeg->cinfo);
|
||||
rt_free(jpeg);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(load == TRUE) rtgui_image_jpeg_loadall(image);
|
||||
|
||||
/* create jpeg image successful */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void rtgui_image_jpeg_unload(rtgui_image_t* image)
|
||||
{
|
||||
if(image != RT_NULL)
|
||||
{
|
||||
struct rtgui_image_jpeg* jpeg;
|
||||
|
||||
jpeg = (struct rtgui_image_jpeg*) image->data;
|
||||
RT_ASSERT(jpeg != RT_NULL);
|
||||
|
||||
if(jpeg->is_loaded == TRUE)
|
||||
rt_free(jpeg->pixels);
|
||||
if(jpeg->line_pixels != RT_NULL) rt_free(jpeg->line_pixels);
|
||||
|
||||
if(jpeg->is_loaded != TRUE)
|
||||
{
|
||||
rtgui_filerw_close(jpeg->filerw);
|
||||
jpeg_finish_decompress(&jpeg->cinfo);
|
||||
}
|
||||
rt_free(jpeg);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_jpeg_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* rect)
|
||||
{
|
||||
rt_uint16_t x, y;
|
||||
rtgui_color_t* ptr;
|
||||
struct rtgui_image_jpeg* jpeg;
|
||||
|
||||
RT_ASSERT(image != RT_NULL && rect != RT_NULL);
|
||||
|
||||
jpeg = (struct rtgui_image_jpeg*) image->data;
|
||||
RT_ASSERT(jpeg != RT_NULL);
|
||||
|
||||
if(jpeg->pixels != RT_NULL)
|
||||
{
|
||||
ptr = (rtgui_color_t*) jpeg->pixels;
|
||||
|
||||
/* draw each point within gdi */
|
||||
for(y = 0; y < image->h; y ++)
|
||||
{
|
||||
for(x = 0; x < image->w; x++)
|
||||
{
|
||||
/* not alpha */
|
||||
if((*ptr >> 24) != 255)
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1, *ptr);
|
||||
}
|
||||
|
||||
/* move to next color buffer */
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* seek to the begin of file */
|
||||
rtgui_filerw_seek(jpeg->filerw, 0, SEEK_SET);
|
||||
|
||||
/* decompress line and line */
|
||||
for(y = 0; y < image->h; y ++)
|
||||
{
|
||||
ptr = (rtgui_color_t*)rtgui_image_get_line(image, y);
|
||||
for(x = 0; x < image->w; x++)
|
||||
{
|
||||
/* not alpha */
|
||||
if((*ptr >> 24) != 255)
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1, *ptr);
|
||||
}
|
||||
|
||||
/* move to next color buffer */
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_jpeg_check(struct rtgui_filerw* file)
|
||||
{
|
||||
int start;
|
||||
rt_bool_t is_JPG;
|
||||
int in_scan;
|
||||
rt_uint8_t magic[4];
|
||||
|
||||
if(file == RT_NULL) return FALSE; /* open file failed */
|
||||
|
||||
start = rtgui_filerw_tell(file);
|
||||
is_JPG = FALSE;
|
||||
in_scan = 0;
|
||||
|
||||
/* seek to the begining of file */
|
||||
rtgui_filerw_seek(file, 0, SEEK_SET);
|
||||
|
||||
if( rtgui_filerw_read(file, magic, 2, 1) ) {
|
||||
if( (magic[0] == 0xFF) && (magic[1] == 0xD8) ) {
|
||||
is_JPG = TRUE;
|
||||
while(is_JPG == TRUE) {
|
||||
if(rtgui_filerw_read(file, magic, 1, 2) != 2) {
|
||||
is_JPG = FALSE;
|
||||
} else if( (magic[0] != 0xFF) && (in_scan == 0) ) {
|
||||
is_JPG = FALSE;
|
||||
} else if( (magic[0] != 0xFF) || (magic[1] == 0xFF) ) {
|
||||
/* Extra padding in JPEG (legal) */
|
||||
/* or this is data and we are scanning */
|
||||
rtgui_filerw_seek(file, -1, SEEK_CUR);
|
||||
} else if(magic[1] == 0xD9) {
|
||||
/* Got to end of good JPEG */
|
||||
break;
|
||||
} else if( (in_scan == 1) && (magic[1] == 0x00) ) {
|
||||
/* This is an encoded 0xFF within the data */
|
||||
} else if( (magic[1] >= 0xD0) && (magic[1] < 0xD9) ) {
|
||||
/* These have nothing else */
|
||||
} else if(rtgui_filerw_read(file, magic+2, 1, 2) != 2) {
|
||||
is_JPG = FALSE;
|
||||
} else {
|
||||
/* Yes, it's big-endian */
|
||||
rt_uint32_t start;
|
||||
rt_uint32_t size;
|
||||
rt_uint32_t end;
|
||||
start = rtgui_filerw_tell(file);
|
||||
size = (magic[2] << 8) + magic[3];
|
||||
end = rtgui_filerw_seek(file, size-2, SEEK_CUR);
|
||||
if( end != start + size - 2 ) is_JPG = FALSE;
|
||||
if( magic[1] == 0xDA ) {
|
||||
/* Now comes the actual JPEG meat */
|
||||
/* It is a JPEG. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rtgui_filerw_seek(file, start, SEEK_SET);
|
||||
|
||||
return is_JPG;
|
||||
}
|
||||
|
||||
317
components/rtgui_win/common/image_png.c
Normal file
317
components/rtgui_win/common/image_png.c
Normal file
@@ -0,0 +1,317 @@
|
||||
#include "libpng/png.h"
|
||||
#include <rtthread.h>
|
||||
#include <rtgui/image_png.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
#define PNG_MAGIC_LEN 8
|
||||
|
||||
struct rtgui_image_png
|
||||
{
|
||||
rt_bool_t is_loaded;
|
||||
|
||||
struct rtgui_filerw* filerw;
|
||||
|
||||
/* png image information */
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
|
||||
rt_uint8_t *pixels;
|
||||
};
|
||||
|
||||
static rt_bool_t rtgui_image_png_check(struct rtgui_filerw* file);
|
||||
static rt_bool_t rtgui_image_png_load(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load);
|
||||
static void rtgui_image_png_unload(rtgui_image_t* image);
|
||||
static void rtgui_image_png_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* rect);
|
||||
|
||||
struct rtgui_image_engine rtgui_image_png_engine =
|
||||
{
|
||||
"png",
|
||||
{ RT_NULL },
|
||||
rtgui_image_png_check,
|
||||
rtgui_image_png_load,
|
||||
rtgui_image_png_unload,
|
||||
rtgui_image_png_blit
|
||||
};
|
||||
|
||||
static void rtgui_image_png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
rtgui_filerw_t* filerw = (struct rtgui_filerw*)png_ptr->io_ptr;
|
||||
|
||||
rtgui_filerw_read(filerw, data, length, 1);
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr, struct rtgui_image_png* png)
|
||||
{
|
||||
rt_uint32_t x, y;
|
||||
png_bytep row;
|
||||
png_bytep data;
|
||||
rtgui_color_t *ptr;
|
||||
|
||||
row = (png_bytep) rt_malloc (png_get_rowbytes(png_ptr, info_ptr));
|
||||
if(row == RT_NULL) return FALSE;
|
||||
|
||||
ptr = (rtgui_color_t *)png->pixels;
|
||||
|
||||
switch (info_ptr->color_type)
|
||||
{
|
||||
case PNG_COLOR_TYPE_RGBA:
|
||||
for(y = 0; y < info_ptr->height; y++)
|
||||
{
|
||||
png_read_row(png_ptr, row, png_bytep_NULL);
|
||||
for(x = 0; x < info_ptr->width; x++)
|
||||
{
|
||||
data = &(row[x * 4]);
|
||||
|
||||
ptr[x+y*info_ptr->width] = RTGUI_ARGB((255 - data[3]), data[0], data[1], data[2]);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
for(y = 0; y < info_ptr->height; y++)
|
||||
{
|
||||
png_read_row(png_ptr, row, png_bytep_NULL);
|
||||
for(x = 0; x < info_ptr->width; x++)
|
||||
{
|
||||
data = &(row[x]);
|
||||
|
||||
ptr[x] = RTGUI_ARGB(0, info_ptr->palette[data[0]].red,
|
||||
info_ptr->palette[data[0]].green,
|
||||
info_ptr->palette[data[0]].blue);
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
rt_free(row);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_png_check(struct rtgui_filerw* file)
|
||||
{
|
||||
int start;
|
||||
rt_bool_t is_PNG;
|
||||
rt_uint8_t magic[4];
|
||||
|
||||
if( !file ) return 0;
|
||||
|
||||
start = rtgui_filerw_tell(file);
|
||||
|
||||
/* move to the begining of file */
|
||||
rtgui_filerw_seek(file, 0, SEEK_SET);
|
||||
|
||||
is_PNG = FALSE;
|
||||
if( rtgui_filerw_read(file, magic, 1, sizeof(magic)) == sizeof(magic) )
|
||||
{
|
||||
if( magic[0] == 0x89 &&
|
||||
magic[1] == 'P' &&
|
||||
magic[2] == 'N' &&
|
||||
magic[3] == 'G' )
|
||||
{
|
||||
is_PNG = TRUE;
|
||||
}
|
||||
}
|
||||
rtgui_filerw_seek(file, start, SEEK_SET);
|
||||
|
||||
return(is_PNG);
|
||||
}
|
||||
|
||||
static rt_bool_t rtgui_image_png_load(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load)
|
||||
{
|
||||
png_uint_32 width;
|
||||
png_uint_32 height;
|
||||
int bit_depth;
|
||||
int color_type;
|
||||
double gamma;
|
||||
struct rtgui_image_png* png;
|
||||
|
||||
png = (struct rtgui_image_png*) rt_malloc(sizeof(struct rtgui_image_png));
|
||||
png->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, RT_NULL, RT_NULL, RT_NULL);
|
||||
if(png->png_ptr == RT_NULL)
|
||||
{
|
||||
rt_free(png);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
png->info_ptr = png_create_info_struct(png->png_ptr);
|
||||
if(png->info_ptr == RT_NULL)
|
||||
{
|
||||
png_destroy_read_struct(&png->png_ptr, RT_NULL, RT_NULL);
|
||||
rt_free(png);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
png->filerw = file;
|
||||
png_set_read_fn (png->png_ptr, png->filerw, rtgui_image_png_read_data);
|
||||
|
||||
png_read_info(png->png_ptr, png->info_ptr);
|
||||
png_get_IHDR(png->png_ptr, png->info_ptr, &width, &height, &bit_depth,
|
||||
&color_type, RT_NULL, RT_NULL, RT_NULL);
|
||||
|
||||
/* set image information */
|
||||
image->w = width; image->h = height;
|
||||
image->engine = &rtgui_image_png_engine;
|
||||
image->data = png;
|
||||
|
||||
if(bit_depth == 16)
|
||||
png_set_strip_16(png->png_ptr);
|
||||
if(color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_expand(png->png_ptr);
|
||||
if(bit_depth < 8)
|
||||
png_set_expand(png->png_ptr);
|
||||
if(png_get_valid(png->png_ptr, png->info_ptr, PNG_INFO_tRNS))
|
||||
png_set_expand(png->png_ptr);
|
||||
if(color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png->png_ptr);
|
||||
|
||||
/* Ignore background color */
|
||||
|
||||
/* set gamma conversion */
|
||||
if(png_get_gAMA(png->png_ptr, png->info_ptr, &gamma))
|
||||
png_set_gamma(png->png_ptr, (double)2.2, gamma);
|
||||
|
||||
png_read_update_info(png->png_ptr, png->info_ptr);
|
||||
|
||||
if(load == TRUE)
|
||||
{
|
||||
/* load all pixels */
|
||||
png->pixels = rt_malloc(image->w * image->h * sizeof(rtgui_color_t));
|
||||
if(png->pixels == RT_NULL)
|
||||
{
|
||||
png_read_end(png->png_ptr, RT_NULL);
|
||||
|
||||
/* destroy png struct */
|
||||
png_destroy_info_struct(png->png_ptr, &png->info_ptr);
|
||||
png_destroy_read_struct(&png->png_ptr, RT_NULL, RT_NULL);
|
||||
|
||||
/* release data */
|
||||
rt_free(png);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rtgui_image_png_process(png->png_ptr, png->info_ptr, png);
|
||||
}
|
||||
else
|
||||
{
|
||||
png->pixels = RT_NULL;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void rtgui_image_png_unload(rtgui_image_t* image)
|
||||
{
|
||||
struct rtgui_image_png* png;
|
||||
|
||||
if(image != RT_NULL)
|
||||
{
|
||||
png = (struct rtgui_image_png*) image->data;
|
||||
|
||||
png_read_end(png->png_ptr, RT_NULL);
|
||||
|
||||
/* destroy png struct */
|
||||
png_destroy_info_struct(png->png_ptr, &png->info_ptr);
|
||||
png_destroy_read_struct(&png->png_ptr, RT_NULL, RT_NULL);
|
||||
|
||||
if(png->pixels != RT_NULL) rt_free(png->pixels);
|
||||
|
||||
/* release data */
|
||||
rt_free(png);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtgui_image_png_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* rect)
|
||||
{
|
||||
rt_uint16_t x, y, w, h;
|
||||
rtgui_color_t* ptr;
|
||||
struct rtgui_image_png* png;
|
||||
|
||||
RT_ASSERT(image != RT_NULL && rect != RT_NULL);
|
||||
RT_ASSERT(image->data != RT_NULL);
|
||||
|
||||
png = (struct rtgui_image_png*) image->data;
|
||||
|
||||
if(image->w < rtgui_rect_width(*rect)) w = image->w;
|
||||
else w = rtgui_rect_width(*rect);
|
||||
if(image->h < rtgui_rect_height(*rect)) h = image->h;
|
||||
else h = rtgui_rect_height(*rect);
|
||||
|
||||
if(png->pixels != RT_NULL)
|
||||
{
|
||||
ptr = (rtgui_color_t*)png->pixels;
|
||||
/* draw each point within gdi */
|
||||
for(y = 0; y < h; y ++)
|
||||
{
|
||||
for(x = 0; x < w; x++)
|
||||
{
|
||||
/* not alpha */
|
||||
if((*ptr >> 24) != 255)
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1, *ptr);
|
||||
}
|
||||
|
||||
/* move to next color buffer */
|
||||
ptr ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
png_bytep row;
|
||||
png_bytep data;
|
||||
|
||||
row = (png_bytep) rt_malloc (png_get_rowbytes(png->png_ptr, png->info_ptr));
|
||||
if(row == RT_NULL) return ;
|
||||
|
||||
switch (png->info_ptr->color_type)
|
||||
{
|
||||
case PNG_COLOR_TYPE_RGBA:
|
||||
for(y = 0; y < h; y++)
|
||||
{
|
||||
png_read_row(png->png_ptr, row, png_bytep_NULL);
|
||||
for(x = 0; x < w; x++)
|
||||
{
|
||||
data = &(row[x * 4]);
|
||||
if(data[3] != 0)
|
||||
{
|
||||
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1,
|
||||
RTGUI_ARGB((255 - data[3]), data[0], data[1], data[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
for(y = 0; y < h; y++)
|
||||
{
|
||||
png_read_row(png->png_ptr, row, png_bytep_NULL);
|
||||
for (x = 0; x < w; x++)
|
||||
{
|
||||
data = &(row[x]);
|
||||
|
||||
rtgui_dc_draw_color_point(dc, x + rect->x1, y + rect->y1,
|
||||
RTGUI_ARGB(0, png->info_ptr->palette[data[0]].red,
|
||||
png->info_ptr->palette[data[0]].green,
|
||||
png->info_ptr->palette[data[0]].blue));
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
rt_free(row);
|
||||
}
|
||||
}
|
||||
|
||||
void rtgui_image_png_init()
|
||||
{
|
||||
/* register png on image system */
|
||||
rtgui_image_register_engine(&rtgui_image_png_engine);
|
||||
}
|
||||
613
components/rtgui_win/common/image_xpm.c
Normal file
613
components/rtgui_win/common/image_xpm.c
Normal file
File diff suppressed because it is too large
Load Diff
2267
components/rtgui_win/common/region.c
Normal file
2267
components/rtgui_win/common/region.c
Normal file
File diff suppressed because it is too large
Load Diff
242
components/rtgui_win/common/rtgui_object.c
Normal file
242
components/rtgui_win/common/rtgui_object.c
Normal file
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* File : rtgui_object.c
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-04 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtgui/rtgui_object.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
static void _rtgui_object_constructor(rtgui_object_t *object)
|
||||
{
|
||||
if (!object) return;
|
||||
|
||||
object->is_static = RT_FALSE;
|
||||
}
|
||||
|
||||
/* Destroys the object */
|
||||
static void _rtgui_object_destructor(rtgui_object_t *object)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
rtgui_type_t *rtgui_type_create(const char *type_name, rtgui_type_t *parent_type,
|
||||
int type_size, rtgui_constructor_t constructor,
|
||||
rtgui_destructor_t destructor)
|
||||
{
|
||||
rtgui_type_t *new_type;
|
||||
|
||||
if (!type_name)
|
||||
return RT_NULL;
|
||||
|
||||
new_type = rtgui_malloc(sizeof(rtgui_type_t));
|
||||
new_type->name = rt_strdup(type_name);
|
||||
new_type->size = type_size;
|
||||
new_type->constructor = constructor;
|
||||
new_type->destructor = destructor;
|
||||
|
||||
if (!parent_type)
|
||||
{
|
||||
new_type->hierarchy_depth = 0;
|
||||
new_type->hierarchy = RT_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Build the type hierarchy */
|
||||
new_type->hierarchy_depth = parent_type->hierarchy_depth + 1;
|
||||
new_type->hierarchy = rtgui_malloc(sizeof(rtgui_type_t *) * new_type->hierarchy_depth);
|
||||
|
||||
new_type->hierarchy[0] = parent_type;
|
||||
rt_memcpy(new_type->hierarchy + 1, parent_type->hierarchy,
|
||||
parent_type->hierarchy_depth * sizeof(rtgui_type_t *));
|
||||
}
|
||||
|
||||
return new_type;
|
||||
}
|
||||
|
||||
void rtgui_type_destroy(rtgui_type_t *type)
|
||||
{
|
||||
if (!type) return;
|
||||
|
||||
if (type->hierarchy) rtgui_free(type->hierarchy);
|
||||
|
||||
rtgui_free(type->name);
|
||||
rtgui_free(type);
|
||||
}
|
||||
|
||||
void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!type || !object) return;
|
||||
|
||||
/* Call the constructors */
|
||||
for (i = type->hierarchy_depth - 1; i >= 0; i--)
|
||||
{
|
||||
if (type->hierarchy[i]->constructor)
|
||||
type->hierarchy[i]->constructor(object);
|
||||
}
|
||||
if (type->constructor) type->constructor(object);
|
||||
}
|
||||
|
||||
void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!type || !object) return;
|
||||
|
||||
if (type->destructor) type->destructor(object);
|
||||
for (i = 0; i < type->hierarchy_depth; i++)
|
||||
{
|
||||
if (type->hierarchy[i]->destructor)
|
||||
type->hierarchy[i]->destructor(object);
|
||||
}
|
||||
}
|
||||
|
||||
rt_bool_t rtgui_type_inherits_from(rtgui_type_t *type, rtgui_type_t *parent)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!type || !parent) return RT_FALSE;
|
||||
|
||||
if (type == parent) return RT_TRUE;
|
||||
|
||||
for (i = 0; i < type->hierarchy_depth; i++)
|
||||
{
|
||||
if (type->hierarchy[i] == parent) return RT_TRUE;
|
||||
}
|
||||
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
rtgui_type_t *rtgui_type_parent_type_get(rtgui_type_t *type)
|
||||
{
|
||||
if (!type || !type->hierarchy) return RT_NULL;
|
||||
|
||||
return type->hierarchy[0];
|
||||
}
|
||||
|
||||
const char *rtgui_type_name_get(rtgui_type_t *type)
|
||||
{
|
||||
if (!type) return RT_NULL;
|
||||
|
||||
return type->name;
|
||||
}
|
||||
|
||||
struct rtgui_object_information
|
||||
{
|
||||
rt_uint32_t objs_number;
|
||||
rt_uint32_t allocated_size;
|
||||
rt_uint32_t max_allocated;
|
||||
};
|
||||
struct rtgui_object_information obj_info = {0, 0, 0};
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type)
|
||||
{
|
||||
rtgui_object_t *new_object;
|
||||
|
||||
if (!object_type)
|
||||
return RT_NULL;
|
||||
|
||||
new_object = rtgui_malloc(object_type->size);
|
||||
if (new_object == RT_NULL) return RT_NULL;
|
||||
|
||||
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;
|
||||
|
||||
new_object->type = object_type;
|
||||
new_object->is_static = RT_FALSE;
|
||||
|
||||
rtgui_type_object_construct(object_type, new_object);
|
||||
|
||||
return new_object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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).
|
||||
* @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->is_static == RT_TRUE) return;
|
||||
|
||||
obj_info.objs_number --;
|
||||
obj_info.allocated_size -= object->type->size;
|
||||
|
||||
/* call destructor */
|
||||
RT_ASSERT(object->type != RT_NULL);
|
||||
rtgui_type_destructors_call(object->type, object);
|
||||
|
||||
/* release object */
|
||||
rtgui_free(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @brief Gets the type of a rtgui_object
|
||||
* @return Returns the type of a rtgui_object
|
||||
*/
|
||||
rtgui_type_t *rtgui_object_type_get(void)
|
||||
{
|
||||
static rtgui_type_t *object_type = RT_NULL;
|
||||
|
||||
if (!object_type)
|
||||
{
|
||||
object_type = rtgui_type_create("object", RT_NULL,
|
||||
sizeof(rtgui_object_t), RTGUI_CONSTRUCTOR(_rtgui_object_constructor),
|
||||
RTGUI_DESTRUCTOR(_rtgui_object_destructor));
|
||||
}
|
||||
|
||||
return object_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
* @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 *object, rtgui_type_t *type)
|
||||
{
|
||||
if (!object) return RT_NULL;
|
||||
|
||||
if (!rtgui_type_inherits_from(object->type, type))
|
||||
{
|
||||
rt_kprintf("Invalid cast from \"%s\" to \"%s\"\n", rtgui_type_name_get(object->type), rtgui_type_name_get(type));
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the type of the object
|
||||
* @param object an object
|
||||
* @return Returns the type of @a object (RT_NULL on failure)
|
||||
*/
|
||||
rtgui_type_t *rtgui_object_object_type_get(rtgui_object_t *object)
|
||||
{
|
||||
if (!object) return RT_NULL;
|
||||
|
||||
return object->type;
|
||||
}
|
||||
750
components/rtgui_win/common/rtgui_system.c
Normal file
750
components/rtgui_win/common/rtgui_system.c
Normal file
File diff suppressed because it is too large
Load Diff
1312
components/rtgui_win/common/rtgui_theme.c
Normal file
1312
components/rtgui_win/common/rtgui_theme.c
Normal file
File diff suppressed because it is too large
Load Diff
291
components/rtgui_win/common/rtgui_xml.c
Normal file
291
components/rtgui_win/common/rtgui_xml.c
Normal file
@@ -0,0 +1,291 @@
|
||||
#include <rtgui/rtgui_xml.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
/* Internal states that the parser can be in at any given time. */
|
||||
enum {
|
||||
STAT_START = 0, /* starting base state, default state */
|
||||
STAT_TEXT, /* text state */
|
||||
STAT_START_TAG, /* start tag state */
|
||||
STAT_START_TAGNAME, /* start tagname state */
|
||||
STAT_START_TAGNAME_END, /* start tagname ending state */
|
||||
STAT_END_TAG, /* end tag state */
|
||||
STAT_END_TAGNAME, /* end tag tagname state */
|
||||
STAT_END_TAGNAME_END, /* end tag tagname ending */
|
||||
STAT_EMPTY_TAG, /* empty tag state */
|
||||
STAT_SPACE, /* linear whitespace state */
|
||||
STAT_ATTR_NAME, /* attribute name state */
|
||||
STAT_ATTR_NAME_END, /* attribute name ending state */
|
||||
STAT_ATTR_VAL, /* attribute value starting state */
|
||||
STAT_ATTR_VAL2, /* attribute value state */
|
||||
STAT_ERROR /* error state */
|
||||
};
|
||||
|
||||
/* character classes that we will match against; This could be expanded if
|
||||
need be, however, we are aiming for simple. */
|
||||
enum {
|
||||
CLASS_TYPE_NONE = 0, /* matches nothing, a base state */
|
||||
CLASS_TYPE_LEFT_ANGLE, /* matches start tag '<' */
|
||||
CLASS_TYPE_SLASH, /* matches forward slash */
|
||||
CLASS_TYPE_RIGHT_ANGLE, /* matches end tag '>' */
|
||||
CLASS_TYPE_EQUALS, /* matches equals sign */
|
||||
CLASS_TYPE_QUOTE, /* matches double-quotes */
|
||||
CLASS_TYPE_LETTERS, /* matches a-zA-Z letters and digits 0-9 */
|
||||
CLASS_TYPE_SPACE, /* matches whitespace */
|
||||
CLASS_TYPE_ANY /* matches any ASCII character; will match all
|
||||
above classes */
|
||||
};
|
||||
|
||||
/* xml state transition table */
|
||||
struct rtgui_xml_state
|
||||
{
|
||||
rt_uint8_t state;
|
||||
rt_uint8_t class_type;
|
||||
rt_uint8_t next_state;
|
||||
rt_uint8_t event;
|
||||
};
|
||||
|
||||
/* Note: States must be grouped in match order AND grouped together! */
|
||||
static const struct rtgui_xml_state RTGUI_XML_STATES [] = {
|
||||
/* [0-2] starting state, which also serves as the default state in case
|
||||
of error */
|
||||
{ STAT_START, CLASS_TYPE_SPACE, STAT_SPACE, EVENT_NONE },
|
||||
{ STAT_START, CLASS_TYPE_LEFT_ANGLE, STAT_START_TAG, EVENT_NONE },
|
||||
{ STAT_START, CLASS_TYPE_ANY, STAT_TEXT, EVENT_COPY },
|
||||
|
||||
/* [3-5] space state handles linear white space */
|
||||
{ STAT_SPACE, CLASS_TYPE_SPACE, STAT_SPACE, EVENT_NONE },
|
||||
{ STAT_SPACE, CLASS_TYPE_LEFT_ANGLE, STAT_START_TAG, EVENT_TEXT },
|
||||
{ STAT_SPACE, CLASS_TYPE_ANY, STAT_TEXT, EVENT_COPY },
|
||||
|
||||
/* [6-8] handle start tag */
|
||||
{ STAT_START_TAG, CLASS_TYPE_LETTERS, STAT_START_TAGNAME, EVENT_COPY },
|
||||
{ STAT_START_TAG, CLASS_TYPE_SLASH, STAT_END_TAG, EVENT_COPY },
|
||||
/* below added since some individuals get a little carried away with
|
||||
spacing around tag names, e.g. < tag > */
|
||||
{ STAT_START_TAG, CLASS_TYPE_SPACE, STAT_START_TAG, EVENT_NONE },
|
||||
|
||||
/* [9-12] handle start tag name */
|
||||
{ STAT_START_TAGNAME, CLASS_TYPE_LETTERS, STAT_START_TAGNAME, EVENT_NONE },
|
||||
{ STAT_START_TAGNAME, CLASS_TYPE_SPACE, STAT_START_TAGNAME_END, EVENT_START },
|
||||
/* below added for tags without any space between tag and ending
|
||||
slash, e.g., <br/> */
|
||||
{ STAT_START_TAGNAME, CLASS_TYPE_SLASH, STAT_EMPTY_TAG, EVENT_END },
|
||||
{ STAT_START_TAGNAME, CLASS_TYPE_RIGHT_ANGLE, STAT_START, EVENT_START },
|
||||
|
||||
/* [13-16] handle start tag name end */
|
||||
{ STAT_START_TAGNAME_END, CLASS_TYPE_LETTERS, STAT_ATTR_NAME, EVENT_COPY },
|
||||
/* below added to handle additional space in between attribute value
|
||||
pairs in start tags, e.g., <tag attr="2" attr2="test" > */
|
||||
{ STAT_START_TAGNAME_END, CLASS_TYPE_SPACE, STAT_START_TAGNAME_END, EVENT_NONE },
|
||||
{ STAT_START_TAGNAME_END, CLASS_TYPE_RIGHT_ANGLE, STAT_START, EVENT_START },
|
||||
/* below supports tags that are self-closing, e.g., <br /> */
|
||||
{ STAT_START_TAGNAME_END, CLASS_TYPE_SLASH, STAT_EMPTY_TAG, EVENT_COPY },
|
||||
|
||||
/* [17] handle empty tags, e.g., <br /> */
|
||||
{ STAT_EMPTY_TAG, CLASS_TYPE_RIGHT_ANGLE, STAT_START, EVENT_END },
|
||||
|
||||
/* [18] handle end tag, e.g., <tag /> */
|
||||
{ STAT_END_TAG, CLASS_TYPE_LETTERS, STAT_END_TAGNAME, EVENT_NONE },
|
||||
|
||||
/* [19-21] handle end tag name */
|
||||
{ STAT_END_TAGNAME, CLASS_TYPE_LETTERS, STAT_END_TAGNAME, EVENT_NONE },
|
||||
{ STAT_END_TAGNAME, CLASS_TYPE_RIGHT_ANGLE, STAT_START, EVENT_END },
|
||||
/* below adds support for spaces at the end of an end tag (before
|
||||
closing bracket) */
|
||||
{ STAT_END_TAGNAME, CLASS_TYPE_SPACE, STAT_END_TAGNAME_END, EVENT_END },
|
||||
|
||||
/* [22] handle ending of end tag name */
|
||||
{ STAT_END_TAGNAME_END, CLASS_TYPE_SPACE, STAT_END_TAGNAME_END, EVENT_NONE },
|
||||
{ STAT_END_TAGNAME_END, CLASS_TYPE_RIGHT_ANGLE,STAT_START, EVENT_NONE },
|
||||
|
||||
/* [23-25] handle text */
|
||||
{ STAT_TEXT, CLASS_TYPE_SPACE, STAT_SPACE, EVENT_NONE },
|
||||
{ STAT_TEXT, CLASS_TYPE_LEFT_ANGLE, STAT_START_TAG, EVENT_TEXT },
|
||||
{ STAT_TEXT, CLASS_TYPE_ANY, STAT_TEXT, EVENT_NONE },
|
||||
|
||||
/* [26-30] handle attribute names */
|
||||
{ STAT_ATTR_NAME, CLASS_TYPE_LETTERS, STAT_ATTR_NAME, EVENT_COPY },
|
||||
/* below add support for space before the equals sign, e.g, <tag
|
||||
attr ="2"> */
|
||||
{ STAT_ATTR_NAME, CLASS_TYPE_SPACE, STAT_ATTR_NAME_END, EVENT_NAME },
|
||||
{ STAT_ATTR_NAME, CLASS_TYPE_EQUALS, STAT_ATTR_VAL, EVENT_NAME },
|
||||
|
||||
/* [31-33] attribute name end */
|
||||
{ STAT_ATTR_NAME_END, CLASS_TYPE_SPACE, STAT_ATTR_NAME_END, EVENT_NONE },
|
||||
{ STAT_ATTR_NAME_END, CLASS_TYPE_LETTERS, STAT_ATTR_NAME, EVENT_COPY },
|
||||
{ STAT_ATTR_NAME_END, CLASS_TYPE_EQUALS, STAT_ATTR_VAL, EVENT_NONE },
|
||||
|
||||
/* [34-35] handle attribute values, initial quote and spaces */
|
||||
{ STAT_ATTR_VAL, CLASS_TYPE_QUOTE, STAT_ATTR_VAL2, EVENT_NONE },
|
||||
/* below handles initial spaces before quoted attribute value */
|
||||
{ STAT_ATTR_VAL, CLASS_TYPE_SPACE, STAT_ATTR_VAL, EVENT_NONE },
|
||||
|
||||
/* [36-37] handle actual attribute values */
|
||||
{ STAT_ATTR_VAL2, CLASS_TYPE_QUOTE, STAT_START_TAGNAME_END, EVENT_VAL },
|
||||
{ STAT_ATTR_VAL2, CLASS_TYPE_LETTERS, STAT_ATTR_VAL2, EVENT_COPY },
|
||||
{ STAT_ATTR_VAL2, CLASS_TYPE_SLASH, STAT_ATTR_VAL2, EVENT_NONE },
|
||||
|
||||
/* End of table marker */
|
||||
{ STAT_ERROR, CLASS_TYPE_NONE, STAT_ERROR, EVENT_NONE }
|
||||
};
|
||||
|
||||
struct rtgui_xml
|
||||
{
|
||||
/* event handler */
|
||||
XML_handle handle;
|
||||
void* user;
|
||||
|
||||
char* buffer; /* xml buffer */
|
||||
rt_size_t buffer_size; /* buffer size */
|
||||
rt_size_t position; /* current position in buffer */
|
||||
rt_uint16_t state, event; /* current state and event */
|
||||
|
||||
rt_bool_t copy; /* copy text into tmp buffer */
|
||||
rt_bool_t halt; /* halt parsing of document */
|
||||
};
|
||||
|
||||
rtgui_xml_t* rtgui_xml_create(rt_size_t buffer_size, XML_handle handle,
|
||||
void* user)
|
||||
{
|
||||
rtgui_xml_t* xml = (rtgui_xml_t*) rt_malloc(sizeof(struct rtgui_xml));
|
||||
rt_memset(xml, 0, sizeof(rtgui_xml_t));
|
||||
|
||||
xml->event_handler = handle;
|
||||
xml->user = user;
|
||||
|
||||
/* create buffer */
|
||||
xml->buffer_size = buffer_size;
|
||||
xml->buffer = (char*)rt_malloc(xml->buffer_size);
|
||||
return xml;
|
||||
}
|
||||
|
||||
void rtgui_xml_destroy(rtgui_xml_t* xml)
|
||||
{
|
||||
if(xml)
|
||||
{
|
||||
rt_free(xml->buffer);
|
||||
rt_free(xml);
|
||||
}
|
||||
}
|
||||
|
||||
const char* rtgui_xml_event_str(rt_uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVENT_START:
|
||||
return "start tag";
|
||||
case EVENT_END:
|
||||
return "end tag";
|
||||
case EVENT_TEXT:
|
||||
return "text";
|
||||
case EVENT_NAME:
|
||||
return "attr name";
|
||||
case EVENT_VAL:
|
||||
return "attr val";
|
||||
case EVENT_END_DOC:
|
||||
return "end document";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "err";
|
||||
}
|
||||
|
||||
int rtgui_xml_parse(rtgui_xml_t* xml, const char* buf, rt_size_t len)
|
||||
{
|
||||
int i, j, c, match;
|
||||
|
||||
#define is_space(ch) \
|
||||
((rt_uint32_t)(ch - 9) < 5u || ch == ' ')
|
||||
#define is_alpha(ch) \
|
||||
((rt_uint32_t)((ch | 0x20) - 'a') < 26u)
|
||||
#define is_digit(ch) \
|
||||
((rt_uint32_t)(ch - '0') < 10u)
|
||||
#define is_letters(ch) \
|
||||
(is_alpha(ch) || is_digit(ch) || (ch == '.'))
|
||||
|
||||
for(i=0; i<len; i++)
|
||||
{
|
||||
if(xml->halt) break;
|
||||
|
||||
c = buf[i] & 0xff;
|
||||
|
||||
/* search in state table */
|
||||
for(j=0, match = 0; RTGUI_XML_STATES[j].state != STAT_ERROR; j++)
|
||||
{
|
||||
if(RTGUI_XML_STATES[j].state != xml->state)
|
||||
continue;
|
||||
|
||||
switch(RTGUI_XML_STATES[j].class_type)
|
||||
{
|
||||
case CLASS_TYPE_LETTERS:
|
||||
match = is_letters(c);
|
||||
break;
|
||||
case CLASS_TYPE_LEFT_ANGLE:
|
||||
match = (c == '<');
|
||||
break;
|
||||
case CLASS_TYPE_SLASH:
|
||||
match = (c == '/');
|
||||
break;
|
||||
case CLASS_TYPE_RIGHT_ANGLE:
|
||||
match = (c == '>');
|
||||
break;
|
||||
case CLASS_TYPE_EQUALS:
|
||||
match = (c == '=');
|
||||
break;
|
||||
case CLASS_TYPE_QUOTE:
|
||||
match = (c == '"');
|
||||
break;
|
||||
case CLASS_TYPE_SPACE:
|
||||
match = is_space(c);
|
||||
break;
|
||||
case CLASS_TYPE_ANY:
|
||||
match = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* we matched a character class */
|
||||
if(match)
|
||||
{
|
||||
if(RTGUI_XML_STATES[j].event == EVENT_COPY)
|
||||
{
|
||||
xml->copy = TRUE;
|
||||
}
|
||||
else if(RTGUI_XML_STATES[j].event != EVENT_NONE)
|
||||
{
|
||||
if(xml->copy == TRUE)
|
||||
{
|
||||
/* basically we are guaranteed never to have an event of
|
||||
type EVENT_COPY or EVENT_NONE here. */
|
||||
xml->event = RTGUI_XML_STATES[j].event;
|
||||
xml->buffer[xml->position] = 0; /* make a string */
|
||||
|
||||
if(!xml->event_handler(RTGUI_XML_STATES[j].event,
|
||||
xml->buffer, xml->position ,
|
||||
xml->user))
|
||||
{
|
||||
xml->halt = 1; /* stop parsing from here out */
|
||||
}
|
||||
xml->position = 0;
|
||||
xml->copy = FALSE;
|
||||
}
|
||||
}
|
||||
if(xml->copy == TRUE)
|
||||
{
|
||||
/* check to see if we have room; one less for trailing
|
||||
nul */
|
||||
if(xml->position < xml->buffer_size-1)
|
||||
{
|
||||
xml->buffer[xml->position] = buf[i];
|
||||
xml->position++;
|
||||
}
|
||||
}
|
||||
xml->state = RTGUI_XML_STATES[j].next_state; /* change state */
|
||||
break; /* break out of loop though state search */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !xml->halt;
|
||||
}
|
||||
9
components/rtgui_win/include/rtgui/blit.h
Normal file
9
components/rtgui_win/include/rtgui/blit.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __RTGUI_BLIT_H__
|
||||
#define __RTGUI_BLIT_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
typedef void (*rtgui_blit_line_func)(rt_uint8_t* dst, rt_uint8_t* src, int line);
|
||||
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
|
||||
|
||||
#endif
|
||||
104
components/rtgui_win/include/rtgui/color.h
Normal file
104
components/rtgui_win/include/rtgui/color.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* File : color.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_COLOR_H__
|
||||
#define __RTGUI_COLOR_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
|
||||
extern const rtgui_color_t default_foreground;
|
||||
extern const rtgui_color_t default_background;
|
||||
extern const rtgui_color_t selected_color;
|
||||
|
||||
extern const rtgui_color_t red;
|
||||
extern const rtgui_color_t green;
|
||||
extern const rtgui_color_t blue;
|
||||
extern const rtgui_color_t black;
|
||||
extern const rtgui_color_t white;
|
||||
extern const rtgui_color_t yellow;
|
||||
extern const rtgui_color_t cyan;
|
||||
extern const rtgui_color_t purple;
|
||||
extern const rtgui_color_t dark;
|
||||
|
||||
extern const rtgui_color_t high_light;
|
||||
extern const rtgui_color_t dark_grey;
|
||||
extern const rtgui_color_t light_grey;
|
||||
|
||||
|
||||
#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) >> 0) & 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)
|
||||
|
||||
/*
|
||||
* RTGUI default color format
|
||||
* BBBB BBBB GGGG GGGG RRRR RRRR
|
||||
*/
|
||||
|
||||
/* convert rtgui color to BBBBB_GGGGGG_RRRRR */
|
||||
rt_inline rt_uint16_t rtgui_color_to_565(rt_uint32_t c)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c)*31/255) << 11) | ((RTGUI_RGB_G(c)*63/255) << 5) | (RTGUI_RGB_R(c)*31/255));
|
||||
return pixel;
|
||||
}
|
||||
|
||||
rt_inline rt_uint32_t rtgui_color_from_565(rt_uint16_t pixel)
|
||||
{
|
||||
rt_uint16_t r, g, b;
|
||||
rtgui_color_t color;
|
||||
|
||||
r = pixel & 0x1f;
|
||||
g = (pixel >> 5) & 0x3f;
|
||||
b = (pixel >> 11) & 0x1f;
|
||||
|
||||
color = r * 255 / 31 + ((g * 255 / 63) << 8) + ((b * 255 / 31) << 16);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/* convert rtgui color to RRRRR_GGGGGG)BBBBB */
|
||||
rt_inline rt_uint16_t rtgui_color_to_565p(rt_uint32_t c)
|
||||
{
|
||||
rt_uint16_t pixel;
|
||||
|
||||
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c)*31/255) << 11) | ((RTGUI_RGB_G(c)*63/255) << 5) | (RTGUI_RGB_B(c)*31/255));
|
||||
return pixel;
|
||||
}
|
||||
|
||||
rt_inline rt_uint32_t rtgui_color_from_565p(rt_uint16_t pixel)
|
||||
{
|
||||
rt_uint8_t r, g, b;
|
||||
rtgui_color_t color;
|
||||
|
||||
r = (pixel >> 11) & 0x1f;
|
||||
g = (pixel >> 5) & 0x3f;
|
||||
b = pixel & 0x1f;
|
||||
|
||||
color = r * 255 / 31 + ((g * 255 / 63) << 8) + ((b * 255 / 31) << 16);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
197
components/rtgui_win/include/rtgui/dc.h
Normal file
197
components/rtgui_win/include/rtgui/dc.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* File : dc.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_DC_H__
|
||||
#define __RTGUI_DC_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/font.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/widgets/widget.h>
|
||||
|
||||
enum rtgui_dc_type
|
||||
{
|
||||
RTGUI_DC_HW,
|
||||
RTGUI_DC_CLIENT,
|
||||
RTGUI_DC_BUFFER,
|
||||
RTGUI_DC_IMLIB2,
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
/* 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 rect */
|
||||
void (*get_rect )(struct rtgui_dc* dc, rtgui_rect_t* rect);
|
||||
|
||||
rt_bool_t (*fini )(struct rtgui_dc* dc);
|
||||
};
|
||||
|
||||
/* the abstract device context */
|
||||
struct rtgui_dc
|
||||
{
|
||||
/* type of device context */
|
||||
rt_uint32_t type;
|
||||
|
||||
/* 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)
|
||||
|
||||
/* 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);
|
||||
|
||||
/* begin and end a drawing */
|
||||
struct rtgui_dc* rtgui_dc_begin_drawing(PVOID wdt);
|
||||
void rtgui_dc_end_drawing(struct rtgui_dc* dc);
|
||||
|
||||
/* destroy a 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_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_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_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_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_fill_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
|
||||
|
||||
/*
|
||||
* dc inline function
|
||||
*
|
||||
* Note:
|
||||
* In order to improve drawing speed, put most of common function of dc to inline
|
||||
*/
|
||||
|
||||
/*
|
||||
* draw a point on dc
|
||||
*/
|
||||
rt_inline void rtgui_dc_draw_point(struct rtgui_dc* dc, int x, int 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
dc->engine->draw_hline(dc, x1, x2, y);
|
||||
}
|
||||
|
||||
/*
|
||||
* fill a rect with background color
|
||||
*/
|
||||
rt_inline void rtgui_dc_fill_rect (struct rtgui_dc* dc, struct rtgui_rect* 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
dc->engine->set_gc(dc, gc);
|
||||
}
|
||||
|
||||
/*
|
||||
* get gc of dc
|
||||
*/
|
||||
rt_inline rtgui_gc_t *rtgui_dc_get_gc(struct rtgui_dc* dc)
|
||||
{
|
||||
return dc->engine->get_gc(dc);
|
||||
}
|
||||
|
||||
/*
|
||||
* get visible status of dc
|
||||
*/
|
||||
rt_inline rt_bool_t rtgui_dc_get_visible(struct rtgui_dc* 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)
|
||||
{
|
||||
dc->engine->get_rect(dc, rect);
|
||||
}
|
||||
|
||||
#endif
|
||||
27
components/rtgui_win/include/rtgui/dc_client.h
Normal file
27
components/rtgui_win/include/rtgui/dc_client.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* File : dc_buffer.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
* 2010-06-14 Bernard embedded hardware dc to each widget
|
||||
* 2010-08-09 Bernard rename hardware dc to client dc
|
||||
*/
|
||||
|
||||
#ifndef __RTGUI_DC_CLIENT_H__
|
||||
#define __RTGUI_DC_CLIENT_H__
|
||||
|
||||
#include <rtgui/dc.h>
|
||||
|
||||
/* create a hardware dc */
|
||||
struct rtgui_dc* rtgui_dc_client_create(rtgui_widget_t* owner);
|
||||
void rtgui_dc_client_init(rtgui_widget_t* owner);
|
||||
|
||||
#endif
|
||||
|
||||
24
components/rtgui_win/include/rtgui/dc_hw.h
Normal file
24
components/rtgui_win/include/rtgui/dc_hw.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* File : dc_buffer.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-04-10 Bernard first version
|
||||
* 2010-06-14 Bernard embedded hardware dc to each widget
|
||||
*/
|
||||
#ifndef __RTGUI_DC_HW_H__
|
||||
#define __RTGUI_DC_HW_H__
|
||||
|
||||
#include <rtgui/dc.h>
|
||||
|
||||
/* create a hardware dc */
|
||||
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner);
|
||||
|
||||
#endif
|
||||
|
||||
67
components/rtgui_win/include/rtgui/driver.h
Normal file
67
components/rtgui_win/include/rtgui/driver.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* File : driver.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-04 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_DRIVER_H__
|
||||
#define __RTGUI_DRIVER_H__
|
||||
|
||||
#include <rtgui/list.h>
|
||||
#include <rtgui/color.h>
|
||||
|
||||
struct rtgui_graphic_driver
|
||||
{
|
||||
/* driver name */
|
||||
char* name;
|
||||
|
||||
/* byte per pixel */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
|
||||
/* screen width and height */
|
||||
rt_uint16_t width;
|
||||
rt_uint16_t height;
|
||||
|
||||
/* screen update */
|
||||
void (*screen_update)(rtgui_rect_t* rect);
|
||||
|
||||
/* get video frame buffer */
|
||||
rt_uint8_t* (*get_framebuffer)(void);
|
||||
|
||||
/* set and get pixel in (x, y) */
|
||||
void (*set_pixel) (rtgui_color_t *c, rt_base_t x, rt_base_t y);
|
||||
void (*get_pixel) (rtgui_color_t *c, rt_base_t x, rt_base_t y);
|
||||
|
||||
void (*draw_hline)(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y);
|
||||
void (*draw_vline)(rtgui_color_t *c, rt_base_t x , rt_base_t y1, rt_base_t y2);
|
||||
|
||||
/* draw raw rt_hw_lcd_draw_hline */
|
||||
void (*draw_raw_hline)(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y);
|
||||
|
||||
/* the driver list */
|
||||
rtgui_list_t list;
|
||||
};
|
||||
|
||||
#ifdef RTGUI_USING_GRAPHIC_DRIVER_LIST
|
||||
void rtgui_graphic_driver_add(struct rtgui_graphic_driver* driver);
|
||||
void rtgui_graphic_driver_remove(struct rtgui_graphic_driver* driver);
|
||||
|
||||
struct rtgui_graphic_driver* rtgui_graphic_driver_find(char* name);
|
||||
#else
|
||||
void rtgui_graphic_driver_add(const struct rtgui_graphic_driver* driver);
|
||||
#endif
|
||||
|
||||
const 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_get_default_rect(rtgui_rect_t *rect);
|
||||
|
||||
#endif
|
||||
|
||||
341
components/rtgui_win/include/rtgui/event.h
Normal file
341
components/rtgui_win/include/rtgui/event.h
Normal file
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* File : event.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-04 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_EVENT_H__
|
||||
#define __RTGUI_EVENT_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/rtgui_system.h>
|
||||
|
||||
/* Use new name & namespace */
|
||||
typedef struct rtgui_event rtgui_event_t;
|
||||
typedef struct rtgui_event_win rtgui_event_win_t;
|
||||
typedef struct rtgui_event_win_move rtgui_event_win_move_t;
|
||||
typedef struct rtgui_event_win_resize rtgui_event_win_resize_t;
|
||||
|
||||
typedef struct rtgui_event_set_wm rtgui_event_set_wm_t;
|
||||
typedef struct rtgui_event_update rtgui_event_update_t;
|
||||
typedef struct rtgui_event_monitor rtgui_event_monitor_t;
|
||||
typedef struct rtgui_event_paint rtgui_event_paint_t;
|
||||
typedef struct rtgui_event_timer rtgui_event_timer_t;
|
||||
typedef struct rtgui_event_clip rtgui_event_clip_t;
|
||||
|
||||
typedef struct rtgui_event_mouse rtgui_event_mouse_t;
|
||||
typedef struct rtgui_event_kbd rtgui_event_kbd_t;
|
||||
typedef struct rtgui_event_current_pos rtgui_event_current_pos_t;//坐标点更新事件
|
||||
typedef struct rtgui_event_backlight rtgui_event_backlight_t;//LCD背光
|
||||
typedef struct rtgui_event_command rtgui_event_command_t;
|
||||
typedef struct rtgui_event_scrollbar rtgui_event_scrollbar_t;
|
||||
|
||||
typedef struct rtgui_event_focused rtgui_event_focused_t;
|
||||
typedef struct rtgui_event_resize rtgui_event_resize_t;
|
||||
|
||||
|
||||
/* panel event NULL */
|
||||
|
||||
/* window event */
|
||||
#define RTGUI_EVENT_PANEL_ATTACH 0 /* attach to a panel */
|
||||
#define RTGUI_EVENT_PANEL_DETACH 1 /* detach from a panel */
|
||||
#define RTGUI_EVENT_PANEL_SHOW 2 /* show in a panel */
|
||||
#define RTGUI_EVENT_PANEL_HIDE 3 /* hide from a panel */
|
||||
#define RTGUI_EVENT_PANEL_INFO 4 /* panel information */
|
||||
#define RTGUI_EVENT_PANEL_RESIZE 5 /* resize panel */
|
||||
#define RTGUI_EVENT_PANEL_FULLSCREEN 6 /* to full screen */
|
||||
#define RTGUI_EVENT_PANEL_NORMAL 7 /* to normal screen */
|
||||
|
||||
#define RTGUI_EVENT_WIN_CREATE 8 /* create a window */
|
||||
#define RTGUI_EVENT_WIN_DESTROY 9 /* destroy a window */
|
||||
#define RTGUI_EVENT_WIN_SHOW 10 /* show a window */
|
||||
#define RTGUI_EVENT_WIN_HIDE 11 /* hide a window */
|
||||
#define RTGUI_EVENT_WIN_ACTIVATE 12 /* activate a window */
|
||||
#define RTGUI_EVENT_WIN_DEACTIVATE 13 /* deactivate a window */
|
||||
#define RTGUI_EVENT_WIN_CLOSE 14 /* close a window */
|
||||
#define RTGUI_EVENT_WIN_MAX 15 /* max a window */
|
||||
#define RTGUI_EVENT_WIN_MIN 16 /* min a window */
|
||||
#define RTGUI_EVENT_WIN_MOVE 17 /* move a window */
|
||||
#define RTGUI_EVENT_WIN_RESIZE 18 /* resize a window */
|
||||
#define RTGUI_EVENT_UPDATE 19 /* update a rect */
|
||||
#define RTGUI_EVENT_PAINT 23 /* paint on screen */
|
||||
#define RTGUI_EVENT_TIMER 24 /* timer 0x17 */
|
||||
/* clip rect information */
|
||||
#define RTGUI_EVENT_CLIP 25 /* 剪切域信息 */
|
||||
/* mouse and keyboard event */
|
||||
#define RTGUI_EVENT_MOUSE_MOTION 26 /* 鼠标手势 */
|
||||
#define RTGUI_EVENT_MOUSE_BUTTON 27 /* 鼠标点击 */
|
||||
#define RTGUI_EVENT_KBD 28 /* keyboard info 0x1B*/
|
||||
/* user command event */
|
||||
#define RTGUI_EVENT_COMMAND 29 /* 用户命令 */
|
||||
/* widget event */
|
||||
#define RTGUI_EVENT_FOCUSED 30 /* 控件焦点 */
|
||||
#define RTGUI_EVENT_SCROLLED 31 /* scroll bar scrolled */
|
||||
#define RTGUI_EVENT_RESIZE 32 /* widget resize */
|
||||
#define RTGUI_EVENT_CURRENT_POS 33 /* 更新当前坐标点 */
|
||||
#define RTGUI_EVENT_BACKLIGHT 34 /* 液晶屏背光 */
|
||||
|
||||
enum {
|
||||
RTGUI_STATUS_OK = 0, /* status ok */
|
||||
RTGUI_STATUS_ERROR, /* generic error */
|
||||
RTGUI_STATUS_NRC, /* no resource */
|
||||
};
|
||||
|
||||
struct rtgui_event
|
||||
{
|
||||
/* the event type */
|
||||
rt_uint16_t type;
|
||||
/* user field of event */
|
||||
rt_uint16_t user;
|
||||
|
||||
/* the event sender */
|
||||
struct rt_thread* sender;
|
||||
|
||||
/* mailbox to acknowledge request */
|
||||
struct rt_mailbox* ack;
|
||||
};
|
||||
|
||||
#define RTGUI_EVENT(e) ((rtgui_event_t*)(e))
|
||||
|
||||
#define RTGUI_EVENT_INIT(e, t) do \
|
||||
{ \
|
||||
(e)->type = (t); \
|
||||
(e)->user = 0; \
|
||||
(e)->sender = rt_thread_self(); \
|
||||
(e)->ack = RT_NULL; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* RTGUI Window Event
|
||||
*/
|
||||
struct rtgui_event_win
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
/* the window id */
|
||||
rtgui_win_t* wid;
|
||||
};
|
||||
|
||||
struct rtgui_event_win_move
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
/* the window id */
|
||||
rtgui_win_t* wid;
|
||||
|
||||
rt_int16_t x, y;
|
||||
};
|
||||
|
||||
struct rtgui_event_win_resize
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
/* the window id */
|
||||
rtgui_win_t* wid;
|
||||
|
||||
rtgui_rect_t rect;
|
||||
};
|
||||
|
||||
/* window event init */
|
||||
#define RTGUI_EVENT_WIN_CREATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_CREATE)
|
||||
#define RTGUI_EVENT_WIN_DESTROY_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_DESTROY)
|
||||
#define RTGUI_EVENT_WIN_SHOW_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_SHOW)
|
||||
#define RTGUI_EVENT_WIN_HIDE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_HIDE)
|
||||
#define RTGUI_EVENT_WIN_ACTIVATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_ACTIVATE)
|
||||
#define RTGUI_EVENT_WIN_DEACTIVATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_DEACTIVATE)
|
||||
#define RTGUI_EVENT_WIN_CLOSE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_CLOSE)
|
||||
#define RTGUI_EVENT_WIN_MAX_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MAX)
|
||||
#define RTGUI_EVENT_WIN_MIN_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MIN)
|
||||
#define RTGUI_EVENT_WIN_MOVE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_MOVE)
|
||||
#define RTGUI_EVENT_WIN_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_WIN_RESIZE)
|
||||
|
||||
/*
|
||||
* RTGUI Other Event
|
||||
*/
|
||||
struct rtgui_event_update
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
/* the update rect */
|
||||
rtgui_rect_t rect;
|
||||
};
|
||||
|
||||
struct rtgui_event_monitor
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
/* the monitor rect */
|
||||
rtgui_rect_t rect;
|
||||
|
||||
/* under panel */
|
||||
rtgui_panel_t* panel;
|
||||
|
||||
/* or under window */
|
||||
rtgui_win_t* wid;
|
||||
};
|
||||
|
||||
struct rtgui_event_paint
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
rtgui_win_t* wid; /* destination window */
|
||||
rt_bool_t bfull;//更新全部,还是更新子控件
|
||||
};
|
||||
|
||||
struct rtgui_event_timer
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
rtgui_timer_t *timer;
|
||||
};
|
||||
|
||||
struct rtgui_event_clip
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
/* destination window */
|
||||
rtgui_win_t* wid;
|
||||
/* the number of rects */
|
||||
rt_uint32_t num_rect;
|
||||
/* rtgui_rect_t *rects */
|
||||
};
|
||||
#define RTGUI_EVENT_GET_RECT(e, i) &(((rtgui_rect_t*)(e + 1))[i])
|
||||
|
||||
#define RTGUI_EVENT_UPDATE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_UPDATE)
|
||||
#define RTGUI_EVENT_CLIP_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_CLIP)
|
||||
#define RTGUI_EVENT_PAINT_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_PAINT)
|
||||
#define RTGUI_EVENT_TIMER_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_TIMER)
|
||||
|
||||
/*
|
||||
* RTGUI Mouse and Keyboard Event
|
||||
*/
|
||||
struct rtgui_event_mouse
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
rtgui_win_t* wid; /* destination window */
|
||||
|
||||
rt_uint16_t x, y;
|
||||
rt_uint16_t button;
|
||||
};
|
||||
|
||||
#define RTGUI_MOUSE_BUTTON_RIGHT 0x01
|
||||
#define RTGUI_MOUSE_BUTTON_LEFT 0x02
|
||||
#define RTGUI_MOUSE_BUTTON_MIDDLE 0x03
|
||||
#define RTGUI_MOUSE_BUTTON_WHEELUP 0x04
|
||||
#define RTGUI_MOUSE_BUTTON_WHEELDOWN 0x08
|
||||
|
||||
#define RTGUI_MOUSE_BUTTON_DOWN 0x10
|
||||
#define RTGUI_MOUSE_BUTTON_UP 0x20
|
||||
|
||||
struct rtgui_event_kbd
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
rtgui_win_t* wid; /* destination window */
|
||||
|
||||
rt_uint16_t type; /* key down or up */
|
||||
rt_uint16_t key; /* current key */
|
||||
rt_uint16_t mod; /* current key modifiers */
|
||||
rt_uint16_t unicode; /* translated character */
|
||||
};
|
||||
|
||||
struct rtgui_event_current_pos
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
};
|
||||
|
||||
//液晶屏背光
|
||||
struct rtgui_event_backlight
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
rt_uint16_t light;
|
||||
};
|
||||
|
||||
#define RTGUI_KBD_IS_SET_CTRL(e) ((e)->mod & (RTGUI_KMOD_LCTRL | RTGUI_KMOD_RCTRL))
|
||||
#define RTGUI_KBD_IS_SET_ALT(e) ((e)->mod & (RTGUI_KMOD_LALT | RTGUI_KMOD_RALT))
|
||||
#define RTGUI_KBD_IS_SET_SHIFT(e) ((e)->mod & (RTGUI_KMOD_LSHIFT| RTGUI_KMOD_RSHIFT))
|
||||
#define RTGUI_KBD_IS_UP(e) ((e)->type == RTGUI_KEYUP)
|
||||
#define RTGUI_KBD_IS_DOWN(e) ((e)->type == RTGUI_KEYDOWN)
|
||||
|
||||
#define RTGUI_EVENT_MOUSE_MOTION_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MOUSE_MOTION)
|
||||
#define RTGUI_EVENT_MOUSE_BUTTON_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_MOUSE_BUTTON)
|
||||
#define RTGUI_EVENT_KBD_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_KBD)
|
||||
#define RTGUI_EVENT_CURRENT_POS_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_CURRENT_POS)
|
||||
#define RTGUI_EVENT_BACKLIGHT_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_BACKLIGHT)
|
||||
|
||||
struct rtgui_event_command
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
/* command type */
|
||||
rt_int32_t type;
|
||||
|
||||
/* command id */
|
||||
rt_int32_t command;
|
||||
|
||||
/* command string */
|
||||
char command_string[RTGUI_NAME_MAX];
|
||||
};
|
||||
#define RTGUI_EVENT_COMMAND_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_COMMAND)
|
||||
|
||||
#define RTGUI_CMD_UNKNOWN 0x00
|
||||
#define RTGUI_CMD_WM_CLOSE 0x10
|
||||
|
||||
#define RTGUI_CMD_USER_INT 0x20
|
||||
#define RTGUI_CMD_USER_STRING 0x21
|
||||
|
||||
/************************************************************************/
|
||||
/* Widget Event */
|
||||
/************************************************************************/
|
||||
#define RTGUI_WIDGET_EVENT_INIT(e, t) do \
|
||||
{ \
|
||||
(e)->type = (t); \
|
||||
(e)->sender = RT_NULL; \
|
||||
(e)->ack = RT_NULL; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* RTGUI Scrollbar Event
|
||||
*/
|
||||
struct rtgui_event_scrollbar
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
rt_uint8_t event;
|
||||
};
|
||||
#define RTGUI_SCROLL_LINEUP 0x01
|
||||
#define RTGUI_SCROLL_LINEDOWN 0x02
|
||||
#define RTGUI_SCROLL_PAGEUP 0x03
|
||||
#define RTGUI_SCROLL_PAGEDOWN 0x04
|
||||
#define RTGUI_EVENT_SCROLLED_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_SCROLLED)
|
||||
|
||||
/*
|
||||
* RTGUI Widget Focused Event
|
||||
*/
|
||||
struct rtgui_event_focused
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
|
||||
rtgui_widget_t* widget;
|
||||
};
|
||||
#define RTGUI_EVENT_FOCUSED_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_FOCUSED)
|
||||
|
||||
/*
|
||||
* RTGUI Widget Resize Event
|
||||
*/
|
||||
struct rtgui_event_resize
|
||||
{
|
||||
rtgui_event_t parent;
|
||||
rt_int16_t x, y;
|
||||
rt_int16_t w, h;
|
||||
};
|
||||
#define RTGUI_EVENT_RESIZE_INIT(e) RTGUI_EVENT_INIT(&((e)->parent), RTGUI_EVENT_RESIZE)
|
||||
|
||||
#endif
|
||||
|
||||
48
components/rtgui_win/include/rtgui/filerw.h
Normal file
48
components/rtgui_win/include/rtgui/filerw.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* File : filerw.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_FILERW_H__
|
||||
#define __RTGUI_FILERW_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
#define RTGUI_FILE_SEEK_SET 0
|
||||
#define RTGUI_FILE_SEEK_CUR 1
|
||||
#define RTGUI_FILE_SEEK_END 2
|
||||
|
||||
typedef struct rtgui_filerw rtgui_filerw_t;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
struct rtgui_filerw* rtgui_filerw_create_file(const char *filename, const char *mode);
|
||||
struct rtgui_filerw* rtgui_filerw_create_mem(const rt_uint8_t *data, 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);
|
||||
|
||||
/* get memory data from filerw memory object */
|
||||
const rt_uint8_t* rtgui_filerw_mem_getdata(struct rtgui_filerw* context);
|
||||
|
||||
#endif
|
||||
116
components/rtgui_win/include/rtgui/font.h
Normal file
116
components/rtgui_win/include/rtgui/font.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* File : font.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_FONT_H__
|
||||
#define __RTGUI_FONT_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
#include <rtgui/list.h>
|
||||
|
||||
extern rtgui_font_t rtgui_font_asc12,rtgui_font_asc16,font_dotum;
|
||||
|
||||
struct rtgui_font_engine
|
||||
{
|
||||
/* font engine function */
|
||||
void (*font_init)(rtgui_font_t* font);
|
||||
void (*font_load)(rtgui_font_t* font);
|
||||
|
||||
void (*font_draw_text)(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect);
|
||||
void (*font_get_metrics)(rtgui_font_t* font, const char* text, rtgui_rect_t* rect);
|
||||
};
|
||||
|
||||
/*
|
||||
* bitmap font engine
|
||||
*/
|
||||
/* bitmap font private data */
|
||||
struct rtgui_font_bitmap
|
||||
{
|
||||
/* bitmap data */
|
||||
const rt_uint8_t* bmp;
|
||||
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;
|
||||
rt_uint16_t height;
|
||||
|
||||
rt_uint8_t first_char;
|
||||
rt_uint8_t last_char;
|
||||
};
|
||||
extern const struct rtgui_font_engine bmp_font_engine;
|
||||
|
||||
#include <rtgui/tree.h>
|
||||
SPLAY_HEAD(cache_tree, hz_cache);
|
||||
struct hz_cache
|
||||
{
|
||||
SPLAY_ENTRY(hz_cache) hz_node;
|
||||
|
||||
rt_uint16_t hz_id;
|
||||
};
|
||||
|
||||
struct rtgui_hz_file_font
|
||||
{
|
||||
struct cache_tree cache_root;
|
||||
rt_uint16_t cache_size;
|
||||
|
||||
/* font size */
|
||||
rt_uint16_t font_size;
|
||||
rt_uint16_t font_data_size;
|
||||
|
||||
/* file descriptor */
|
||||
int fd;
|
||||
|
||||
/* font file name */
|
||||
const char* font_fn;
|
||||
};
|
||||
extern struct rtgui_font_engine rtgui_hz_file_font_engine;
|
||||
|
||||
struct rtgui_font
|
||||
{
|
||||
/* font name */
|
||||
char* family;
|
||||
|
||||
/* font height */
|
||||
rt_uint16_t height;
|
||||
|
||||
/* refer count */
|
||||
rt_uint32_t refer_count;
|
||||
|
||||
/* font engine */
|
||||
const struct rtgui_font_engine* engine;
|
||||
|
||||
/* font private data */
|
||||
void* data;
|
||||
|
||||
/* 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(rtgui_font_t* font);
|
||||
void rtgui_font_system_remove_font(rtgui_font_t* font);
|
||||
rtgui_font_t* rtgui_font_default(void);
|
||||
void rtgui_font_set_defaut(rtgui_font_t* font);
|
||||
|
||||
rtgui_font_t* rtgui_font_refer(const rt_uint8_t* family, rt_uint16_t height);
|
||||
void rtgui_font_derefer(rtgui_font_t* font);
|
||||
|
||||
/* draw a text */
|
||||
void rtgui_font_draw(rtgui_font_t* font, rtgui_dc_t *dc, const char* text, rt_uint32_t len, rtgui_rect_t* rect);
|
||||
int rtgui_font_get_string_width(rtgui_font_t* font, const char* text);//取得字符串的宽度
|
||||
int rtgui_font_get_font_width(rtgui_font_t* font); //取得字体的宽度
|
||||
int rtgui_font_get_font_height(rtgui_font_t* font);//取得字体的高度
|
||||
void rtgui_font_get_string_rect(rtgui_font_t* font, const char* text, rtgui_rect_t* rect);//取得字符串的矩形区域
|
||||
void rtgui_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect);
|
||||
|
||||
#endif
|
||||
78
components/rtgui_win/include/rtgui/image.h
Normal file
78
components/rtgui_win/include/rtgui/image.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* File : image.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_H__
|
||||
#define __RTGUI_IMAGE_H__
|
||||
|
||||
#include <rtgui/list.h>
|
||||
#include <rtgui/dc.h>
|
||||
#include <rtgui/driver.h>
|
||||
#include <rtgui/color.h>
|
||||
#include <rtgui/filerw.h>
|
||||
#include <rtgui/region.h>
|
||||
|
||||
typedef struct rtgui_image rtgui_image_t;
|
||||
|
||||
struct rtgui_image_engine
|
||||
{
|
||||
const char* name; //引擎名称,图像类型
|
||||
rtgui_list_t list;
|
||||
|
||||
/* image engine function */
|
||||
rt_bool_t (*image_check)(struct rtgui_filerw* file);
|
||||
|
||||
rt_bool_t (*image_load)(rtgui_image_t* image, struct rtgui_filerw* file, rt_bool_t load);
|
||||
void (*image_unload)(rtgui_image_t* image);
|
||||
|
||||
void (*image_blit)(rtgui_image_t *image, rtgui_dc_t *dc, rtgui_rect_t *rect);
|
||||
void (*image_paste)(rtgui_image_t *image, rtgui_dc_t *dc, rtgui_rect_t *rect, rtgui_color_t shield_color);
|
||||
};
|
||||
|
||||
struct rtgui_image_palette
|
||||
{
|
||||
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 engine 图形引擎 */
|
||||
const struct rtgui_image_engine* engine;
|
||||
|
||||
/* image palette */
|
||||
rtgui_image_palette_t* palette;
|
||||
|
||||
/* image private data 图像私有数据 */
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* init rtgui image system */
|
||||
void rtgui_system_image_init(void);
|
||||
|
||||
rtgui_image_t* rtgui_image_create_from_file(const char* type, const char* filename, rt_bool_t load);
|
||||
rtgui_image_t* 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(rtgui_image_t* image);
|
||||
|
||||
/* register an image engine */
|
||||
void rtgui_image_register_engine(struct rtgui_image_engine* engine);
|
||||
|
||||
/* blit an image */
|
||||
void rtgui_image_blit(rtgui_image_t* image, rtgui_dc_t *dc, rtgui_rect_t* rect);
|
||||
void rtgui_image_paste(rtgui_image_t *image, rtgui_dc_t *dc, rtgui_rect_t *rect, rtgui_color_t shield_color);
|
||||
struct rtgui_image_palette* rtgui_image_palette_create(rt_uint32_t ncolors);
|
||||
|
||||
#endif
|
||||
19
components/rtgui_win/include/rtgui/image_bmp.h
Normal file
19
components/rtgui_win/include/rtgui/image_bmp.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* File : image_bmp.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2010-08-10 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_BMP_H__
|
||||
#define __RTGUI_IMAGE_BMP_H__
|
||||
|
||||
void rtgui_image_bmp_init(void);
|
||||
|
||||
#endif
|
||||
37
components/rtgui_win/include/rtgui/image_hdc.h
Normal file
37
components/rtgui_win/include/rtgui/image_hdc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* File : image_xpm.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_HDC_H__
|
||||
#define __RTGUI_IMAGE_HDC_H__
|
||||
|
||||
#include <rtgui/image.h>
|
||||
|
||||
struct rtgui_image_hdcmm
|
||||
{
|
||||
rtgui_image_t parent;
|
||||
|
||||
/* hdc image information */
|
||||
rt_uint16_t byte_per_pixel;
|
||||
rt_uint16_t pitch;
|
||||
|
||||
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)}
|
||||
|
||||
#endif
|
||||
8
components/rtgui_win/include/rtgui/image_jpeg.h
Normal file
8
components/rtgui_win/include/rtgui/image_jpeg.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __RTGUI_IMAGE_JPEG_H__
|
||||
#define __RTGUI_IMAGE_JPEG_H__
|
||||
|
||||
#include <image.h>
|
||||
|
||||
void rtgui_image_jpeg_init(void);
|
||||
|
||||
#endif
|
||||
21
components/rtgui_win/include/rtgui/image_png.h
Normal file
21
components/rtgui_win/include/rtgui/image_png.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* File : image_png.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_PNG_H__
|
||||
#define __RTGUI_IMAGE_PNG_H__
|
||||
|
||||
#include <image.h>
|
||||
|
||||
void rtgui_image_png_init(void);
|
||||
|
||||
#endif
|
||||
21
components/rtgui_win/include/rtgui/image_xpm.h
Normal file
21
components/rtgui_win/include/rtgui/image_xpm.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* File : image_xpm.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_IMAGE_XPM_H__
|
||||
#define __RTGUI_IMAGE_XPM_H__
|
||||
|
||||
#include <rtgui/image.h>
|
||||
|
||||
void rtgui_image_xpm_init(void);
|
||||
|
||||
#endif
|
||||
293
components/rtgui_win/include/rtgui/kbddef.h
Normal file
293
components/rtgui_win/include/rtgui/kbddef.h
Normal file
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* File : kbddef.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __KBD_DEF_H__
|
||||
#define __KBD_DEF_H__
|
||||
|
||||
/* The keyboard key have been cleverly chosen to map to ASCII */
|
||||
typedef enum
|
||||
{
|
||||
RTGUIK_UNKNOWN = 0,
|
||||
RTGUIK_FIRST = 0,
|
||||
RTGUIK_BACKSPACE = 8,
|
||||
RTGUIK_TAB = 9,
|
||||
RTGUIK_CLEAR = 12,
|
||||
RTGUIK_RETURN = 13,
|
||||
RTGUIK_PAUSE = 19,
|
||||
RTGUIK_ESCAPE = 27,
|
||||
RTGUIK_SPACE = 32,
|
||||
RTGUIK_EXCLAIM = 33,
|
||||
RTGUIK_QUOTEDBL = 34,
|
||||
RTGUIK_HASH = 35,
|
||||
RTGUIK_DOLLAR = 36,
|
||||
RTGUIK_AMPERSAND = 38,
|
||||
RTGUIK_QUOTE = 39,
|
||||
RTGUIK_LEFTPAREN = 40,
|
||||
RTGUIK_RIGHTPAREN = 41,
|
||||
RTGUIK_ASTERISK = 42,
|
||||
RTGUIK_PLUS = 43,
|
||||
RTGUIK_COMMA = 44,
|
||||
RTGUIK_MINUS = 45,
|
||||
RTGUIK_PERIOD = 46,
|
||||
RTGUIK_SLASH = 47,
|
||||
RTGUIK_0 = 48,
|
||||
RTGUIK_1 = 49,
|
||||
RTGUIK_2 = 50,
|
||||
RTGUIK_3 = 51,
|
||||
RTGUIK_4 = 52,
|
||||
RTGUIK_5 = 53,
|
||||
RTGUIK_6 = 54,
|
||||
RTGUIK_7 = 55,
|
||||
RTGUIK_8 = 56,
|
||||
RTGUIK_9 = 57,
|
||||
RTGUIK_COLON = 58,
|
||||
RTGUIK_SEMICOLON = 59,
|
||||
RTGUIK_LESS = 60,
|
||||
RTGUIK_EQUALS = 61,
|
||||
RTGUIK_GREATER = 62,
|
||||
RTGUIK_QUESTION = 63,
|
||||
RTGUIK_AT = 64,
|
||||
|
||||
/*
|
||||
Skip uppercase letters
|
||||
*/
|
||||
RTGUIK_LEFTBRACKET = 91,
|
||||
RTGUIK_BACKSLASH = 92,
|
||||
RTGUIK_RIGHTBRACKET = 93,
|
||||
RTGUIK_CARET = 94,
|
||||
RTGUIK_UNDERSCORE = 95,
|
||||
RTGUIK_BACKQUOTE = 96,
|
||||
RTGUIK_a = 97,
|
||||
RTGUIK_b = 98,
|
||||
RTGUIK_c = 99,
|
||||
RTGUIK_d = 100,
|
||||
RTGUIK_e = 101,
|
||||
RTGUIK_f = 102,
|
||||
RTGUIK_g = 103,
|
||||
RTGUIK_h = 104,
|
||||
RTGUIK_i = 105,
|
||||
RTGUIK_j = 106,
|
||||
RTGUIK_k = 107,
|
||||
RTGUIK_l = 108,
|
||||
RTGUIK_m = 109,
|
||||
RTGUIK_n = 110,
|
||||
RTGUIK_o = 111,
|
||||
RTGUIK_p = 112,
|
||||
RTGUIK_q = 113,
|
||||
RTGUIK_r = 114,
|
||||
RTGUIK_s = 115,
|
||||
RTGUIK_t = 116,
|
||||
RTGUIK_u = 117,
|
||||
RTGUIK_v = 118,
|
||||
RTGUIK_w = 119,
|
||||
RTGUIK_x = 120,
|
||||
RTGUIK_y = 121,
|
||||
RTGUIK_z = 122,
|
||||
RTGUIK_DELETE = 127,
|
||||
|
||||
/* International keyboard */
|
||||
RTGUIK_WORLD_0 = 160, /* 0xA0 */
|
||||
RTGUIK_WORLD_1 = 161,
|
||||
RTGUIK_WORLD_2 = 162,
|
||||
RTGUIK_WORLD_3 = 163,
|
||||
RTGUIK_WORLD_4 = 164,
|
||||
RTGUIK_WORLD_5 = 165,
|
||||
RTGUIK_WORLD_6 = 166,
|
||||
RTGUIK_WORLD_7 = 167,
|
||||
RTGUIK_WORLD_8 = 168,
|
||||
RTGUIK_WORLD_9 = 169,
|
||||
RTGUIK_WORLD_10 = 170,
|
||||
RTGUIK_WORLD_11 = 171,
|
||||
RTGUIK_WORLD_12 = 172,
|
||||
RTGUIK_WORLD_13 = 173,
|
||||
RTGUIK_WORLD_14 = 174,
|
||||
RTGUIK_WORLD_15 = 175,
|
||||
RTGUIK_WORLD_16 = 176,
|
||||
RTGUIK_WORLD_17 = 177,
|
||||
RTGUIK_WORLD_18 = 178,
|
||||
RTGUIK_WORLD_19 = 179,
|
||||
RTGUIK_WORLD_20 = 180,
|
||||
RTGUIK_WORLD_21 = 181,
|
||||
RTGUIK_WORLD_22 = 182,
|
||||
RTGUIK_WORLD_23 = 183,
|
||||
RTGUIK_WORLD_24 = 184,
|
||||
RTGUIK_WORLD_25 = 185,
|
||||
RTGUIK_WORLD_26 = 186,
|
||||
RTGUIK_WORLD_27 = 187,
|
||||
RTGUIK_WORLD_28 = 188,
|
||||
RTGUIK_WORLD_29 = 189,
|
||||
RTGUIK_WORLD_30 = 190,
|
||||
RTGUIK_WORLD_31 = 191,
|
||||
RTGUIK_WORLD_32 = 192,
|
||||
RTGUIK_WORLD_33 = 193,
|
||||
RTGUIK_WORLD_34 = 194,
|
||||
RTGUIK_WORLD_35 = 195,
|
||||
RTGUIK_WORLD_36 = 196,
|
||||
RTGUIK_WORLD_37 = 197,
|
||||
RTGUIK_WORLD_38 = 198,
|
||||
RTGUIK_WORLD_39 = 199,
|
||||
RTGUIK_WORLD_40 = 200,
|
||||
RTGUIK_WORLD_41 = 201,
|
||||
RTGUIK_WORLD_42 = 202,
|
||||
RTGUIK_WORLD_43 = 203,
|
||||
RTGUIK_WORLD_44 = 204,
|
||||
RTGUIK_WORLD_45 = 205,
|
||||
RTGUIK_WORLD_46 = 206,
|
||||
RTGUIK_WORLD_47 = 207,
|
||||
RTGUIK_WORLD_48 = 208,
|
||||
RTGUIK_WORLD_49 = 209,
|
||||
RTGUIK_WORLD_50 = 210,
|
||||
RTGUIK_WORLD_51 = 211,
|
||||
RTGUIK_WORLD_52 = 212,
|
||||
RTGUIK_WORLD_53 = 213,
|
||||
RTGUIK_WORLD_54 = 214,
|
||||
RTGUIK_WORLD_55 = 215,
|
||||
RTGUIK_WORLD_56 = 216,
|
||||
RTGUIK_WORLD_57 = 217,
|
||||
RTGUIK_WORLD_58 = 218,
|
||||
RTGUIK_WORLD_59 = 219,
|
||||
RTGUIK_WORLD_60 = 220,
|
||||
RTGUIK_WORLD_61 = 221,
|
||||
RTGUIK_WORLD_62 = 222,
|
||||
RTGUIK_WORLD_63 = 223,
|
||||
RTGUIK_WORLD_64 = 224,
|
||||
RTGUIK_WORLD_65 = 225,
|
||||
RTGUIK_WORLD_66 = 226,
|
||||
RTGUIK_WORLD_67 = 227,
|
||||
RTGUIK_WORLD_68 = 228,
|
||||
RTGUIK_WORLD_69 = 229,
|
||||
RTGUIK_WORLD_70 = 230,
|
||||
RTGUIK_WORLD_71 = 231,
|
||||
RTGUIK_WORLD_72 = 232,
|
||||
RTGUIK_WORLD_73 = 233,
|
||||
RTGUIK_WORLD_74 = 234,
|
||||
RTGUIK_WORLD_75 = 235,
|
||||
RTGUIK_WORLD_76 = 236,
|
||||
RTGUIK_WORLD_77 = 237,
|
||||
RTGUIK_WORLD_78 = 238,
|
||||
RTGUIK_WORLD_79 = 239,
|
||||
RTGUIK_WORLD_80 = 240,
|
||||
RTGUIK_WORLD_81 = 241,
|
||||
RTGUIK_WORLD_82 = 242,
|
||||
RTGUIK_WORLD_83 = 243,
|
||||
RTGUIK_WORLD_84 = 244,
|
||||
RTGUIK_WORLD_85 = 245,
|
||||
RTGUIK_WORLD_86 = 246,
|
||||
RTGUIK_WORLD_87 = 247,
|
||||
RTGUIK_WORLD_88 = 248,
|
||||
RTGUIK_WORLD_89 = 249,
|
||||
RTGUIK_WORLD_90 = 250,
|
||||
RTGUIK_WORLD_91 = 251,
|
||||
RTGUIK_WORLD_92 = 252,
|
||||
RTGUIK_WORLD_93 = 253,
|
||||
RTGUIK_WORLD_94 = 254,
|
||||
RTGUIK_WORLD_95 = 255, /* 0xFF */
|
||||
|
||||
/* Numeric keypad */
|
||||
RTGUIK_KP0 = 256,
|
||||
RTGUIK_KP1 = 257,
|
||||
RTGUIK_KP2 = 258,
|
||||
RTGUIK_KP3 = 259,
|
||||
RTGUIK_KP4 = 260,
|
||||
RTGUIK_KP5 = 261,
|
||||
RTGUIK_KP6 = 262,
|
||||
RTGUIK_KP7 = 263,
|
||||
RTGUIK_KP8 = 264,
|
||||
RTGUIK_KP9 = 265,
|
||||
RTGUIK_KP_PERIOD = 266,
|
||||
RTGUIK_KP_DIVIDE = 267, /* ³ý/ */
|
||||
RTGUIK_KP_MULTIPLY = 268, /* ³Ë* */
|
||||
RTGUIK_KP_MINUS = 269, /* ¼õ- */
|
||||
RTGUIK_KP_PLUS = 270, /* ¼Ó+ */
|
||||
RTGUIK_KP_ENTER = 271,
|
||||
RTGUIK_KP_EQUALS = 272, /* µÈÓÚ= */
|
||||
|
||||
/* Arrows + Home/End pad */
|
||||
RTGUIK_UP = 273,
|
||||
RTGUIK_DOWN = 274,
|
||||
RTGUIK_RIGHT = 275,
|
||||
RTGUIK_LEFT = 276,
|
||||
RTGUIK_INSERT = 277,
|
||||
RTGUIK_HOME = 278,
|
||||
RTGUIK_END = 279,
|
||||
RTGUIK_PAGEUP = 280,
|
||||
RTGUIK_PAGEDOWN = 281,
|
||||
|
||||
/* Function keys */
|
||||
RTGUIK_F1 = 282,
|
||||
RTGUIK_F2 = 283,
|
||||
RTGUIK_F3 = 284,
|
||||
RTGUIK_F4 = 285,
|
||||
RTGUIK_F5 = 286,
|
||||
RTGUIK_F6 = 287,
|
||||
RTGUIK_F7 = 288,
|
||||
RTGUIK_F8 = 289,
|
||||
RTGUIK_F9 = 290,
|
||||
RTGUIK_F10 = 291,
|
||||
RTGUIK_F11 = 292,
|
||||
RTGUIK_F12 = 293,
|
||||
RTGUIK_F13 = 294,
|
||||
RTGUIK_F14 = 295,
|
||||
RTGUIK_F15 = 296,
|
||||
|
||||
/* Key state modifier keys */
|
||||
RTGUIK_NUMLOCK = 300,
|
||||
RTGUIK_CAPSLOCK = 301,
|
||||
RTGUIK_SCROLLOCK = 302,
|
||||
RTGUIK_RSHIFT = 303,
|
||||
RTGUIK_LSHIFT = 304,
|
||||
RTGUIK_RCTRL = 305,
|
||||
RTGUIK_LCTRL = 306,
|
||||
RTGUIK_RALT = 307,
|
||||
RTGUIK_LALT = 308,
|
||||
RTGUIK_RMETA = 309,
|
||||
RTGUIK_LMETA = 310,
|
||||
RTGUIK_LSUPER = 311, /* Left "Windows" key */
|
||||
RTGUIK_RSUPER = 312, /* Right "Windows" key */
|
||||
RTGUIK_MODE = 313, /* "Alt Gr" key */
|
||||
RTGUIK_COMPOSE = 314, /* Multi-key compose key */
|
||||
|
||||
/* Miscellaneous function keys */
|
||||
RTGUIK_HELP = 315,
|
||||
RTGUIK_PRINT = 316,
|
||||
RTGUIK_SYSREQ = 317,
|
||||
RTGUIK_BREAK = 318,
|
||||
RTGUIK_MENU = 319,
|
||||
RTGUIK_POWER = 320, /* Power key */
|
||||
|
||||
RTGUIK_LAST
|
||||
} RTGUI_KBD_KEY;
|
||||
|
||||
/* Enumeration of valid key mods (possibly OR'd together) */
|
||||
typedef enum {
|
||||
RTGUI_KMOD_NONE = 0x0000,
|
||||
RTGUI_KMOD_LSHIFT = 0x0001,
|
||||
RTGUI_KMOD_RSHIFT = 0x0002,
|
||||
RTGUI_KMOD_LCTRL = 0x0040,
|
||||
RTGUI_KMOD_RCTRL = 0x0080,
|
||||
RTGUI_KMOD_LALT = 0x0100,
|
||||
RTGUI_KMOD_RALT = 0x0200,
|
||||
RTGUI_KMOD_LMETA = 0x0400,
|
||||
RTGUI_KMOD_RMETA = 0x0800,
|
||||
RTGUI_KMOD_NUM = 0x1000,
|
||||
RTGUI_KMOD_CAPS = 0x2000,
|
||||
RTGUI_KMOD_MODE = 0x4000,
|
||||
RTGUI_KMOD_RESERVED = 0x8000
|
||||
} RTGUI_KBD_MOD;
|
||||
|
||||
typedef enum {
|
||||
RTGUI_KEYDOWN, /* Keys pressed */
|
||||
RTGUI_KEYUP, /* Keys released */
|
||||
} RTGUI_KBD_TYPE;
|
||||
|
||||
#endif
|
||||
66
components/rtgui_win/include/rtgui/list.h
Normal file
66
components/rtgui_win/include/rtgui/list.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* File : list.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_LIST_H__
|
||||
#define __RTGUI_LIST_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
typedef struct rtgui_list_node rtgui_list_t;/* (template),×¢ÒâÓëCCListµÄÇø±ð */
|
||||
|
||||
struct rtgui_list_node
|
||||
{
|
||||
rtgui_list_t* next;
|
||||
};
|
||||
rt_inline void rtgui_list_init(rtgui_list_t *l)
|
||||
{
|
||||
l->next = (rtgui_list_t *)0;
|
||||
}
|
||||
|
||||
rt_inline void rtgui_list_append(rtgui_list_t *l, rtgui_list_t *n)
|
||||
{
|
||||
rtgui_list_t* node;
|
||||
|
||||
node = l;
|
||||
while(node->next) node = node->next;
|
||||
|
||||
/* append the node to the tail */
|
||||
node->next = n;
|
||||
n->next = (rtgui_list_t*) 0;
|
||||
}
|
||||
|
||||
rt_inline void list_insert(rtgui_list_t *l, rtgui_list_t *n)
|
||||
{
|
||||
n->next = l->next;
|
||||
l->next = n;
|
||||
}
|
||||
|
||||
rt_inline rtgui_list_t* rtgui_list_remove(rtgui_list_t *l, rtgui_list_t *n)
|
||||
{
|
||||
/* remove slist head */
|
||||
rtgui_list_t* node = l;
|
||||
while(node->next && node->next != n) node = node->next;
|
||||
|
||||
/* remove node */
|
||||
if(node->next != (rtgui_list_t *)0) node->next = node->next->next;
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
#define rtgui_list_entry(node, type, member) \
|
||||
((type *)((char*)(node)-(unsigned long)(&((type *)0)->member)))
|
||||
|
||||
#define rtgui_list_foreach(node, list) \
|
||||
for((node) = (list)->next; (node) != RT_NULL; (node) = (node)->next)
|
||||
|
||||
#endif
|
||||
101
components/rtgui_win/include/rtgui/region.h
Normal file
101
components/rtgui_win/include/rtgui/region.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* File : region.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_REGION_H__
|
||||
#define __RTGUI_REGION_H__
|
||||
|
||||
#include <rtgui/rtgui.h>
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct rtgui_region_data rtgui_region_data_t;
|
||||
|
||||
struct rtgui_region_data
|
||||
{
|
||||
rt_uint32_t size;
|
||||
rt_uint32_t numRects;
|
||||
/* XXX: And why, exactly, do we have this bogus struct definition? */
|
||||
/* rtgui_rect_t rects[size]; in memory but not explicitly declared */
|
||||
};
|
||||
|
||||
typedef struct rtgui_region
|
||||
{
|
||||
rtgui_rect_t extents;
|
||||
rtgui_region_data_t *data;
|
||||
}rtgui_region_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RTGUI_REGION_STATUS_FAILURE,
|
||||
RTGUI_REGION_STATUS_SUCCESS
|
||||
}rtgui_region_status_t;
|
||||
|
||||
/* creation/destruction */
|
||||
|
||||
void rtgui_region_init(rtgui_region_t *region);
|
||||
void rtgui_region_init_rect(rtgui_region_t *region, int x, int y, unsigned int width, unsigned int height);
|
||||
void rtgui_region_init_with_extents(rtgui_region_t *region, const rtgui_rect_t *extents);
|
||||
void rtgui_region_fini (rtgui_region_t *region);
|
||||
|
||||
void rtgui_region_translate (rtgui_region_t *region, int x, int y);
|
||||
|
||||
rtgui_region_status_t rtgui_region_copy (rtgui_region_t *dest, rtgui_region_t *source);
|
||||
|
||||
rtgui_region_status_t rtgui_region_intersect (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
|
||||
rtgui_region_status_t rtgui_region_intersect_rect (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *rect);
|
||||
rtgui_region_status_t rtgui_region_union (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_region_t *reg2);
|
||||
rtgui_region_status_t rtgui_region_union_rect(rtgui_region_t *dest, rtgui_region_t *source, rtgui_rect_t* rect);
|
||||
rtgui_region_status_t rtgui_region_subtract (rtgui_region_t *regD, rtgui_region_t *regM, rtgui_region_t *regS);
|
||||
rtgui_region_status_t rtgui_region_subtract_rect (rtgui_region_t *regD, rtgui_region_t *regM, rtgui_rect_t* rect);
|
||||
rtgui_region_status_t rtgui_region_inverse (rtgui_region_t *newReg, rtgui_region_t *reg1, rtgui_rect_t *invRect);
|
||||
|
||||
int rtgui_region_num_rects (rtgui_region_t *region);
|
||||
|
||||
rtgui_rect_t* rtgui_region_rects (rtgui_region_t *region);
|
||||
|
||||
#define RTGUI_REGION_OUT 0
|
||||
#define RTGUI_REGION_IN 1
|
||||
#define RTGUI_REGION_PART 2
|
||||
|
||||
int rtgui_region_contains_point (rtgui_region_t *region, int x, int y, rtgui_rect_t *box);
|
||||
int rtgui_region_contains_rectangle (rtgui_region_t *rtgui_region_t, rtgui_rect_t *prect);
|
||||
|
||||
int rtgui_region_not_empty (rtgui_region_t *region);
|
||||
rtgui_rect_t *rtgui_region_extents (rtgui_region_t *region);
|
||||
|
||||
rtgui_region_status_t rtgui_region_append (rtgui_region_t *dest, rtgui_region_t *region);
|
||||
rtgui_region_status_t rtgui_region_validate (rtgui_region_t *badreg, int *pOverlap);
|
||||
|
||||
void rtgui_region_reset(rtgui_region_t *region, rtgui_rect_t* rect);
|
||||
void rtgui_region_empty (rtgui_region_t *region);
|
||||
void rtgui_region_dump(rtgui_region_t* region);
|
||||
int rtgui_region_is_flat(rtgui_region_t* region);
|
||||
|
||||
/* rect functions */
|
||||
extern rtgui_rect_t rtgui_empty_rect;
|
||||
|
||||
void rtgui_rect_moveto(rtgui_rect_t *rect, int x, int y);
|
||||
void rtgui_rect_moveto_align(rtgui_rect_t *rect, rtgui_rect_t *to, int align);
|
||||
void rtgui_rect_inflate(rtgui_rect_t *rect, int d);
|
||||
void rtgui_rect_intersect(rtgui_rect_t *src, rtgui_rect_t *dest);
|
||||
int rtgui_rect_contains_point(const rtgui_rect_t *rect, int x, int y);
|
||||
int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
|
||||
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PIXMAN_H_ */
|
||||
154
components/rtgui_win/include/rtgui/rtgui.h
Normal file
154
components/rtgui_win/include/rtgui/rtgui.h
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* File : rtgui.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-04 Bernard first version
|
||||
*/
|
||||
#ifndef __RT_GUI_H__
|
||||
#define __RT_GUI_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtgui/rtgui_config.h>
|
||||
#include <string.h>
|
||||
|
||||
#define RT_INT16_MAX 32767
|
||||
#define RT_INT16_MIN (-RT_INT16_MAX-1)
|
||||
|
||||
#define SELECTED_HEIGHT 20 //ÒÑÑ¡ÔñÐеĸ߶È
|
||||
|
||||
#define RT_COUNT(array) sizeof(array)/sizeof(array[0])
|
||||
|
||||
/* Use new name & namespace */
|
||||
typedef struct rtgui_point rtgui_point_t;
|
||||
typedef struct rtgui_rect rtgui_rect_t;
|
||||
typedef rt_uint32_t rtgui_color_t;
|
||||
typedef struct rtgui_event rtgui_event_t;
|
||||
typedef struct rtgui_font rtgui_font_t;
|
||||
typedef struct rtgui_dc rtgui_dc_t;
|
||||
typedef struct rtgui_gc rtgui_gc_t;
|
||||
|
||||
typedef void* PVOID;
|
||||
typedef struct rtgui_type rtgui_type_t;
|
||||
typedef struct rtgui_object rtgui_object_t;
|
||||
typedef struct rtgui_widget rtgui_widget_t;
|
||||
typedef struct rtgui_panel rtgui_panel_t;
|
||||
typedef struct rtgui_container rtgui_container_t;
|
||||
typedef struct rtgui_win rtgui_win_t;
|
||||
typedef struct rtgui_staticline rtgui_staticline_t;
|
||||
typedef struct rtgui_label rtgui_label_t;
|
||||
typedef struct rtgui_textbox rtgui_textbox_t;
|
||||
typedef struct rtgui_button rtgui_button_t;
|
||||
typedef struct rtgui_view rtgui_view_t;
|
||||
typedef struct rtgui_checkbox rtgui_checkbox_t;
|
||||
typedef struct rtgui_radiobox rtgui_radiobox_t;
|
||||
typedef struct rtgui_listbox rtgui_listbox_t;
|
||||
typedef struct rtgui_list_view rtgui_list_view_t;
|
||||
typedef struct rtgui_fileview rtgui_filelist_view_t;
|
||||
typedef struct rtgui_scrollbar rtgui_scrollbar_t;
|
||||
typedef struct rtgui_iconbox rtgui_iconbox_t;
|
||||
typedef struct rtgui_menu_item rtgui_menu_item_t;
|
||||
typedef struct rtgui_menu rtgui_menu_t;
|
||||
typedef struct rtgui_combo rtgui_combo_t;
|
||||
|
||||
|
||||
typedef rt_bool_t (*rtgui_event_handler_ptr)(PVOID wdt, rtgui_event_t* event);
|
||||
|
||||
struct rtgui_point
|
||||
{
|
||||
rt_int16_t x, y;
|
||||
};
|
||||
|
||||
struct rtgui_rect
|
||||
{
|
||||
rt_int16_t x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
extern rtgui_point_t rtgui_empty_point;
|
||||
|
||||
#define rtgui_rect_width(r) ((r).x2 - (r).x1)
|
||||
#define rtgui_rect_height(r) ((r).y2 - (r).y1)
|
||||
|
||||
struct rtgui_gc
|
||||
{
|
||||
/* foreground and background color */
|
||||
rtgui_color_t foreground, background;
|
||||
|
||||
/* text style */
|
||||
rt_uint16_t textstyle;
|
||||
/* text align */
|
||||
rt_uint16_t textalign;
|
||||
|
||||
/* font */
|
||||
struct rtgui_font* font;
|
||||
};
|
||||
|
||||
enum RTGUI_MARGIN_STYLE
|
||||
{
|
||||
RTGUI_MARGIN_LEFT = 0x01,
|
||||
RTGUI_MARGIN_RIGHT = 0x02,
|
||||
RTGUI_MARGIN_TOP = 0x04,
|
||||
RTGUI_MARGIN_BOTTOM = 0x08,
|
||||
RTGUI_MARGIN_ALL = (RTGUI_MARGIN_LEFT | RTGUI_MARGIN_RIGHT | RTGUI_MARGIN_TOP | RTGUI_MARGIN_BOTTOM)
|
||||
};
|
||||
|
||||
enum RTGUI_BORDER_STYLE
|
||||
{
|
||||
RTGUI_BORDER_NONE = 0,
|
||||
RTGUI_BORDER_SIMPLE,
|
||||
RTGUI_BORDER_RAISE,
|
||||
RTGUI_BORDER_SUNKEN,
|
||||
RTGUI_BORDER_BOX,
|
||||
RTGUI_BORDER_STATIC,
|
||||
RTGUI_BORDER_EXTRA,
|
||||
RTGUI_BORDER_UP,
|
||||
RTGUI_BORDER_DOWN
|
||||
};
|
||||
|
||||
#define RTGUI_BORDER_DEFAULT_WIDTH 2
|
||||
#define RTGUI_WIDGET_DEFAULT_MARGIN 3
|
||||
|
||||
enum RTGUI_ORIENTATION
|
||||
{
|
||||
RTGUI_HORIZONTAL = 0x01,
|
||||
RTGUI_VERTICAL = 0x02,
|
||||
RTGUI_ORIENTATION_BOTH = RTGUI_HORIZONTAL | RTGUI_VERTICAL
|
||||
};
|
||||
|
||||
enum RTGUI_ALIGN
|
||||
{
|
||||
RTGUI_ALIGN_NOT = 0x00,
|
||||
RTGUI_ALIGN_CENTER_HORIZONTAL = 0x01,
|
||||
RTGUI_ALIGN_LEFT = RTGUI_ALIGN_NOT,
|
||||
RTGUI_ALIGN_TOP = RTGUI_ALIGN_NOT,
|
||||
RTGUI_ALIGN_RIGHT = 0x02,
|
||||
RTGUI_ALIGN_BOTTOM = 0x04,
|
||||
RTGUI_ALIGN_CENTER_VERTICAL = 0x08,
|
||||
RTGUI_ALIGN_EXPAND = 0x10,
|
||||
RTGUI_ALIGN_STRETCH = 0x20,
|
||||
};
|
||||
|
||||
enum RTGUI_TEXTSTYLE
|
||||
{
|
||||
RTGUI_TEXTSTYLE_NORMAL = 0x00,
|
||||
RTGUI_TEXTSTYLE_DRAW_BACKGROUND = 0x01,
|
||||
RTGUI_TEXTSTYLE_SHADOW = 0x02,
|
||||
RTGUI_TEXTSTYLE_OUTLINE = 0x04,
|
||||
};
|
||||
|
||||
enum RTGUI_MODAL_CODE
|
||||
{
|
||||
RTGUI_MODAL_OK,
|
||||
RTGUI_MODAL_CANCEL
|
||||
};
|
||||
typedef enum RTGUI_MODAL_CODE rtgui_modal_code_t;
|
||||
|
||||
#include <rtgui/rtgui_object.h>
|
||||
|
||||
#endif
|
||||
41
components/rtgui_win/include/rtgui/rtgui_config.h
Normal file
41
components/rtgui_win/include/rtgui/rtgui_config.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* File : rtgui_config.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-16 Bernard first version
|
||||
* 2010-02-08 Bernard move some RTGUI options to bsp
|
||||
*/
|
||||
|
||||
#ifndef __RTGUI_CONFIG_H__
|
||||
#define __RTGUI_CONFIG_H__
|
||||
|
||||
/* RTGUI options */
|
||||
|
||||
/* native running under RT-Thread */
|
||||
#ifndef RT_USING_DFS
|
||||
#undef RTGUI_USING_DFS_FILERW
|
||||
#undef RTGUI_USING_HZ_FILE
|
||||
#endif
|
||||
|
||||
#define RTGUI_USING_WINMOVE
|
||||
|
||||
//#define RTGUI_IMAGE_BMP
|
||||
|
||||
#define RTGUI_DEFAULT_FONT_SIZE 16
|
||||
|
||||
#define RTGUI_SVR_THREAD_PRIORITY 3
|
||||
#define RTGUI_SVR_THREAD_TIMESLICE 5
|
||||
#ifdef RTGUI_USING_SMALL_SIZE
|
||||
#define RTGUI_SVR_THREAD_STACK_SIZE 1024
|
||||
#else
|
||||
#define RTGUI_SVR_THREAD_STACK_SIZE 4096
|
||||
#endif
|
||||
|
||||
#endif
|
||||
107
components/rtgui_win/include/rtgui/rtgui_object.h
Normal file
107
components/rtgui_win/include/rtgui/rtgui_object.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* File : rtgui_object.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-04 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_OBJECT_H__
|
||||
#define __RTGUI_OBJECT_H__
|
||||
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* rtgui object type */
|
||||
#define RTGUI_CONTAINER_OF(obj, type, member) \
|
||||
((type *)((char *)(obj) - (unsigned long)(&((type *)0)->member)))
|
||||
|
||||
/** Casts the function pointer to an rtgui_constructor */
|
||||
#define RTGUI_CONSTRUCTOR(c) ((rtgui_constructor_t)(c))
|
||||
/** Casts the function pointer to an rtgui_constructor */
|
||||
#define RTGUI_DESTRUCTOR(d) ((rtgui_destructor_t)(d))
|
||||
|
||||
/* pre-definetion */
|
||||
typedef struct rtgui_type rtgui_type_t;
|
||||
typedef struct rtgui_object rtgui_object_t;
|
||||
|
||||
typedef void (*rtgui_constructor_t)(rtgui_object_t *object);
|
||||
typedef void (*rtgui_destructor_t)(rtgui_object_t *object);
|
||||
|
||||
/* rtgui type structure */
|
||||
struct rtgui_type
|
||||
{
|
||||
/* type name */
|
||||
char* name;
|
||||
|
||||
/* hierarchy and depth */
|
||||
rtgui_type_t **hierarchy;
|
||||
int hierarchy_depth;
|
||||
|
||||
/* constructor and destructor */
|
||||
rtgui_constructor_t constructor;
|
||||
rtgui_destructor_t destructor;
|
||||
|
||||
/* size of type */
|
||||
int size;
|
||||
};
|
||||
typedef struct rtgui_type rtgui_type_t;
|
||||
|
||||
rtgui_type_t *rtgui_type_create(const char *type_name, rtgui_type_t *parent_type,
|
||||
int type_size, rtgui_constructor_t c,
|
||||
rtgui_destructor_t d);
|
||||
void rtgui_type_destroy(rtgui_type_t *type);
|
||||
|
||||
void rtgui_type_object_construct(rtgui_type_t *type, rtgui_object_t *object);
|
||||
void rtgui_type_destructors_call(rtgui_type_t *type, rtgui_object_t *object);
|
||||
rt_bool_t rtgui_type_inherits_from(rtgui_type_t *type, rtgui_type_t *parent);
|
||||
rtgui_type_t *rtgui_type_parent_type_get(rtgui_type_t *type);
|
||||
const char *rtgui_type_name_get(rtgui_type_t *type);
|
||||
rtgui_type_t *GetTypeFromName(const char *name);
|
||||
|
||||
#ifdef RTGUI_USING_CAST_CHECK
|
||||
#define RTGUI_OBJECT_CAST(obj, rtgui_type_t, c_type) \
|
||||
((c_type *)rtgui_object_check_cast((rtgui_object_t *)(obj), (rtgui_type_t)))
|
||||
#else
|
||||
#define RTGUI_OBJECT_CAST(obj, rtgui_type_t, c_type) ((c_type *)(obj))
|
||||
#endif
|
||||
|
||||
#define RTGUI_OBJECT_CHECK_TYPE(_obj, _type) \
|
||||
(rtgui_type_inherits_from(((rtgui_object_t *)(_obj))->type, (_type)))
|
||||
|
||||
/** Gets the type of an object */
|
||||
#define RTGUI_OBJECT_TYPE (rtgui_object_type_get())
|
||||
/** Casts the object to an rtgui_object_t */
|
||||
#define RTGUI_OBJECT(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_OBJECT_TYPE, rtgui_object_t))
|
||||
/** Checks if the object is an rtgui_Object */
|
||||
#define RTGUI_IS_OBJECT(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_OBJECT_TYPE))
|
||||
|
||||
/* rtgui base object */
|
||||
struct rtgui_object
|
||||
{
|
||||
/* object type */
|
||||
rtgui_type_t* type;
|
||||
|
||||
rt_bool_t is_static;
|
||||
};
|
||||
rtgui_type_t *rtgui_object_type_get(void);
|
||||
|
||||
rtgui_object_t *rtgui_object_create(rtgui_type_t *object_type);
|
||||
void rtgui_object_destroy(rtgui_object_t *object);
|
||||
|
||||
rtgui_object_t *rtgui_object_check_cast(rtgui_object_t *object, rtgui_type_t *type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
32
components/rtgui_win/include/rtgui/rtgui_server.h
Normal file
32
components/rtgui_win/include/rtgui/rtgui_server.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* File : rtgui_server.h
|
||||
* This file is part of RTGUI in RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-10-04 Bernard first version
|
||||
*/
|
||||
#ifndef __RTGUI_SERVER_H__
|
||||
#define __RTGUI_SERVER_H__
|
||||
|
||||
#include <rtgui/list.h>
|
||||
|
||||
/* RTGUI server definitions */
|
||||
|
||||
#define WINTITLE_HEIGHT 20
|
||||
#define WINTITLE_BORDER_SIZE 2
|
||||
|
||||
/* top win manager init */
|
||||
void rtgui_win_init(void);
|
||||
void rtgui_server_init(void);
|
||||
|
||||
/* post an event to server */
|
||||
void rtgui_server_post_event(rtgui_event_t* event, rt_size_t size);
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user