code sync with GitHub

This commit is contained in:
idea4good 2018-06-11 15:02:29 +08:00
parent c2db2a78e1
commit 3987108195
4 changed files with 57 additions and 12 deletions

View File

@ -30,7 +30,7 @@
- [编译/运行在任意平台上](https://gitee.com/idea4good/GuiLiteSamples/tree/master/HostMonitor/README.md)
## 开发文档
[代码走读](doc/CodeWalkthrough-cn.md)
[代码结构及注释](doc/CodeWalkthrough-cn.md)
[如何编译?](doc/HowToBuild.md)
@ -38,10 +38,12 @@
[如何传递消息?](doc/HowMessageWork.md)
## 实例代码及运行效果:
[GuiLiteSamples 代码库](https://gitee.com/idea4good/GuiLiteSamples)
## 视频链接:
[GuiLite简介](https://v.youku.com/v_show/id_XMzA5NTMzMTYyOA)
[GuiLiteSamples 运行视频](http://v.youku.com/v_show/id_XMzA5NTMzMTYyOA)
[GuiLite办公室](https://v.youku.com/v_show/id_XMzYxNTE3MTI0MA)
## 实例代码链接
[GuiLiteSamples](https://gitee.com/idea4good/GuiLiteSamples)
## 代码镜像
## GitHub链接
[GitHub链接](https://github.com/idea4good/GuiLite)

View File

@ -15,7 +15,7 @@ void do_assert(const char* file, int line);
void log_out(const char* log);
#define GLT_RGB(r, g, b) ((r << 16) | (g << 8) | b)
#define GLT_RGB(r, g, b) ((0xFF << 24) | (r << 16) | (g << 8) | b)
#define GLT_RGB_R(rgb) ((rgb >> 16) & 0xFF)
#define GLT_RGB_G(rgb) ((rgb >> 8) & 0xFF)
#define GLT_RGB_B(rgb) (rgb & 0xFF)

View File

@ -80,10 +80,10 @@ c_surface* c_display::create_surface(void* usr, Z_ORDER_LEVEL max_zorder)
return NULL;
}
int c_display::merge_surface(c_surface* s1, c_surface* s2, int x0, int x1, int y0, int y1, int offset)
int c_display::merge_surface(c_surface* s0, c_surface* s1, int x0, int x1, int y0, int y1, int offset)
{
int surface_width = s1->get_width();
int surface_height = s1->get_height();
int surface_width = s0->get_width();
int surface_height = s0->get_height();
if (offset < 0 || offset >= surface_width || y0 < 0 || y0 >= surface_height ||
y1 < 0 || y1 >= surface_height || x0 < 0 || x0 >= surface_width || x1 < 0 || x1 >= surface_width)
@ -106,11 +106,11 @@ int c_display::merge_surface(c_surface* s1, c_surface* s2, int x0, int x1, int y
for (int y = y0; y <= y1; y++)
{
//Left surface
char* addr_s = ((char*)(s1->m_fb) + (y * (s1->get_width()) + x0 + offset) * m_color_bytes);
char* addr_s = ((char*)(s0->m_fb) + (y * (s0->get_width()) + x0 + offset) * m_color_bytes);
char* addr_d = ((char*)(m_phy_fb) + (y * m_width + x0) * m_color_bytes);
memcpy(addr_d, addr_s, (width - offset) * m_color_bytes);
//Right surface
addr_s = ((char*)(s2->m_fb) + (y * (s2->get_width()) + x0) * m_color_bytes);
addr_s = ((char*)(s1->m_fb) + (y * (s1->get_width()) + x0) * m_color_bytes);
addr_d = ((char*)(m_phy_fb) + (y * m_width + x0 + (width - offset)) * m_color_bytes);
memcpy(addr_d, addr_s, offset * m_color_bytes);
}

View File

@ -1,4 +1,4 @@
# 代码简介
# 代码结构及注释
gui: 1实现了各种常规控件例如按钮标签键盘及容器例如视窗对话框滑动页面开发者可以根据自己的需要直接在相应的代码上进行修改或重绘开发出有自己风格特色的界面2实现了用户输入例如手指按下/释放的消息传递将用户的输入信息传递到整个UI体系树中并调用相应的响应回调函数开发者可以根据自己的需要添加/修改响应回调函数。
core: 实现了各个平台例如Windows, Linux的封装这些封装包括了基本的操作系统接口底层绘制图层管理和消息传递。由于开发者面对的应用场景有所不同所需的操作系统接口也有区别core中只提供了最基础的接口形式开发者可以根据自己的需要直接在api.h/api.cpp中添加新的操作系统接口或**单片机接口**。
@ -39,3 +39,46 @@ surface层
frame层:
该层属于surface层的一个部分它现实叠加界面元素而存在。
### 文件注释
| core 文件名称 | 代码简介 |
| --- | --- |
| bitmap.cpp | 绘制位图支持16 bits和32 bits |
| cmd_target.cpp | 映射UI消息及用户自定义的消息 |
| display.cpp | 生成显示设备设定surface的数目一个surface对应一个滑动页面 |
| rect.cpp | UI元素的位置信息 |
| surface.cpp | 实现像素点的绘制并对各个图层layer进行管理 |
| wave_buffer.cpp | 波形数据的缓冲管理 |
| wave_ctrl.cpp | 实现波形控件 |
| wnd.cpp | UI元素的基本类定义所有的UI元素信息、绘制及管理办法 |
| word.cpp | 显示文字 |
| api_linux.cpp | Linux适配层 |
| api_win.cpp | Window适配层 |
| audio_linux.cpp | Linux audio适配层 |
| audio_win.cpp | Windows audio适配层 |
| msg_linux.cpp | Dispatch消息的Linux实现 |
| msg_win.cpp | Dispatch消息的Windows实现 |
| gui 文件名称 | 代码简介 |
| --- | --- |
| button.cpp | 按钮控件的绘制及用户点击响应函数 |
| dialog.cpp | 对话框的绘制及管理方法 |
| edit.cpp | Edit控件的绘制及用户点击响应函数 |
| gesture.cpp | 手势识别方法,包括:鼠标按下,弹起及滑动 |
| keyboard.cpp | 键盘控件的绘制及用户点击响应函数 |
| label.cpp | 标签控件的绘制 |
| list_box.cpp | List控件的绘制及用户点击响应函数 |
| shape_resource.cpp | 自定义的形状资源,主要用于:支持圆角控件的缩放 |
| slide_group.cpp | 滑动页面的显示及管理 |
| spinbox.cpp | Spinbox控件的绘制及用户点击响应函数 |
| table.cpp | Table控件的绘制 |
### 函数接口注释
| 函数名称 | display.cpp 函数接口注释 |
| --- | --- |
| c_display | c_display构造函数初始化显示参数。输入物理framebuffer指针物理显示器宽度物理显示器高度surface宽度surface高度颜色深度surface个数/滑动页面的个数 |
| create_surface | 创建surface/滑动页面。输入: 用户ID图层的个数|
| merge_surface | 横向组合surface多用于滑动surface。输入待组合的surface源1待组合的surface源2surface源1的起始点x坐标surface源2的起始点x坐标surface源1的起始点y坐标surface源2的起始点y坐标横向组合的偏移距离输出可能改变当前显示内容 |
| get_frame_buffer | 获取该display的物理framebuffer指针 |
| snap_shot | 生成当前显示的快照并输出到bmp文件 |