提交 8b36b57a 编写于 作者: B Bernard Xiong

[UIEngine] move UI engine as a package

上级 fa693c51
......@@ -166,7 +166,7 @@ CONFIG_RT_USING_POSIX=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -150,7 +150,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -138,7 +138,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -120,7 +120,7 @@ CONFIG_RT_USING_LIBC=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# RT-Thread online packages
......
......@@ -106,7 +106,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */
......
......@@ -17,7 +17,7 @@
#include <rtthread.h>
#include <finsh.h>
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h"
#include <rtgui/driver.h>
#endif
......@@ -41,7 +41,7 @@ void rt_init_thread_entry(void* parameter)
rt_components_init();
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
{
rt_device_t device;
......
......@@ -23,7 +23,7 @@
#define DEBUG_PRINTF(...)
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
......@@ -122,4 +122,4 @@ int rt_gui_demo_init(void)
return 0;
}
#endif /* RT_USING_GUIENGINE */
#endif /* PKG_USING_GUIENGINE */
......@@ -18,7 +18,7 @@ if GetDepend('RT_USING_LWIP'):
src += ['drv_enet.c', 'synopsys_emac.c']
# add lcd drivers.
if GetDepend('RT_USING_GUIENGINE'):
if GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c', 'gd32f450z_lcd_eval.c']
# add spi flash drivers.
......
......@@ -18,7 +18,7 @@
#include <board.h>
#include <finsh.h>
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#define RT_HW_LCD_WIDTH ((uint16_t)320) /* LCD PIXEL WIDTH */
......
......@@ -67,7 +67,7 @@
/* SECTION: RTGUI support */
/* using RTGUI support */
#define RT_USING_GUIENGINE
// #define PKG_USING_GUIENGINE
/* name length of RTGUI object */
#define RTGUI_NAME_MAX 16
......
......@@ -60,6 +60,7 @@ CONFIG_ARCH_ARM_CORTEX_M7=y
#
CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
#
# C++ features
......@@ -197,34 +198,14 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
#
# Modbus master and slave stack
#
# CONFIG_RT_USING_MODBUS is not set
# CONFIG_LWIP_USING_DHCPD is not set
# CONFIG_RT_USING_NETUTILS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
CONFIG_RTGUI_USING_TTF=y
CONFIG_UTF8_TO_UNICODE=y
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_RTGUI_USING_DEMO is not set
#
# VBUS(Virtual Software BUS)
......@@ -250,8 +231,22 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
#
# system packages
#
# CONFIG_PKG_USING_PARTITION is not set
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_PERSIMMON is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
......@@ -282,6 +277,7 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
#
# security packages
......@@ -314,11 +310,13 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
#
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
#
# example package: hello
#
# CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_SOC_IMXRT1052=y
CONFIG_RT_USING_UART=y
CONFIG_RT_USING_UART1=y

\ No newline at end of file
......@@ -22,7 +22,7 @@ if GetDepend('RT_USING_LWIP'):
if GetDepend('RT_USING_SDIO'):
src += ['drv_sdio.c']
if GetDepend('RT_USING_RTGUI') or GetDepend('RT_USING_GUIENGINE'):
if GetDepend('RT_USING_RTGUI') or GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c', 'drv_ft5406.c', 'drv_i2c.c']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
......
......@@ -192,7 +192,7 @@ void rt_hw_board_init()
#endif
}
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h>
#include "drv_lcd.h"
......
......@@ -21,7 +21,7 @@
//#define LCD_DEBUG
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#define APP_HSW 41
#define APP_HFP 4
......
......@@ -56,6 +56,7 @@
#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
/* C++ features */
......@@ -182,32 +183,13 @@
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1
/* RT_LWIP_NETIF_LOOPBACK is not set */
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */
/* LWIP_USING_DHCPD is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
#define RTGUI_USING_TTF
#define UTF8_TO_UNICODE
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
/* RTGUI_USING_DEMO is not set */
/* VBUS(Virtual Software BUS) */
......@@ -227,8 +209,20 @@
/* system packages */
/* PKG_USING_PARTITION is not set */
/* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_PERSIMMON is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */
......@@ -254,6 +248,7 @@
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */
......@@ -281,10 +276,12 @@
/* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */
/* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
#define SOC_IMXRT1052
#define RT_USING_UART
#define RT_USING_UART1
......
......@@ -203,7 +203,7 @@ CONFIG_LWIP_SO_RCVBUF=1
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -80,7 +80,7 @@ void rt_hw_board_init()
#endif
}
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h>
#include "drv_lcd.h"
......
......@@ -187,7 +187,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -18,8 +18,10 @@ CONFIG_RT_USING_OVERFLOW_CHECK=y
CONFIG_RT_DEBUG_INIT=0
CONFIG_RT_DEBUG_THREAD=0
CONFIG_RT_USING_HOOK=y
CONFIG_IDLE_THREAD_STACK_SIZE=256
# CONFIG_RT_USING_TIMER_SOFT is not set
CONFIG_IDLE_THREAD_STACK_SIZE=512
CONFIG_RT_USING_TIMER_SOFT=y
CONFIG_RT_TIMER_THREAD_PRIO=4
CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024
#
# Inter-Thread communication
......@@ -40,6 +42,7 @@ CONFIG_RT_USING_MEMHEAP=y
CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
CONFIG_RT_USING_MEMTRACE=y
CONFIG_RT_USING_HEAP=y
#
......@@ -57,17 +60,20 @@ CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
#
CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
#
# C++ features
#
# CONFIG_RT_USING_CPLUSPLUS is not set
CONFIG_RT_USING_CPLUSPLUS=y
#
# Command shell
#
CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_THREAD_PRIORITY=20
......@@ -93,14 +99,14 @@ CONFIG_RT_USING_DFS_ELMFAT=y
#
CONFIG_RT_DFS_ELM_CODE_PAGE=437
CONFIG_RT_DFS_ELM_WORD_ACCESS=y
CONFIG_RT_DFS_ELM_USE_LFN_0=y
# CONFIG_RT_DFS_ELM_USE_LFN_0 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
# CONFIG_RT_DFS_ELM_USE_LFN_3 is not set
CONFIG_RT_DFS_ELM_USE_LFN=0
CONFIG_RT_DFS_ELM_USE_LFN_3=y
CONFIG_RT_DFS_ELM_USE_LFN=3
CONFIG_RT_DFS_ELM_MAX_LFN=255
CONFIG_RT_DFS_ELM_DRIVES=2
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
CONFIG_RT_DFS_ELM_REENTRANT=y
CONFIG_RT_USING_DFS_DEVFS=y
......@@ -110,6 +116,7 @@ CONFIG_HAVE_SYS_SELECT_H=y
CONFIG_RT_USING_DFS_ROMFS=y
CONFIG_RT_USING_DFS_RAMFS=y
# CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_JFFS2 is not set
# CONFIG_RT_USING_DFS_NFS is not set
#
......@@ -119,6 +126,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y
CONFIG_RT_USING_I2C_BITOPS=y
CONFIG_RT_USING_PIN=y
......@@ -126,8 +134,11 @@ CONFIG_RT_USING_MTD_NOR=y
CONFIG_RT_USING_MTD_NAND=y
CONFIG_RT_MTD_NAND_DEBUG=y
CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RTC_SYNC_USING_NTP is not set
CONFIG_RT_USING_SDIO=y
CONFIG_RT_USING_SPI=y
CONFIG_RT_USING_SPI_MSD=y
CONFIG_RT_USING_SFUD=y
CONFIG_RT_SFUD_USING_SFDP=y
CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE=y
......@@ -153,6 +164,7 @@ CONFIG_RT_USING_PTHREADS=y
CONFIG_RT_USING_POSIX=y
CONFIG_RT_USING_POSIX_MMAP=y
CONFIG_RT_USING_POSIX_TERMIOS=y
CONFIG_RT_USING_POSIX_AIO=y
#
# Network stack
......@@ -172,7 +184,6 @@ CONFIG_RT_LWIP_DNS=y
CONFIG_RT_LWIP_DHCP=y
CONFIG_IP_SOF_BROADCAST=1
CONFIG_IP_SOF_BROADCAST_RECV=1
# CONFIG_LWIP_USING_DHCPD is not set
#
# Static IPv4 Address
......@@ -184,8 +195,7 @@ CONFIG_RT_LWIP_UDP=y
CONFIG_RT_LWIP_TCP=y
# CONFIG_RT_LWIP_RAW is not set
# CONFIG_RT_LWIP_PPP is not set
# CONFIG_RT_LWIP_PPPOE is not set
# CONFIG_RT_LWIP_PPPOS is not set
CONFIG_RT_MEMP_NUM_NETCONN=8
CONFIG_RT_LWIP_PBUF_NUM=16
CONFIG_RT_LWIP_RAW_PCB_NUM=4
CONFIG_RT_LWIP_UDP_PCB_NUM=4
......@@ -205,37 +215,34 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
#
# Modbus master and slave stack
#
# CONFIG_RT_USING_MODBUS is not set
# CONFIG_RT_USING_NETUTILS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
CONFIG_RTGUI_USING_TTF=y
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
# CONFIG_RTGUI_IMAGE_JPEG_NONE is not set
# CONFIG_RTGUI_IMAGE_JPEG is not set
CONFIG_RTGUI_IMAGE_TJPGD=y
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_LWIP_USING_DHCPD is not set
#
# VBUS(Virtual Software BUS)
#
# CONFIG_RT_USING_VBUS is not set
#
# Utilities
#
CONFIG_RT_USING_LOGTRACE=y
CONFIG_LOG_TRACE_MAX_SESSION=16
# CONFIG_LOG_TRACE_USING_LEVEL_NOTRACE is not set
# CONFIG_LOG_TRACE_USING_LEVEL_ERROR is not set
# CONFIG_LOG_TRACE_USING_LEVEL_WARNING is not set
CONFIG_LOG_TRACE_USING_LEVEL_INFO=y
# CONFIG_LOG_TRACE_USING_LEVEL_VERBOSE is not set
# CONFIG_LOG_TRACE_USING_LEVEL_DEBUG is not set
# CONFIG_LOG_TRACE_USING_MEMLOG is not set
# CONFIG_RT_USING_RYM is not set
#
# RT-Thread online packages
#
......@@ -243,6 +250,20 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
#
# system packages
#
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
......@@ -255,14 +276,33 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set
# CONFIG_PKG_USING_TINYCRYPT is not set
#
# language packages
......@@ -273,6 +313,7 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
#
# multimedia packages
#
# CONFIG_PKG_USING_OPENMV is not set
#
# tools packages
......@@ -280,30 +321,20 @@ CONFIG_RTGUI_IMAGE_CONTAINER=y
# CONFIG_PKG_USING_CMBACKTRACE is not set
# CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_IPERF is not set
#
# miscellaneous packages
#
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
#
# example package: hello
#
# CONFIG_PKG_USING_HELLO is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_RT_USING_UART0=y
CONFIG_RT_USING_UART1=y
CONFIG_BSP_DRV_CLCD=y
CONFIG_BSP_DRV_EMAC=y
#include <rtthread.h>
#if defined(RT_USING_RTGUI) || defined(RT_USING_GUIENGINE)
#if defined(RT_USING_RTGUI) || defined(PKG_USING_GUIENGINE)
#include <rtgui/driver.h>
int lcd_init(void)
......
......@@ -8,7 +8,7 @@ config RT_USING_UART1
config BSP_DRV_CLCD
bool "CLCD driver"
depends on RT_USING_GUIENGINE
depends on PKG_USING_GUIENGINE
default y
config BSP_DRV_EMAC
......
......@@ -15,7 +15,7 @@
#define KEYBOARD_ADDRESS (0x10006000)
#define KEYBOARD_IRQ_NUM (IRQ_VEXPRESS_A9_KBD)
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/event.h>
#include <rtgui/rtgui_server.h>
......
......@@ -25,7 +25,7 @@
#define MOUSE_BUTTON_MOVE (0x40)
#define MOUSE_BUTTON_WHELL (0x80)
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/event.h>
#include <rtgui/rtgui_server.h>
......
文件模式从 100644 更改为 100755
......@@ -18,8 +18,10 @@
#define RT_DEBUG_INIT 0
#define RT_DEBUG_THREAD 0
#define RT_USING_HOOK
#define IDLE_THREAD_STACK_SIZE 256
/* RT_USING_TIMER_SOFT is not set */
#define IDLE_THREAD_STACK_SIZE 512
#define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 1024
/* Inter-Thread communication */
......@@ -38,6 +40,7 @@
#define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */
/* RT_USING_MEMHEAP_AS_HEAP is not set */
#define RT_USING_MEMTRACE
#define RT_USING_HEAP
/* Kernel Device Object */
......@@ -53,15 +56,18 @@
#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
/* C++ features */
/* RT_USING_CPLUSPLUS is not set */
#define RT_USING_CPLUSPLUS
/* Command shell */
#define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20
......@@ -85,14 +91,14 @@
#define RT_DFS_ELM_CODE_PAGE 437
#define RT_DFS_ELM_WORD_ACCESS
#define RT_DFS_ELM_USE_LFN_0
/* RT_DFS_ELM_USE_LFN_0 is not set */
/* RT_DFS_ELM_USE_LFN_1 is not set */
/* RT_DFS_ELM_USE_LFN_2 is not set */
/* RT_DFS_ELM_USE_LFN_3 is not set */
#define RT_DFS_ELM_USE_LFN 0
#define RT_DFS_ELM_USE_LFN_3
#define RT_DFS_ELM_USE_LFN 3
#define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 2
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
/* RT_DFS_ELM_USE_ERASE is not set */
#define RT_DFS_ELM_REENTRANT
#define RT_USING_DFS_DEVFS
......@@ -102,6 +108,7 @@
#define RT_USING_DFS_ROMFS
#define RT_USING_DFS_RAMFS
/* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_JFFS2 is not set */
/* RT_USING_DFS_NFS is not set */
/* Device Drivers */
......@@ -110,6 +117,7 @@
#define RT_USING_SERIAL
/* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */
/* RT_USING_CPUTIME is not set */
#define RT_USING_I2C
#define RT_USING_I2C_BITOPS
#define RT_USING_PIN
......@@ -117,8 +125,11 @@
#define RT_USING_MTD_NAND
#define RT_MTD_NAND_DEBUG
#define RT_USING_RTC
/* RT_USING_SOFT_RTC is not set */
/* RTC_SYNC_USING_NTP is not set */
#define RT_USING_SDIO
#define RT_USING_SPI
#define RT_USING_SPI_MSD
#define RT_USING_SFUD
#define RT_SFUD_USING_SFDP
#define RT_SFUD_USING_FLASH_INFO_TABLE
......@@ -142,6 +153,7 @@
#define RT_USING_POSIX
#define RT_USING_POSIX_MMAP
#define RT_USING_POSIX_TERMIOS
#define RT_USING_POSIX_AIO
/* Network stack */
......@@ -158,7 +170,6 @@
#define RT_LWIP_DHCP
#define IP_SOF_BROADCAST 1
#define IP_SOF_BROADCAST_RECV 1
/* LWIP_USING_DHCPD is not set */
/* Static IPv4 Address */
......@@ -169,8 +180,7 @@
#define RT_LWIP_TCP
/* RT_LWIP_RAW is not set */
/* RT_LWIP_PPP is not set */
/* RT_LWIP_PPPOE is not set */
/* RT_LWIP_PPPOS is not set */
#define RT_MEMP_NUM_NETCONN 8
#define RT_LWIP_PBUF_NUM 16
#define RT_LWIP_RAW_PCB_NUM 4
#define RT_LWIP_UDP_PCB_NUM 4
......@@ -190,38 +200,47 @@
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1
/* RT_LWIP_NETIF_LOOPBACK is not set */
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
#define RTGUI_USING_TTF
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
/* RTGUI_IMAGE_JPEG_NONE is not set */
/* RTGUI_IMAGE_JPEG is not set */
#define RTGUI_IMAGE_TJPGD
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
/* LWIP_USING_DHCPD is not set */
/* VBUS(Virtual Software BUS) */
/* RT_USING_VBUS is not set */
/* Utilities */
#define RT_USING_LOGTRACE
#define LOG_TRACE_MAX_SESSION 16
/* LOG_TRACE_USING_LEVEL_NOTRACE is not set */
/* LOG_TRACE_USING_LEVEL_ERROR is not set */
/* LOG_TRACE_USING_LEVEL_WARNING is not set */
#define LOG_TRACE_USING_LEVEL_INFO
/* LOG_TRACE_USING_LEVEL_VERBOSE is not set */
/* LOG_TRACE_USING_LEVEL_DEBUG is not set */
/* LOG_TRACE_USING_MEMLOG is not set */
/* RT_USING_RYM is not set */
/* RT-Thread online packages */
/* system packages */
/* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */
......@@ -233,13 +252,28 @@
/* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */
/* PKG_USING_LJSON is not set */
/* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */
/* PKG_USING_GAGENT_CLOUD is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_WLANMARVELL is not set */
/* Wiced WiFi */
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */
/* PKG_USING_MBEDTLS is not set */
/* PKG_USING_libsodium is not set */
/* PKG_USING_TINYCRYPT is not set */
/* language packages */
......@@ -248,33 +282,27 @@
/* multimedia packages */
/* PKG_USING_OPENMV is not set */
/* tools packages */
/* PKG_USING_CMBACKTRACE is not set */
/* PKG_USING_EASYLOGGER is not set */
/* PKG_USING_SYSTEMVIEW is not set */
/* PKG_USING_IPERF is not set */
/* miscellaneous packages */
/* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */
/* PKG_USING_HELLO is not set */
/* Privated Packages of RealThread */
/* PKG_USING_CODEC is not set */
/* PKG_USING_PLAYER is not set */
/* Network Utilities */
/* PKG_USING_MDNS is not set */
/* PKG_USING_UPNP is not set */
/* PKG_USING_MULTIBUTTON is not set */
#define RT_USING_UART0
#define RT_USING_UART1
#define BSP_DRV_CLCD
#define BSP_DRV_EMAC
#endif
......@@ -39,6 +39,7 @@ CONFIG_RT_USING_MEMPOOL=y
# CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP=y
#
......@@ -65,7 +66,9 @@ CONFIG_RT_CONSOLE_DEVICE_NAME="console"
# Command shell
#
CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_THREAD_PRIORITY=20
......@@ -106,6 +109,8 @@ CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_JFFS2 is not set
# CONFIG_RT_USING_DFS_NFS is not set
#
# Device Drivers
......@@ -114,6 +119,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PIN is not set
# CONFIG_RT_USING_MTD_NOR is not set
......@@ -150,26 +156,6 @@ CONFIG_RT_USING_SERIAL=y
#
# CONFIG_RT_USING_MODBUS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
# CONFIG_RTGUI_USING_TTF is not set
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
CONFIG_RTGUI_USING_DEMO=y
#
# VBUS(Virtual Software BUS)
#
......@@ -188,8 +174,21 @@ CONFIG_RTGUI_USING_DEMO=y
#
# system packages
#
#
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
CONFIG_RT_USING_PERSIMMON_EXAMPLE=y
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
......@@ -201,8 +200,26 @@ CONFIG_RT_USING_PERSIMMON_EXAMPLE=y
# CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
#
# security packages
......@@ -237,24 +254,11 @@ CONFIG_PKG_USING_FASTLZ=y
CONFIG_PKG_FASTLZ_PATH="/packages/misc/fastlz"
CONFIG_PKG_FASTLZ_VER="v1.0.0"
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
#
# example package: hello
#
# CONFIG_PKG_USING_HELLO is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
CONFIG_PKG_USING_PERSIMMON_SRC=y
CONFIG_PKG_PERSIMMON_SRC_PATH="/realthread-packages/persimmon-src"
# CONFIG_PKG_USING_PERSIMMON_SRC_v1_0_0 is not set
CONFIG_PKG_USING_PERSIMMON_LATEST_VERSION=y
CONFIG_PKG_PERSIMMON_SRC_VER="latest_version"
#
# Network Utilities
#
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_RT_USING_DFS_WINSHAREDIR=y
......@@ -36,7 +36,7 @@ void rt_init_thread_entry(void *parameter)
platform_init();
mnt_init();
#if defined(RT_USING_GUIENGINE) && defined(RTGUI_USING_DEMO)
#if defined(PKG_USING_GUIENGINE) && defined(RTGUI_USING_DEMO)
{
extern int rt_gui_demo_init(void);
rt_gui_demo_init();
......
......@@ -29,7 +29,7 @@ int platform_init(void)
#endif /* RT_USING_DFS */
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
{
extern void rt_hw_sdl_start(void);
extern int rtgui_system_server_init(void);
......
......@@ -8,7 +8,7 @@ LIBPATH = []
CPPPATH = [cwd]
# remove no need file.
if GetDepend('RT_USING_GUIENGINE') == False:
if GetDepend('PKG_USING_GUIENGINE') == False:
SrcRemove(src, 'sdl_fb.c')
else:
LIBS.append('SDL2')
......
......@@ -37,6 +37,7 @@
/* RT_USING_NOHEAP is not set */
#define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */
/* RT_USING_MEMTRACE is not set */
#define RT_USING_HEAP
/* Kernel Device Object */
......@@ -59,7 +60,9 @@
/* Command shell */
#define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20
......@@ -98,6 +101,8 @@
/* RT_USING_DFS_ROMFS is not set */
/* RT_USING_DFS_RAMFS is not set */
/* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_JFFS2 is not set */
/* RT_USING_DFS_NFS is not set */
/* Device Drivers */
......@@ -105,6 +110,7 @@
#define RT_USING_SERIAL
/* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */
/* RT_USING_CPUTIME is not set */
/* RT_USING_I2C is not set */
/* RT_USING_PIN is not set */
/* RT_USING_MTD_NOR is not set */
......@@ -135,25 +141,6 @@
/* RT_USING_MODBUS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
/* RTGUI_USING_TTF is not set */
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
#define RTGUI_USING_DEMO
/* VBUS(Virtual Software BUS) */
/* RT_USING_VBUS is not set */
......@@ -167,8 +154,19 @@
/* system packages */
/* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */
#define RT_USING_PERSIMMON_EXAMPLE
/* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */
......@@ -179,8 +177,22 @@
/* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */
/* PKG_USING_LJSON is not set */
/* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */
/* PKG_USING_GAGENT_CLOUD is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_WLANMARVELL is not set */
/* Wiced WiFi */
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */
......@@ -208,21 +220,12 @@
#define PKG_USING_FASTLZ
/* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */
/* PKG_USING_HELLO is not set */
/* Privated Packages of RealThread */
/* PKG_USING_CODEC is not set */
/* PKG_USING_PLAYER is not set */
#define PKG_USING_PERSIMMON_SRC
/* PKG_USING_PERSIMMON_SRC_v1_0_0 is not set */
#define PKG_USING_PERSIMMON_LATEST_VERSION
/* Network Utilities */
/* PKG_USING_MULTIBUTTON is not set */
#define RT_USING_DFS_WINSHAREDIR
#include "rtconfig_project.h"
......
......@@ -50,7 +50,7 @@ if PLATFORM == 'gcc':
DEVICE = ' -ffunction-sections -fdata-sections'
DEVICE = ' '
CFLAGS = DEVICE + ' -I/usr/include -w -D_REENTRANT'
CFLAGS = DEVICE + ' -I/usr/include -w -D_REENTRANT -D_LINUX -DHAVE_SYS_SIGNALS'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
#LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-linux.map -lpthread'
LFLAGS = DEVICE + ' -Wl,-Map=rtthread-linux.map -pthread -T gcc.ld'
......
......@@ -133,7 +133,7 @@ CONFIG_RT_USING_LIBC=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -118,7 +118,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -118,7 +118,7 @@ CONFIG_RT_USING_SERIAL=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# RT-Thread online packages
......
......@@ -104,7 +104,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */
......
......@@ -216,7 +216,7 @@ CONFIG_LWIP_SO_RCVBUF=1
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -9,7 +9,7 @@ startup.c
""")
# add UI engine demo.
if GetDepend('RT_USING_GUIENGINE'):
if GetDepend('PKG_USING_GUIENGINE'):
src += ['rtgui_demo.c']
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
......
......@@ -41,7 +41,7 @@
#include <gdb_stub.h>
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h"
#include <rtgui/driver.h>
#endif
......@@ -123,7 +123,7 @@ void rt_init_thread_entry(void* parameter)
#endif /* DFS */
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
{
rt_device_t device;
......
......@@ -30,7 +30,7 @@
#define DEBUG_PRINTF(...)
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
struct rtgui_win *main_win;
rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event);
......@@ -125,4 +125,4 @@ int rt_gui_demo_init(void)
return 0;
}
#endif /* RT_USING_GUIENGINE */
#endif /* PKG_USING_GUIENGINE */
......@@ -36,7 +36,7 @@ if GetDepend('RT_USING_SFUD'):
src += ['drv_spi_flash.c']
# add lcd drivers.
if GetDepend('RT_USING_GUIENGINE'):
if GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c']
CPPPATH = [cwd]
......
......@@ -200,7 +200,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -26,7 +26,7 @@
#include <dfs_posix.h>
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h"
#include <rtgui/driver.h>
#endif
......@@ -63,7 +63,7 @@ void rt_init_thread_entry(void* parameter)
#endif /* DFS */
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
{
rt_device_t device;
......
......@@ -24,7 +24,7 @@
#define DEBUG_PRINTF(...)
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h>
......@@ -123,4 +123,4 @@ int rt_gui_demo_init(void)
return 0;
}
#endif /* RT_USING_GUIENGINE */
#endif /* PKG_USING_GUIENGINE */
......@@ -69,7 +69,7 @@
/* SECTION: RTGUI support */
/* using RTGUI support */
#define RT_USING_GUIENGINE
// #define PKG_USING_GUIENGINE
/* name length of RTGUI object */
#define RTGUI_NAME_MAX 16
......
......@@ -104,7 +104,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */
......
......@@ -129,7 +129,7 @@ CONFIG_RT_USING_PIN=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -114,7 +114,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -39,7 +39,7 @@
#include <gdb_stub.h>
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h"
#include <rtgui/driver.h>
#endif
......
......@@ -123,7 +123,7 @@ CONFIG_RT_USING_PIN=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -48,7 +48,7 @@
#include <gdb_stub.h>
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h"
#include <rtgui/driver.h>
#endif
......
......@@ -109,7 +109,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -161,7 +161,7 @@ CONFIG_LWIP_SO_RCVBUF=1
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# RT-Thread online packages
......
......@@ -146,7 +146,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* RT-Thread online packages */
......
......@@ -136,7 +136,7 @@ CONFIG_RT_USING_LIBC=y
#
# RT-Thread UI Engine
#
# CONFIG_RT_USING_GUIENGINE is not set
# CONFIG_PKG_USING_GUIENGINE is not set
#
# VBUS(Virtual Software BUS)
......
......@@ -121,7 +121,7 @@
/* RT-Thread UI Engine */
/* RT_USING_GUIENGINE is not set */
/* PKG_USING_GUIENGINE is not set */
/* VBUS(Virtual Software BUS) */
......
......@@ -39,6 +39,7 @@ CONFIG_RT_USING_MEMPOOL=y
# CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM=y
# CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP=y
#
......@@ -58,6 +59,7 @@ CONFIG_ARCH_MIPS_XBURST=y
#
CONFIG_RT_USING_COMPONENTS_INIT=y
CONFIG_RT_USING_USER_MAIN=y
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
#
# C++ features
......@@ -68,7 +70,9 @@ CONFIG_RT_USING_USER_MAIN=y
# Command shell
#
CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_USING_HISTORY=y
CONFIG_FINSH_HISTORY_LINES=5
CONFIG_FINSH_USING_SYMTAB=y
CONFIG_FINSH_USING_DESCRIPTION=y
CONFIG_FINSH_THREAD_PRIORITY=20
......@@ -109,6 +113,7 @@ CONFIG_RT_USING_DFS_DEVFS=y
# CONFIG_RT_USING_DFS_ROMFS is not set
# CONFIG_RT_USING_DFS_RAMFS is not set
# CONFIG_RT_USING_DFS_UFFS is not set
# CONFIG_RT_USING_DFS_JFFS2 is not set
# CONFIG_RT_USING_DFS_NFS is not set
#
......@@ -118,6 +123,7 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_USING_SERIAL=y
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y
CONFIG_RT_USING_I2C_BITOPS=y
CONFIG_RT_USING_PIN=y
......@@ -191,33 +197,14 @@ CONFIG_SO_REUSE=1
CONFIG_LWIP_SO_RCVTIMEO=1
CONFIG_LWIP_SO_SNDTIMEO=1
CONFIG_LWIP_SO_RCVBUF=1
# CONFIG_RT_LWIP_NETIF_LOOPBACK is not set
CONFIG_LWIP_NETIF_LOOPBACK=0
#
# Modbus master and slave stack
#
# CONFIG_RT_USING_MODBUS is not set
# CONFIG_LWIP_USING_DHCPD is not set
# CONFIG_RT_USING_NETUTILS is not set
#
# RT-Thread UI Engine
#
CONFIG_RT_USING_GUIENGINE=y
CONFIG_RTGUI_NAME_MAX=16
# CONFIG_RTGUI_USING_TTF is not set
CONFIG_RTGUI_USING_FONT16=y
CONFIG_RTGUI_USING_FONT12=y
# CONFIG_RTGUI_USING_FONTHZ is not set
# CONFIG_RTGUI_IMAGE_XPM is not set
CONFIG_RTGUI_IMAGE_JPEG_NONE=y
# CONFIG_RTGUI_IMAGE_JPEG is not set
# CONFIG_RTGUI_IMAGE_TJPGD is not set
# CONFIG_RTGUI_IMAGE_PNG_NONE is not set
# CONFIG_RTGUI_IMAGE_PNG is not set
CONFIG_RTGUI_IMAGE_LODEPNG=y
# CONFIG_RTGUI_IMAGE_BMP is not set
CONFIG_RTGUI_IMAGE_CONTAINER=y
CONFIG_RTGUI_USING_DEMO=y
#
# VBUS(Virtual Software BUS)
......@@ -231,23 +218,28 @@ CONFIG_RTGUI_USING_DEMO=y
# CONFIG_RT_USING_RYM is not set
#
# RT-Thread Senior Membership Packages
# RT-Thread online packages
#
#
# system packages
#
# CONFIG_PKG_USING_FTL_SRC is not set
#
# RT-Thread online packages
#
#
# system packages
#
# CONFIG_PKG_USING_PARTITION is not set
# RT-Thread GUI Engine
#
# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_JPEG is not set
# CONFIG_GUIENGINE_IMAGE_TJPGD is not set
# CONFIG_GUIENGINE_IMAGE_PNG_NONE is not set
# CONFIG_GUIENGINE_IMAGE_PNG is not set
# CONFIG_GUIENGINE_IMAGE_LODEPNG is not set
# CONFIG_PKG_USING_GUIENGINE_V200 is not set
# CONFIG_PKG_USING_GUIENGINE_LATEST_VERSION is not set
# CONFIG_PKG_USING_PERSIMMON is not set
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
......@@ -259,8 +251,26 @@ CONFIG_RTGUI_USING_DEMO=y
# CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_LJSON is not set
# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
#
# Wi-Fi
#
#
# Marvell WiFi
#
# CONFIG_PKG_USING_WLANMARVELL is not set
#
# Wiced WiFi
#
# CONFIG_PKG_USING_WLAN_WICED is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
#
# security packages
......@@ -293,11 +303,13 @@ CONFIG_RTGUI_USING_DEMO=y
#
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
#
# example package: hello
#
# CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
CONFIG_BOARD_X1000_REALBOARD=y
# CONFIG_RT_USING_HARD_FLOAT is not set
# CONFIG_BOARD_PHOENIX is not set
......@@ -314,17 +326,12 @@ CONFIG_RT_MMCSD_STACK_SIZE=2048
CONFIG_RT_USING_I2C0=y
# CONFIG_RT_USING_I2C1 is not set
# CONFIG_RT_USING_I2C2 is not set
CONFIG_RT_USING_SLCD=y
CONFIG_RT_USING_ILI9488=y
# CONFIG_RT_USING_ILI9488 is not set
# CONFIG_RT_USING_ILI9341 is not set
# CONFIG_RT_USING_OTM4802 is not set
# CONFIG_RT_USING_TRULY_TFT240240 is not set
CONFIG_RT_USING_TOUCH=y
CONFIG_RT_USING_GT9XX=y
# CONFIG_RT_USING_GT9XX is not set
# CONFIG_RT_USING_FT6x06 is not set
CONFIG_RT_TOUCH_THREAD_PRIORITY=10
CONFIG_RT_USING_AUDIO=y
CONFIG_RT_USING_ICODEC=y
CONFIG_RT_USING_CPU_FFS=y
# CONFIG_WIFI_USING_AP6212 is not set
# CONFIG_WIFI_USING_AP6181 is not set
......@@ -60,7 +60,7 @@ if RT_USING_I2C
default n
endif
if RT_USING_GUIENGINE
if PKG_USING_GUIENGINE
config RT_USING_SLCD
bool "Using LCD display"
default y
......
......@@ -53,7 +53,7 @@ int cplusplus_system_init(void)
}
#endif
#ifdef RT_USING_GUIENGINE
#ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h>
int lcd_hw_init(void)
{
......
......@@ -37,6 +37,7 @@
/* RT_USING_NOHEAP is not set */
#define RT_USING_SMALL_MEM
/* RT_USING_SLAB is not set */
/* RT_USING_MEMTRACE is not set */
#define RT_USING_HEAP
/* Kernel Device Object */
......@@ -54,6 +55,7 @@
#define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048
/* C++ features */
......@@ -62,7 +64,9 @@
/* Command shell */
#define RT_USING_FINSH
#define FINSH_THREAD_NAME "tshell"
#define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_THREAD_PRIORITY 20
......@@ -101,6 +105,7 @@
/* RT_USING_DFS_ROMFS is not set */
/* RT_USING_DFS_RAMFS is not set */
/* RT_USING_DFS_UFFS is not set */
/* RT_USING_DFS_JFFS2 is not set */
/* RT_USING_DFS_NFS is not set */
/* Device Drivers */
......@@ -109,6 +114,7 @@
#define RT_USING_SERIAL
/* RT_USING_CAN is not set */
/* RT_USING_HWTIMER is not set */
/* RT_USING_CPUTIME is not set */
#define RT_USING_I2C
#define RT_USING_I2C_BITOPS
#define RT_USING_PIN
......@@ -176,31 +182,13 @@
#define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1
#define LWIP_SO_RCVBUF 1
/* RT_LWIP_NETIF_LOOPBACK is not set */
#define LWIP_NETIF_LOOPBACK 0
/* Modbus master and slave stack */
/* RT_USING_MODBUS is not set */
/* LWIP_USING_DHCPD is not set */
/* RT_USING_NETUTILS is not set */
/* RT-Thread UI Engine */
#define RT_USING_GUIENGINE
#define RTGUI_NAME_MAX 16
/* RTGUI_USING_TTF is not set */
#define RTGUI_USING_FONT16
#define RTGUI_USING_FONT12
/* RTGUI_USING_FONTHZ is not set */
/* RTGUI_IMAGE_XPM is not set */
#define RTGUI_IMAGE_JPEG_NONE
/* RTGUI_IMAGE_JPEG is not set */
/* RTGUI_IMAGE_TJPGD is not set */
/* RTGUI_IMAGE_PNG_NONE is not set */
/* RTGUI_IMAGE_PNG is not set */
#define RTGUI_IMAGE_LODEPNG
/* RTGUI_IMAGE_BMP is not set */
#define RTGUI_IMAGE_CONTAINER
#define RTGUI_USING_DEMO
/* VBUS(Virtual Software BUS) */
......@@ -211,18 +199,24 @@
/* RT_USING_LOGTRACE is not set */
/* RT_USING_RYM is not set */
/* RT-Thread Senior Membership Packages */
/* system packages */
/* PKG_USING_FTL_SRC is not set */
/* RT-Thread online packages */
/* system packages */
/* PKG_USING_PARTITION is not set */
/* RT-Thread GUI Engine */
/* PKG_USING_GUIENGINE is not set */
/* GUIENGINE_IMAGE_JPEG_NONE is not set */
/* GUIENGINE_IMAGE_JPEG is not set */
/* GUIENGINE_IMAGE_TJPGD is not set */
/* GUIENGINE_IMAGE_PNG_NONE is not set */
/* GUIENGINE_IMAGE_PNG is not set */
/* GUIENGINE_IMAGE_LODEPNG is not set */
/* PKG_USING_GUIENGINE_V200 is not set */
/* PKG_USING_GUIENGINE_LATEST_VERSION is not set */
/* PKG_USING_PERSIMMON is not set */
/* PKG_USING_LWEXT4 is not set */
/* PKG_USING_PARTITION is not set */
/* PKG_USING_SQLITE is not set */
/* PKG_USING_RTI is not set */
......@@ -233,8 +227,22 @@
/* PKG_USING_MONGOOSE is not set */
/* PKG_USING_WEBTERMINAL is not set */
/* PKG_USING_CJSON is not set */
/* PKG_USING_LJSON is not set */
/* PKG_USING_EZXML is not set */
/* PKG_USING_NANOPB is not set */
/* PKG_USING_GAGENT_CLOUD is not set */
/* Wi-Fi */
/* Marvell WiFi */
/* PKG_USING_WLANMARVELL is not set */
/* Wiced WiFi */
/* PKG_USING_WLAN_WICED is not set */
/* PKG_USING_COAP is not set */
/* PKG_USING_NOPOLL is not set */
/* security packages */
......@@ -262,10 +270,12 @@
/* PKG_USING_FASTLZ is not set */
/* PKG_USING_MINILZO is not set */
/* PKG_USING_QUICKLZ is not set */
/* example package: hello */
/* PKG_USING_HELLO is not set */
/* PKG_USING_MULTIBUTTON is not set */
#define BOARD_X1000_REALBOARD
/* RT_USING_HARD_FLOAT is not set */
/* BOARD_PHOENIX is not set */
......@@ -282,19 +292,14 @@
#define RT_USING_I2C0
/* RT_USING_I2C1 is not set */
/* RT_USING_I2C2 is not set */
#define RT_USING_SLCD
#define RT_USING_ILI9488
/* RT_USING_ILI9488 is not set */
/* RT_USING_ILI9341 is not set */
/* RT_USING_OTM4802 is not set */
/* RT_USING_TRULY_TFT240240 is not set */
#define RT_USING_TOUCH
#define RT_USING_GT9XX
/* RT_USING_GT9XX is not set */
/* RT_USING_FT6x06 is not set */
#define RT_TOUCH_THREAD_PRIORITY 10
#define RT_USING_AUDIO
#define RT_USING_ICODEC
#define RT_USING_CPU_FFS
/* WIFI_USING_AP6212 is not set */
/* WIFI_USING_AP6181 is not set */
#endif
......@@ -28,8 +28,6 @@ source "$RTT_DIR/components/libc/Kconfig"
source "$RTT_DIR/components/net/Kconfig"
source "$RTT_DIR/components/gui/Kconfig"
source "$RTT_DIR/components/vbus/Kconfig"
source "$RTT_DIR/components/utilities/Kconfig"
......
menu "RT-Thread UI Engine"
config RT_USING_GUIENGINE
bool "Enable UI Engine"
default n
if RT_USING_GUIENGINE
config RTGUI_NAME_MAX
int "The maximal size of name in GUI engine"
default 16
config RTGUI_USING_TTF
bool "Support TrueType font"
default n
if RTGUI_USING_TTF
config UTF8_TO_UNICODE
bool "Support UTF8 to UNICODE"
default n
endif
config RTGUI_USING_FONT16
bool "Support 16 height font"
default y
config RTGUI_USING_FONT12
bool "Support 12 height font"
default y
config RTGUI_USING_FONTHZ
bool "Support Chinese font"
default n
if RTGUI_USING_FONTHZ
config RTGUI_USING_HZ_BMP
bool "Use bitmap Chinese font"
default n
endif
config RTGUI_IMAGE_XPM
bool "Support XPM image format"
default n
choice
prompt "JPEG image format"
default RTGUI_IMAGE_JPEG_NONE
config RTGUI_IMAGE_JPEG_NONE
bool "No"
config RTGUI_IMAGE_JPEG
bool "with libjpeg"
config RTGUI_IMAGE_TJPGD
bool "with TJpgDec(Tiny JPEG Decompressor)"
endchoice
choice
prompt "PNG image format"
default RTGUI_IMAGE_LODEPNG
config RTGUI_IMAGE_PNG_NONE
bool "No"
config RTGUI_IMAGE_PNG
bool "with libpng"
config RTGUI_IMAGE_LODEPNG
bool "with LodePNG"
endchoice
config RTGUI_IMAGE_BMP
bool "Support BMP image format"
default n
config RTGUI_IMAGE_CONTAINER
bool "Use image container"
default y
config RTGUI_USING_DEMO
bool "Enable the example of UI Engine"
default n
endif
endmenu
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
if GetDepend('RT_USING_GUIENGINE'):
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('gui_demo', src, depend = ['RT_USING_GUIENGINE', 'RTGUI_USING_DEMO'], CPPPATH = CPPPATH)
Return('group')
#include <rtthread.h>
#if defined(RT_USING_GUIENGINE) && defined(RTGUI_USING_DEMO)
#include <rtgui/rtgui.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/image.h>
#include <rtgui/widgets/window.h>
#include <rtgui/dc.h>
extern const unsigned char _picture_png[];
extern int _picture_png_length_get(void);
static rt_bool_t show_demo(struct rtgui_win *win)
{
struct rtgui_dc *dc;
rtgui_rect_t rect;
dc = rtgui_dc_begin_drawing(RTGUI_WIDGET(win));
if (dc == RT_NULL)
{
rt_kprintf("dc is null \n");
return RT_FALSE;
}
rtgui_dc_get_rect(dc, &rect);
/* draw circular */
{
rt_int16_t x, y, r;
x = rect.x2 / 2 / 2;
y = rect.y2 / 2 / 2;
r = x > y ? y : x;
r -= y / 10;
rtgui_dc_draw_circle(dc, x, y, r);
}
/* draw image */
{
rtgui_rect_t draw_rect;
struct rtgui_image *img;
img = rtgui_image_create_from_mem("png", _picture_png, _picture_png_length_get(), RT_TRUE);
if (img != RT_NULL)
{
draw_rect.x1 = rect.x2 / 2 + (rect.x2 / 2 - img->w) / 2;
draw_rect.y1 = (rect.y2 / 2 - img->h) / 2;
draw_rect.x2 = draw_rect.x1 + img->w;
draw_rect.y2 = draw_rect.y1 + img->h;
rtgui_image_blit(img, dc, &draw_rect);
}
}
/* draw text */
{
rtgui_color_t fc;
rtgui_rect_t draw_rect;
char *text_buf = "Hello RT-thread!";
fc = RTGUI_DC_FC(dc);
RTGUI_DC_FC(dc) = RED;
draw_rect.x1 = rect.x2 * 2 / 5;
draw_rect.y1 = rect.y2 * 3 / 4;
draw_rect.x2 = rect.x2;
draw_rect.y2 = rect.y2;
rtgui_dc_draw_text(dc, text_buf, &draw_rect);
RTGUI_DC_FC(dc) = fc;
}
rtgui_dc_end_drawing(dc, RT_TRUE);
return RT_TRUE;
}
rt_bool_t dc_event_handler(struct rtgui_object *object, rtgui_event_t *event)
{
rt_bool_t err;
struct rtgui_win *win = RTGUI_WIN(object);
err = rtgui_win_event_handler(RTGUI_OBJECT(win), event);
if (event->type == RTGUI_EVENT_PAINT)
show_demo(win);
return err;
}
static void rt_gui_demo_entry(void *parameter)
{
struct rtgui_win *main_win;
struct rtgui_app *app;
/* create gui app */
app = rtgui_app_create("gui_demo");
if (app == RT_NULL)
return;
main_win = rtgui_mainwin_create(RT_NULL, "UiWindow", RTGUI_WIN_STYLE_NO_TITLE);
if (main_win == RT_NULL)
{
rtgui_app_destroy(app);
return;
}
rtgui_object_set_event_handler(RTGUI_OBJECT(main_win), dc_event_handler);
rtgui_win_show(main_win, RT_FALSE);
rtgui_app_run(app);
rtgui_win_destroy(main_win);
rtgui_app_destroy(app);
}
int rt_gui_demo_init(void)
{
rt_thread_t tid;
tid = rt_thread_create("mygui",
rt_gui_demo_entry, RT_NULL,
2048, 25, 10);
if (tid != RT_NULL)
rt_thread_startup(tid);
return 0;
}
INIT_APP_EXPORT(rt_gui_demo_init);
#endif /* RT_USING_RTGUI */
\ No newline at end of file
此差异已折叠。
# RT-Thread building script for gui
from building import *
cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [ cwd,
cwd + '/rtgui',
cwd + '/rtgui/widgets']
group = DefineGroup('GuiEngine', src, depend = [''], CPPPATH = CPPPATH)
Return('group')
\ No newline at end of file
/*
* File : blit.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2013-10-04 Bernard porting SDL software render to RT-Thread GUI
*/
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef __RTGUI_BLIT_H__
#define __RTGUI_BLIT_H__
#include <rtgui/rtgui.h>
#include <rtgui/dc.h>
/* Assemble R-G-B values into a specified pixel format and store them */
#define RGB565_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((r>>3)<<11)|((g>>2)<<5)|(b>>3); \
}
#define BGR565_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((b>>3)<<11)|((g>>2)<<5)|(r>>3); \
}
#define RGB555_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3); \
}
#define RGB888_FROM_RGB(Pixel, r, g, b) \
{ \
Pixel = (r<<16)|(g<<8)|b; \
}
#define ARGB8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (a<<24)|(r<<16)|(g<<8)|b; \
}
#define RGBA8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (r<<24)|(g<<16)|(b<<8)|a; \
}
#define ABGR8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (a<<24)|(b<<16)|(g<<8)|r; \
}
#define BGRA8888_FROM_RGBA(Pixel, r, g, b, a) \
{ \
Pixel = (b<<24)|(g<<16)|(r<<8)|a; \
}
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a) \
{ \
r = r ? ((r << 2) | 0x3) : 0; \
g = g ? ((g << 2) | 0x3) : 0; \
b = b ? ((b << 2) | 0x3) : 0; \
a = (a * 3) / 255; \
Pixel = (a<<30)|(r<<20)|(g<<10)|b; \
}
/* Load pixel of the specified format from a buffer and get its R-G-B values */
#define RGB_FROM_RGB565(Pixel, r, g, b) \
{ \
r = rtgui_blit_expand_byte[3][((Pixel&0xF800)>>11)]; \
g = rtgui_blit_expand_byte[2][((Pixel&0x07E0)>>5)]; \
b = rtgui_blit_expand_byte[3][(Pixel&0x001F)]; \
}
#define RGB_FROM_BGR565(Pixel, r, g, b) \
{ \
b = rtgui_blit_expand_byte[3][((Pixel&0xF800)>>11)]; \
g = rtgui_blit_expand_byte[2][((Pixel&0x07E0)>>5)]; \
r = rtgui_blit_expand_byte[3][(Pixel&0x001F)]; \
}
#define RGB_FROM_RGB555(Pixel, r, g, b) \
{ \
r = rtgui_blit_expand_byte[3][((Pixel&0x7C00)>>10)]; \
g = rtgui_blit_expand_byte[3][((Pixel&0x03E0)>>5)]; \
b = rtgui_blit_expand_byte[3][(Pixel&0x001F)]; \
}
#define RGB_FROM_RGB888(Pixel, r, g, b) \
{ \
r = ((Pixel&0xFF0000)>>16); \
g = ((Pixel&0xFF00)>>8); \
b = (Pixel&0xFF); \
}
#define RGBA_FROM_RGBA8888(Pixel, r, g, b, a) \
{ \
r = (Pixel>>24); \
g = ((Pixel>>16)&0xFF); \
b = ((Pixel>>8)&0xFF); \
a = (Pixel&0xFF); \
}
#define RGBA_FROM_ARGB8888(Pixel, r, g, b, a) \
{ \
r = ((Pixel>>16)&0xFF); \
g = ((Pixel>>8)&0xFF); \
b = (Pixel&0xFF); \
a = (Pixel>>24); \
}
#define RGBA_FROM_ABGR8888(Pixel, r, g, b, a) \
{ \
r = (Pixel&0xFF); \
g = ((Pixel>>8)&0xFF); \
b = ((Pixel>>16)&0xFF); \
a = (Pixel>>24); \
}
#define RGBA_FROM_BGRA8888(Pixel, r, g, b, a) \
{ \
r = ((Pixel>>8)&0xFF); \
g = ((Pixel>>16)&0xFF); \
b = (Pixel>>24); \
a = (Pixel&0xFF); \
}
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a) \
{ \
r = ((Pixel>>22)&0xFF); \
g = ((Pixel>>12)&0xFF); \
b = ((Pixel>>2)&0xFF); \
a = rtgui_blit_expand_byte[6][(Pixel>>30)]; \
}
/* 4-times unrolled loop */
#define DUFFS_LOOP4(pixel_copy_increment, width) \
{ int n = (width+3)/4; \
switch (width & 3) { \
case 0: do { pixel_copy_increment; \
case 3: pixel_copy_increment; \
case 2: pixel_copy_increment; \
case 1: pixel_copy_increment; \
} while (--n > 0); \
} \
}
/* 8-times unrolled loop */
#define DUFFS_LOOP8(pixel_copy_increment, width) \
{ int n = (width+7)/8; \
switch (width & 7) { \
case 0: do { pixel_copy_increment; \
case 7: pixel_copy_increment; \
case 6: pixel_copy_increment; \
case 5: pixel_copy_increment; \
case 4: pixel_copy_increment; \
case 3: pixel_copy_increment; \
case 2: pixel_copy_increment; \
case 1: pixel_copy_increment; \
} while ( --n > 0 ); \
} \
}
/* Use the 8-times version of the loop by default */
#define DUFFS_LOOP(pixel_copy_increment, width) \
DUFFS_LOOP8(pixel_copy_increment, width)
struct rtgui_blit_info
{
rt_uint8_t *src;
int src_w, src_h;
int src_pitch;
int src_skip;
rt_uint8_t *dst;
int dst_w, dst_h;
int dst_pitch;
int dst_skip;
rt_uint8_t src_fmt;
rt_uint8_t dst_fmt;
rt_uint8_t r, g, b, a;
};
struct rtgui_image_info
{
rt_uint8_t *pixels;
int src_pitch;
rt_uint8_t src_fmt;
rt_uint8_t a;
};
extern const rt_uint8_t* rtgui_blit_expand_byte[9];
typedef void (*rtgui_blit_line_func)(rt_uint8_t *dst, rt_uint8_t *src, int line);
rtgui_blit_line_func rtgui_blit_line_get(int dst_bpp, int src_bpp);
rtgui_blit_line_func rtgui_blit_line_get_inv(int dst_bpp, int src_bpp);
void rtgui_blit(struct rtgui_blit_info * info);
void rtgui_image_info_blit(struct rtgui_image_info* image, struct rtgui_dc* dc, struct rtgui_rect *dc_rect);
#endif
/*
* File : color.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
* 2012-01-24 onelife add mono color support
*/
#ifndef __RTGUI_COLOR_H__
#define __RTGUI_COLOR_H__
#include <rtgui/rtgui.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The color used in the GUI:
*
* bit bit
* RGB565 15 R,G,B 0
* BGR565 15 B,G,R 0
* RGB888 23 R,G,B 0
* ARGB888 31 A,R,G,B 0
* RGBA888 31 R,G,B,A 0
* ABGR888 31 A,B,G,R 0
*
* The rtgui_color is defined as ARGB888.
* bit31 A,R,G,B bit0
*/
#define RTGUI_ARGB(a, r, g, b) \
((rtgui_color_t)(((rt_uint8_t)(b)|\
(((unsigned long)(rt_uint8_t)(g))<<8))|\
(((unsigned long)(rt_uint8_t)(r))<<16)|\
(((unsigned long)(rt_uint8_t)(a))<<24)))
#define RTGUI_RGB(r, g, b) RTGUI_ARGB(255, (r), (g), (b))
#define RTGUI_RGB_B(c) ((c) & 0xff)
#define RTGUI_RGB_G(c) (((c) >> 8) & 0xff)
#define RTGUI_RGB_R(c) (((c) >> 16) & 0xff)
#define RTGUI_RGB_A(c) (((c) >> 24) & 0xff)
extern const rtgui_color_t default_foreground;
extern const rtgui_color_t default_background;
/* it's better use these color definitions */
#define RED RTGUI_RGB(0xff, 0x00, 0x00)
#define GREEN RTGUI_RGB(0x00, 0xff, 0x00)
#define BLUE RTGUI_RGB(0x00, 0x00, 0xff)
#define BLACK RTGUI_RGB(0x00, 0x00, 0x00)
#define WHITE RTGUI_RGB(0xff, 0xff, 0xff)
#define HIGH_LIGHT RTGUI_RGB(0xfc, 0xfc, 0xfc)
#define DARK_GREY RTGUI_RGB(0x7f, 0x7f, 0x7f)
#define LIGHT_GREY RTGUI_RGB(0xc0, 0xc0, 0xc0)
#ifdef TRANSPARENT
#undef TRANSPARENT
#endif
#define TRANSPARENT RTGUI_ARGB(0, 0, 0, 0)
extern const rtgui_color_t red;
extern const rtgui_color_t green;
extern const rtgui_color_t blue;
extern const rtgui_color_t black;
extern const rtgui_color_t white;
extern const rtgui_color_t high_light;
extern const rtgui_color_t dark_grey;
extern const rtgui_color_t light_grey;
/*
* RTGUI default color format: ARGB
* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB
* 31 0
*/
/* convert rtgui color to mono */
rt_inline rt_uint8_t rtgui_color_to_mono(rtgui_color_t c)
{
rt_uint8_t pixel;
pixel = (RTGUI_RGB_R(c) | RTGUI_RGB_G(c) | RTGUI_RGB_B(c)) ? 0x01 : 0x00;
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_mono(rt_uint8_t pixel)
{
rtgui_color_t color;
if (pixel)
{
color = white;
}
else
{
color = black;
}
return color;
}
/* convert rtgui color to RRRRRGGGGGGBBBBB */
rt_inline rt_uint16_t rtgui_color_to_565(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_R(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_B(c) >> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565(rt_uint16_t pixel)
{
rt_uint16_t r, g, b;
rtgui_color_t color;
r = (pixel >> 11) & 0x1f;
g = (pixel >> 5) & 0x3f;
b = pixel & 0x1f;
color = b * 255 / 31 + ((g * 255 / 63) << 8) + ((r * 255 / 31) << 16);
return color;
}
/* convert rtgui color to BBBBBGGGGGGRRRRR */
rt_inline rt_uint16_t rtgui_color_to_565p(rtgui_color_t c)
{
rt_uint16_t pixel;
pixel = (rt_uint16_t)(((RTGUI_RGB_B(c) >> 3) << 11) | ((RTGUI_RGB_G(c) >> 2) << 5) | (RTGUI_RGB_R(c) >> 3));
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_565p(rt_uint16_t pixel)
{
rt_uint8_t r, g, b;
rtgui_color_t color;
r = pixel & 0x1f;
g = (pixel >> 5) & 0x3f;
b = (pixel >> 11) & 0x1f;
color = b * 255 / 31 + ((g * 255 / 63) << 8) + ((r * 255 / 31) << 16);
return color;
}
/* convert rtgui color to RGB */
rt_inline rt_uint32_t rtgui_color_to_888(rtgui_color_t c)
{
rt_uint32_t pixel;
pixel = RTGUI_RGB_R(c) << 16 | RTGUI_RGB_G(c) << 8 | RTGUI_RGB_B(c);
return pixel;
}
rt_inline rtgui_color_t rtgui_color_from_888(rt_uint32_t pixel)
{
rtgui_color_t color;
color = RTGUI_RGB(((pixel >> 16) & 0xff), ((pixel >> 8) & 0xff), pixel & 0xff);
return color;
}
/* get the bits of specified pixle format */
rt_uint8_t rtgui_color_get_bits(rt_uint8_t pixel_format) RTGUI_PURE;
/* get the bytes of specified pixle format */
rt_uint8_t rtgui_color_get_bpp(rt_uint8_t pixel_format) RTGUI_PURE;
#ifdef __cplusplus
}
#endif
#endif
/*
* File : dc.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_DC_H__
#define __RTGUI_DC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtgui/rtgui.h>
#include <rtgui/font.h>
#include <rtgui/driver.h>
#include <rtgui/widgets/widget.h>
#define RTGUI_DC(dc) ((struct rtgui_dc*)(dc))
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
enum rtgui_dc_type
{
RTGUI_DC_HW,
RTGUI_DC_CLIENT,
RTGUI_DC_BUFFER,
};
struct rtgui_dc_engine
{
/* interface */
void (*draw_point)(struct rtgui_dc *dc, int x, int y);
void (*draw_color_point)(struct rtgui_dc *dc, int x, int y, rtgui_color_t color);
void (*draw_vline)(struct rtgui_dc *dc, int x, int y1, int y2);
void (*draw_hline)(struct rtgui_dc *dc, int x1, int x2, int y);
void (*fill_rect)(struct rtgui_dc *dc, rtgui_rect_t *rect);
void (*blit_line)(struct rtgui_dc *dc, int x1, int x2, int y, rt_uint8_t *line_data);
void (*blit)(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect);
rt_bool_t (*fini)(struct rtgui_dc *dc);
};
/*
* The abstract device context
*
* Normally, a DC is a drawable canvas, user can draw point/line/cycle etc
* on the DC.
*
* There are several kinds of DC:
* - Hardware DC;
* - Client DC;
* - Buffer DC;
*/
struct rtgui_dc
{
/* type of device context */
rt_uint32_t type;
/* dc engine */
const struct rtgui_dc_engine *engine;
};
/*
* The hardware device context
*
* The hardware DC is a context based on hardware device, for examle the
* LCD device. The operations on the hardware DC are reflected to the real
* hardware.
*
*/
struct rtgui_dc_hw
{
struct rtgui_dc parent;
rtgui_widget_t *owner;
const struct rtgui_graphic_driver *hw_driver;
};
/**
* The buffer dc is a device context with memory buffer.
*
* All the operations on this device context is reflected to the memory buffer.
*/
struct rtgui_dc_buffer
{
struct rtgui_dc parent;
/* graphic context */
rtgui_gc_t gc;
/* pixel format */
rt_uint8_t pixel_format;
rt_uint8_t blend_mode; /* RTGUI_BLENDMODE: None/Blend/Add/Mod */
/* width and height */
rt_uint16_t width, height;
/* pitch */
rt_uint16_t pitch;
#ifdef RTGUI_IMAGE_CONTAINER
/* image dc */
struct rtgui_image_item *image_item;
#endif
/* pixel alpha */
rt_uint8_t pixel_alpha;
/* pixel data */
rt_uint8_t *pixel;
};
#define RTGUI_DC_FC(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->foreground)
#define RTGUI_DC_BC(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->background)
#define RTGUI_DC_FONT(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->font)
#define RTGUI_DC_TEXTALIGN(dc) (rtgui_dc_get_gc(RTGUI_DC(dc))->textalign)
/* create a buffer dc */
struct rtgui_dc *rtgui_dc_buffer_create(int width, int height);
struct rtgui_dc *rtgui_dc_buffer_create_pixformat(rt_uint8_t pixel_format, int w, int h);
#ifdef RTGUI_IMAGE_CONTAINER
struct rtgui_dc *rtgui_img_dc_create_pixformat(rt_uint8_t pixel_format, rt_uint8_t *pixel,
struct rtgui_image_item *image_item);
#endif
struct rtgui_dc *rtgui_dc_buffer_create_from_dc(struct rtgui_dc* dc);
void rtgui_dc_buffer_set_alpha(struct rtgui_dc* dc, rt_uint8_t pixel_alpha);
/* create a widget dc */
struct rtgui_dc *rtgui_dc_widget_create(struct rtgui_widget * owner);
/* begin and end a drawing */
struct rtgui_dc *rtgui_dc_begin_drawing(rtgui_widget_t *owner);
void rtgui_dc_end_drawing(struct rtgui_dc *dc, rt_bool_t update);
/* destroy a dc */
void rtgui_dc_destory(struct rtgui_dc *dc);
/* create a hardware dc */
struct rtgui_dc *rtgui_dc_hw_create(rtgui_widget_t *owner);
/* create a client dc */
struct rtgui_dc *rtgui_dc_client_create(rtgui_widget_t *owner);
void rtgui_dc_client_init(rtgui_widget_t *owner);
rt_uint8_t *rtgui_dc_buffer_get_pixel(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);
/** Fill a vertical gradient rect from @c1 to @c2 */
void rtgui_dc_fill_gradient_rectv(struct rtgui_dc *dc, rtgui_rect_t *rect,
rtgui_color_t c1, rtgui_color_t c2);
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_pie(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_pie(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r, rt_int16_t start, rt_int16_t end);
void rtgui_dc_draw_text(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect);
void rtgui_dc_draw_text_stroke(struct rtgui_dc *dc, const char *text, struct rtgui_rect *rect,
rtgui_color_t color_stroke, rtgui_color_t color_core);
void rtgui_dc_draw_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);
/* alpha blending functions */
void rtgui_dc_draw_aa_line(struct rtgui_dc * dst,int x1,int y1,int x2,int y2);
void rtgui_dc_draw_aa_lines(struct rtgui_dc * dst,const struct rtgui_point * points,int count);
void rtgui_dc_blend_point(struct rtgui_dc * dst,int x,int y,enum RTGUI_BLENDMODE blendMode,rt_uint8_t r,rt_uint8_t g,rt_uint8_t b,rt_uint8_t a);
void rtgui_dc_blend_points(struct rtgui_dc * dst,const rtgui_point_t * points,int count,enum RTGUI_BLENDMODE blendMode,rt_uint8_t r,rt_uint8_t g,rt_uint8_t b,rt_uint8_t a);
void rtgui_dc_blend_line(struct rtgui_dc * dst,int x1,int y1,int x2,int y2,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_blend_lines(struct rtgui_dc * dst,const rtgui_point_t * points,int count,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_blend_fill_rect(struct rtgui_dc * dst,const rtgui_rect_t * rect,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_blend_fill_rects(struct rtgui_dc * dst,const rtgui_rect_t * rects,int count,enum RTGUI_BLENDMODE blendMode,rtgui_color_t color);
void rtgui_dc_draw_aa_circle(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t r);
void rtgui_dc_draw_aa_ellipse(struct rtgui_dc *dc, rt_int16_t x, rt_int16_t y, rt_int16_t rx, rt_int16_t ry);
int rtgui_dc_draw_thick_line(struct rtgui_dc * dst, rt_int16_t x1, rt_int16_t y1, rt_int16_t x2, rt_int16_t y2, rt_uint8_t width);
/*
* 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 (x, y) on another dc(rect)
*/
rt_inline void rtgui_dc_blit(struct rtgui_dc *dc, struct rtgui_point *dc_point, struct rtgui_dc *dest, rtgui_rect_t *rect)
{
dc->engine->blit(dc, dc_point, dest, rect);
}
/* set gc of dc */
void rtgui_dc_set_gc(struct rtgui_dc *dc, rtgui_gc_t *gc);
/* get gc of dc */
rtgui_gc_t *rtgui_dc_get_gc(struct rtgui_dc *dc);
/* get visible status of dc */
rt_bool_t rtgui_dc_get_visible(struct rtgui_dc *dc);
/* get rect of dc */
void rtgui_dc_get_rect(struct rtgui_dc *dc, rtgui_rect_t *rect);
/* get pixel format */
rt_uint8_t rtgui_dc_get_pixel_format(struct rtgui_dc *dc);
/* coordinate conversion */
void rtgui_dc_logic_to_device(struct rtgui_dc* dc, struct rtgui_point *point);
void rtgui_dc_rect_to_device(struct rtgui_dc* dc, struct rtgui_rect* rect);
/* dc rotation and zoom operations */
struct rtgui_dc *rtgui_dc_shrink(struct rtgui_dc *dc, int factorx, int factory);
struct rtgui_dc *rtgui_dc_zoom(struct rtgui_dc *dc, double zoomx, double zoomy, int smooth);
struct rtgui_dc *rtgui_dc_rotozoom(struct rtgui_dc *dc, double angle, double zoomx, double zoomy, int smooth);
/* dc buffer dump to file */
void rtgui_dc_buffer_dump(struct rtgui_dc *self, char *fn);
#ifdef __cplusplus
}
#endif
#endif
/*
* File : dc_draw.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2013-10-04 Bernard porting SDL software render to RT-Thread GUI
*/
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef __DC_DRAW_H__
#define __DC_DRAW_H__
#include <rtgui/blit.h>
/* This code assumes that r, g, b, a are the source color,
* and in the blend and add case, the RGB values are premultiplied by a.
*/
#define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/256)
#define DRAW_FASTSETPIXEL(type) \
*pixel = (type) color
#define DRAW_FASTSETPIXEL1 DRAW_FASTSETPIXEL(rt_uint8_t)
#define DRAW_FASTSETPIXEL2 DRAW_FASTSETPIXEL(rt_uint16_t)
#define DRAW_FASTSETPIXEL4 DRAW_FASTSETPIXEL(rt_uint32_t)
#define DRAW_FASTSETPIXELXY(x, y, type, bpp, color) \
*(type *)(_dc_get_pixel(dst, x, y))= (type) color
#define DRAW_FASTSETPIXELXY1(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint8_t, 1, color)
#define DRAW_FASTSETPIXELXY2(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint16_t, 2, color)
#define DRAW_FASTSETPIXELXY4(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint32_t, 4, color)
#define DRAW_SETPIXEL(setpixel) \
do { \
unsigned sr = r, sg = g, sb = b, sa = a; (void) sa; \
setpixel; \
} while (0)
#define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr = DRAW_MUL(inva, sr) + r; \
sg = DRAW_MUL(inva, sg) + g; \
sb = DRAW_MUL(inva, sb) + b; \
setpixel; \
} while (0)
#define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr += r; if (sr > 0xff) sr = 0xff; \
sg += g; if (sg > 0xff) sg = 0xff; \
sb += b; if (sb > 0xff) sb = 0xff; \
setpixel; \
} while (0)
#define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
do { \
unsigned sr, sg, sb, sa; (void) sa; \
getpixel; \
sr = DRAW_MUL(sr, r); \
sg = DRAW_MUL(sg, g); \
sb = DRAW_MUL(sb, b); \
setpixel; \
} while (0)
#define DRAW_SETPIXELXY(x, y, type, bpp, op) \
do { \
type *pixel = (type *)(_dc_get_pixel(dst, x, y));\
op; \
} while (0)
/*
* Define draw operators for RGB555
*/
#define DRAW_SETPIXEL_RGB555 \
DRAW_SETPIXEL(RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_RGB555 \
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_RGB555 \
DRAW_SETPIXEL_ADD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_RGB555 \
DRAW_SETPIXEL_MOD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
RGB555_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_RGB555)
#define DRAW_SETPIXELXY_BLEND_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BLEND_RGB555)
#define DRAW_SETPIXELXY_ADD_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_ADD_RGB555)
#define DRAW_SETPIXELXY_MOD_RGB555(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_MOD_RGB555)
/*
* Define draw operators for RGB565
*/
#define DRAW_SETPIXEL_RGB565 \
DRAW_SETPIXEL(RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_RGB565 \
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_RGB565 \
DRAW_SETPIXEL_ADD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_RGB565 \
DRAW_SETPIXEL_MOD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
RGB565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_RGB565)
#define DRAW_SETPIXELXY_BLEND_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BLEND_RGB565)
#define DRAW_SETPIXELXY_ADD_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_ADD_RGB565)
#define DRAW_SETPIXELXY_MOD_RGB565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_MOD_RGB565)
/*
* Define draw operators for BGR565
*/
#define DRAW_SETPIXEL_BGR565 \
DRAW_SETPIXEL(BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_BGR565 \
DRAW_SETPIXEL_BLEND(RGB_FROM_BGR565(*pixel, sr, sg, sb), \
BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_BGR565 \
DRAW_SETPIXEL_ADD(RGB_FROM_BGR565(*pixel, sr, sg, sb), \
BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_BGR565 \
DRAW_SETPIXEL_MOD(RGB_FROM_BGR565(*pixel, sr, sg, sb), \
BGR565_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BGR565)
#define DRAW_SETPIXELXY_BLEND_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_BLEND_BGR565)
#define DRAW_SETPIXELXY_ADD_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_ADD_BGR565)
#define DRAW_SETPIXELXY_MOD_BGR565(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint16_t, 2, DRAW_SETPIXEL_MOD_BGR565)
/*
* Define draw operators for RGB888
*/
#define DRAW_SETPIXEL_RGB888 \
DRAW_SETPIXEL(RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_BLEND_RGB888 \
DRAW_SETPIXEL_BLEND(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_ADD_RGB888 \
DRAW_SETPIXEL_ADD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXEL_MOD_RGB888 \
DRAW_SETPIXEL_MOD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
RGB888_FROM_RGB(*pixel, sr, sg, sb))
#define DRAW_SETPIXELXY_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_RGB888)
#define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_BLEND_RGB888)
#define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ADD_RGB888)
#define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_MOD_RGB888)
/*
* Define draw operators for ARGB8888
*/
#define DRAW_SETPIXEL_ARGB8888 \
DRAW_SETPIXEL(ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXEL_BLEND_ARGB8888 \
DRAW_SETPIXEL_BLEND(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXEL_ADD_ARGB8888 \
DRAW_SETPIXEL_ADD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXEL_MOD_ARGB8888 \
DRAW_SETPIXEL_MOD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
#define DRAW_SETPIXELXY_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ARGB8888)
#define DRAW_SETPIXELXY_BLEND_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_BLEND_ARGB8888)
#define DRAW_SETPIXELXY_ADD_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ADD_ARGB8888)
#define DRAW_SETPIXELXY_MOD_ARGB8888(x, y) \
DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_MOD_ARGB8888)
/*
* Define line drawing macro
*/
#define ABS(_x) ((_x) < 0 ? -(_x) : (_x))
/* Horizontal line */
#define HLINE(type, op, draw_end) \
{ \
int length; \
type *pixel; \
if (x1 <= x2) { \
pixel = (type *)_dc_get_pixel(dst, x1, y1); \
length = draw_end ? (x2-x1+1) : (x2-x1); \
} else { \
pixel = (type *)_dc_get_pixel(dst, x2, y1); \
if (!draw_end) { \
++pixel; \
} \
length = draw_end ? (x1-x2+1) : (x1-x2); \
} \
while (length--) { \
op; \
++pixel; \
} \
}
/* Vertical line */
#define VLINE(type, op, draw_end) \
{ \
int length; \
int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
type *pixel; \
if (y1 <= y2) { \
pixel = (type *)_dc_get_pixel(dst, x1, y1); \
length = draw_end ? (y2-y1+1) : (y2-y1); \
} else { \
pixel = (type *)_dc_get_pixel(dst, x1, y2); \
if (!draw_end) { \
pixel += pitch; \
} \
length = draw_end ? (y1-y2+1) : (y1-y2); \
} \
while (length--) { \
op; \
pixel += pitch; \
} \
}
/* Diagonal line */
#define DLINE(type, op, draw_end) \
{ \
int length; \
int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
type *pixel; \
if (y1 <= y2) { \
pixel = (type *)_dc_get_pixel(dst, x1, y1); \
if (x1 <= x2) { \
++pitch; \
} else { \
--pitch; \
} \
length = (y2-y1); \
} else { \
pixel = (type *)_dc_get_pixel(dst, x2, y2); \
if (x2 <= x1) { \
++pitch; \
} else { \
--pitch; \
} \
if (!draw_end) { \
pixel += pitch; \
} \
length = (y1-y2); \
} \
if (draw_end) { \
++length; \
} \
while (length--) { \
op; \
pixel += pitch; \
} \
}
/* Bresenham's line algorithm */
#define BLINE(x1, y1, x2, y2, op, draw_end) \
{ \
int i, deltax, deltay, numpixels; \
int d, dinc1, dinc2; \
int x, xinc1, xinc2; \
int y, yinc1, yinc2; \
\
deltax = ABS(x2 - x1); \
deltay = ABS(y2 - y1); \
\
if (deltax >= deltay) { \
numpixels = deltax + 1; \
d = (2 * deltay) - deltax; \
dinc1 = deltay * 2; \
dinc2 = (deltay - deltax) * 2; \
xinc1 = 1; \
xinc2 = 1; \
yinc1 = 0; \
yinc2 = 1; \
} else { \
numpixels = deltay + 1; \
d = (2 * deltax) - deltay; \
dinc1 = deltax * 2; \
dinc2 = (deltax - deltay) * 2; \
xinc1 = 0; \
xinc2 = 1; \
yinc1 = 1; \
yinc2 = 1; \
} \
\
if (x1 > x2) { \
xinc1 = -xinc1; \
xinc2 = -xinc2; \
} \
if (y1 > y2) { \
yinc1 = -yinc1; \
yinc2 = -yinc2; \
} \
\
x = x1; \
y = y1; \
\
if (!draw_end) { \
--numpixels; \
} \
for (i = 0; i < numpixels; ++i) { \
op(x, y); \
if (d < 0) { \
d += dinc1; \
x += xinc1; \
y += yinc1; \
} else { \
d += dinc2; \
x += xinc2; \
y += yinc2; \
} \
} \
}
/* Xiaolin Wu's line algorithm, based on Michael Abrash's implementation */
#define WULINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
{ \
rt_uint16_t ErrorAdj, ErrorAcc; \
rt_uint16_t ErrorAccTemp, Weighting; \
int DeltaX, DeltaY, Temp, XDir; \
unsigned r, g, b, a, inva; \
\
/* remove compiling warning */ \
r = 0; g = 0; b = 0; a = 0; \
inva = 0; inva = inva; \
/* Draw the initial pixel, which is always exactly intersected by \
the line and so needs no weighting */ \
opaque_op(x1, y1); \
\
/* Draw the final pixel, which is always exactly intersected by the line \
and so needs no weighting */ \
if (draw_end) { \
opaque_op(x2, y2); \
} \
\
/* Make sure the line runs top to bottom */ \
if (y1 > y2) { \
Temp = y1; y1 = y2; y2 = Temp; \
Temp = x1; x1 = x2; x2 = Temp; \
} \
DeltaY = y2 - y1; \
\
if ((DeltaX = x2 - x1) >= 0) { \
XDir = 1; \
} else { \
XDir = -1; \
DeltaX = -DeltaX; /* make DeltaX positive */ \
} \
\
/* line is not horizontal, diagonal, or vertical */ \
ErrorAcc = 0; /* initialize the line error accumulator to 0 */ \
\
/* Is this an X-major or Y-major line? */ \
if (DeltaY > DeltaX) { \
/* Y-major line; calculate 16-bit fixed-point fractional part of a \
pixel that X advances each time Y advances 1 pixel, truncating the \
result so that we won't overrun the endpoint along the X axis */ \
ErrorAdj = ((unsigned long) DeltaX << 16) / (unsigned long) DeltaY; \
/* Draw all pixels other than the first and last */ \
while (--DeltaY) { \
ErrorAccTemp = ErrorAcc; /* remember current accumulated error */ \
ErrorAcc += ErrorAdj; /* calculate error for next pixel */ \
if (ErrorAcc <= ErrorAccTemp) { \
/* The error accumulator turned over, so advance the X coord */ \
x1 += XDir; \
} \
y1++; /* Y-major, so always advance Y */ \
/* The IntensityBits most significant bits of ErrorAcc give us the \
intensity weighting for this pixel, and the complement of the \
weighting for the paired pixel */ \
Weighting = ErrorAcc >> 8; \
{ \
a = DRAW_MUL(_a, (Weighting ^ 255)); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1, y1); \
} \
{ \
a = DRAW_MUL(_a, Weighting); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1 + XDir, y1); \
} \
} \
} else { \
/* X-major line; calculate 16-bit fixed-point fractional part of a \
pixel that Y advances each time X advances 1 pixel, truncating the \
result to avoid overrunning the endpoint along the X axis */ \
ErrorAdj = ((unsigned long) DeltaY << 16) / (unsigned long) DeltaX; \
/* Draw all pixels other than the first and last */ \
while (--DeltaX) { \
ErrorAccTemp = ErrorAcc; /* remember currrent accumulated error */ \
ErrorAcc += ErrorAdj; /* calculate error for next pixel */ \
if (ErrorAcc <= ErrorAccTemp) { \
/* The error accumulator turned over, so advance the Y coord */ \
y1++; \
} \
x1 += XDir; /* X-major, so always advance X */ \
/* The IntensityBits most significant bits of ErrorAcc give us the \
intensity weighting for this pixel, and the complement of the \
weighting for the paired pixel */ \
Weighting = ErrorAcc >> 8; \
{ \
a = DRAW_MUL(_a, (Weighting ^ 255)); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1, y1); \
} \
{ \
a = DRAW_MUL(_a, Weighting); \
r = DRAW_MUL(_r, a); \
g = DRAW_MUL(_g, a); \
b = DRAW_MUL(_b, a); \
inva = (a ^ 0xFF); \
blend_op(x1, y1 + 1); \
} \
} \
} \
}
#define AALINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end) \
WULINE(x1, y1, x2, y2, opaque_op, blend_op, draw_end)
/*
* Define fill rect macro
*/
#define FILLRECT(type, op) \
do { \
int width = rect->x2 - rect->x1; \
int height = rect->y2 - rect->y1; \
int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
int skip = pitch - width; \
type *pixel = (type *)_dc_get_pixel(dst, rect->x1, rect->y1); \
while (height--) { \
{ int n = (width+3)/4; \
switch (width & 3) { \
case 0: do { op; pixel++; \
case 3: op; pixel++; \
case 2: op; pixel++; \
case 1: op; pixel++; \
} while ( --n > 0 ); \
} \
} \
pixel += skip; \
} \
} while (0)
#endif
/*
* File : dc_trans.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __RTGUI_DC_TRANS_H__
#define __RTGUI_DC_TRANS_H__
#include <rtgui/dc.h>
#include <rtgui/matrix.h>
struct rtgui_dc_trans;
/** Create a dc translator on the dc @owner
*
* @return RT_NULL is there is no memory.
*/
struct rtgui_dc_trans* rtgui_dc_trans_create(struct rtgui_dc *owner);
/** Rotate the dc clockwise.
*
* @param degree the degree to rotate.
*/
void rtgui_dc_trans_rotate(struct rtgui_dc_trans *dct, double degree);
void rtgui_dc_trans_set_aa(struct rtgui_dc_trans *dct, int use_aa);
void rtgui_dc_trans_scale(struct rtgui_dc_trans *dct, double sx, double sy);
/** Move the dc
*
* The unit of @dx and @dy is pixel.
*/
void rtgui_dc_trans_move(struct rtgui_dc_trans *dct, int dx, int dy);
void rtgui_dc_trans_get_new_wh(struct rtgui_dc_trans *dct, int *new_w, int *new_h);
void rtgui_dc_trans_blit(struct rtgui_dc_trans *dct,
struct rtgui_point *dc_point,
struct rtgui_dc *dest,
struct rtgui_rect *rect);
void rtgui_dc_trans_destroy(struct rtgui_dc_trans *dct);
#endif
/*
* File : driver.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* 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>
/* graphic driver operations */
struct rtgui_graphic_driver_ops
{
/* set and get pixel in (x, y) */
void (*set_pixel)(rtgui_color_t *c, int x, int y);
void (*get_pixel)(rtgui_color_t *c, int x, int y);
void (*draw_hline)(rtgui_color_t *c, int x1, int x2, int y);
void (*draw_vline)(rtgui_color_t *c, int x , int y1, int y2);
/* draw raw hline */
void (*draw_raw_hline)(rt_uint8_t *pixels, int x1, int x2, int y);
};
/* graphic extension operations */
struct rtgui_graphic_ext_ops
{
/* some 2D operations */
void (*draw_line)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
void (*draw_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
void (*fill_rect)(rtgui_color_t *c, int x1, int y1, int x2, int y2);
void (*draw_circle)(rtgui_color_t *c, int x, int y, int r);
void (*fill_circle)(rtgui_color_t *c, int x, int y, int r);
void (*draw_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
void (*fill_ellipse)(rtgui_color_t *c, int x, int y, int rx, int ry);
};
struct rtgui_graphic_driver
{
/* pixel format and byte per pixel */
rt_uint8_t pixel_format;
rt_uint8_t bits_per_pixel;
rt_uint16_t pitch;
/* screen width and height */
rt_uint16_t width;
rt_uint16_t height;
/* framebuffer address and ops */
rt_uint8_t *framebuffer;
struct rt_device* device;
const struct rtgui_graphic_driver_ops *ops;
const struct rtgui_graphic_ext_ops *ext_ops;
};
struct rtgui_graphic_driver *rtgui_graphic_driver_get_default(void);
void rtgui_graphic_driver_get_rect(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
void rtgui_graphic_driver_screen_update(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
rt_uint8_t *rtgui_graphic_driver_get_framebuffer(const struct rtgui_graphic_driver *driver);
rt_err_t rtgui_graphic_set_device(rt_device_t device);
void rtgui_graphic_driver_set_framebuffer(void *fb);
rt_inline struct rtgui_graphic_driver *rtgui_graphic_get_device()
{
return rtgui_graphic_driver_get_default();
}
#ifdef RTGUI_USING_HW_CURSOR
/*
* hardware cursor
*/
enum rtgui_cursor_type
{
RTGUI_CURSOR_ARROW,
RTGUI_CURSOR_HAND,
};
void rtgui_cursor_set_device(const char* device_name);
void rtgui_cursor_set_position(rt_uint16_t x, rt_uint16_t y);
void rtgui_cursor_set_image(enum rtgui_cursor_type type);
#endif
#ifdef RTGUI_USING_VFRAMEBUFFER
void rtgui_graphic_driver_vmode_enter(void);
void rtgui_graphic_driver_vmode_exit(void);
struct rtgui_dc* rtgui_graphic_driver_get_rect_buffer(const struct rtgui_graphic_driver *driver, struct rtgui_rect *rect);
#endif
rt_bool_t rtgui_graphic_driver_is_vmode(void);
#endif
此差异已折叠。
/*
* File : filerw.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2009-10-16 Bernard first version
*/
#ifndef __RTGUI_FILERW_H__
#define __RTGUI_FILERW_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef RTGUI_USING_DFS_FILERW
#ifdef _WIN32_NATIVE
#pragma warning(disable: 4996)
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#else
#include <dfs_posix.h>
#endif
#endif
#include <rtgui/rtgui.h>
#define RTGUI_FILE_SEEK_SET 0
#define RTGUI_FILE_SEEK_CUR 1
#define RTGUI_FILE_SEEK_END 2
struct rtgui_filerw
{
int (*seek)(struct rtgui_filerw *context, rt_off_t offset, int whence);
int (*read)(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int (*write)(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count);
int (*tell)(struct rtgui_filerw *context);
int (*eof)(struct rtgui_filerw *context);
int (*close)(struct rtgui_filerw *context);
};
typedef struct rtgui_filerw rtgui_filerw_t;
struct rtgui_filerw *rtgui_filerw_create_file(const char *filename, const char *mode);
struct rtgui_filerw *rtgui_filerw_create_mem(const rt_uint8_t *mem, rt_size_t size);
int rtgui_filerw_seek(struct rtgui_filerw *context, rt_off_t offset, int whence);
int rtgui_filerw_read(struct rtgui_filerw *context, void *buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_write(struct rtgui_filerw *context, const void *buffer, rt_size_t size, rt_size_t count);
int rtgui_filerw_tell(struct rtgui_filerw *context);
int rtgui_filerw_eof(struct rtgui_filerw *context);
int rtgui_filerw_close(struct rtgui_filerw *context);
int rtgui_filerw_unlink(const char *filename);
/* get memory data from filerw memory object */
const rt_uint8_t *rtgui_filerw_mem_getdata(struct rtgui_filerw *context);
#ifdef __cplusplus
}
#endif
#endif
此差异已折叠。
/*
* File : font_fnt.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __FONT_FNT_H__
#define __FONT_FNT_H__
#include <rtgui/font.h>
#include <rtgui/dc.h>
/* fnt font header */
struct fnt_header
{
rt_uint8_t version[4];
rt_uint16_t max_width;
rt_uint16_t height;
rt_uint16_t ascent;
rt_uint16_t depth;
rt_uint32_t first_char;
rt_uint32_t default_char;
rt_uint32_t size;
rt_uint32_t nbits;
rt_uint32_t noffset;
rt_uint32_t nwidth;
};
typedef rt_uint8_t MWIMAGEBITS;
struct fnt_font
{
struct fnt_header header;
const MWIMAGEBITS *bits; /* nbits */
const rt_uint16_t *offset; /* noffset */
const rt_uint8_t *width; /* nwidth */
};
extern const struct rtgui_font_engine fnt_font_engine;
struct rtgui_font *fnt_font_create(const char* filename);
#endif
/*
* File : font_freetype.h
* This file is part of RT-Thread GUI Engine
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2010-04-10 Bernard first version
*/
#ifndef __RTGUI_FONT_TTF_H__
#define __RTGUI_FONT_TTF_H__
#include <rtgui/dc.h>
#include <rtgui/font.h>
#include <rtgui/filerw.h>
#ifdef __cplusplus
extern "C" {
#endif
void rtgui_ttf_system_init(void);
rtgui_font_t *rtgui_freetype_font_create(const char *filename, rt_size_t size);
void rtgui_freetype_font_destroy(rtgui_font_t *font);
#ifdef __cplusplus
}
#endif
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册