博客
关于我
EVE-13 Gradient Keys Progress Scrollbar
阅读量:260 次
发布时间:2019-03-01

本文共 3474 字,大约阅读时间需要 11 分钟。

1.      Gradient(渐变色)

CMD_GRADIENT – 绘制一个渐变色

#define ftCoCmdGradient(x0, y0, rgb0, x1, y1, rgb1)\

{\

      ftWrDispCmd(CMD_GRADIENT);\

      ftWrDispCmd(((uint32_t)(y0) << 16) | ((x0) & 0xffff));\

      ftWrDispCmd(rgb0);\

      ftWrDispCmd(((uint32_t)(y1) << 16) | ((x1) & 0xffff));\

      ftWrDispCmd(rgb1);\

}

参数x0, y0是起点,x1, y1是终点。rgb0是起点的颜色,rbg1是终点的颜色,均为RGB888的格式。实际应用中需要和SCISSOR功能一样使用才能更好的实现渐变色的功能。

ftWrDispCmd(SCISSOR_SIZE(PANEL_WIDTH / 2, PANEL_HEIGHT));

ftWrDispCmd(SCISSOR_XY(0, 0));

ftCoCmdGradient(0, 0, 0x0000ff, PANEL_WIDTH / 2, 0, 0xff0000);

ftWrDispCmd(SCISSOR_XY(PANE_WIDTH / 2, 0));

ftCoCmdGradient(PANEL_WIDTH / 2, 0, 0xff0000, PANEL_WIDTH - 1, 0, 0x0000ff);

ftWrDispCmd(SCISSOR_SIZE(PANEL_WIDTH, PANEL_HEIGHT));

ftWrDispCmd(SCISSOR_XY(0, 0));

FT81x和BT81x支持带Alpha的渐变色

#define ftCoCmdGradientA(x0, y0, argb0, x1, y1, argb1)\

{\
    ftWrDispCmd(CMD_GRADIENTA);\
    ftWrDispCmd(((uint32_t)(y0) << 16) | ((x0) & 0xffff));\
    ftWrDispCmd(argb0);\
    ftWrDispCmd(((uint32_t)(y1) << 16) | ((x1) & 0xffff));\
    ftWrDispCmd(argb1);\
}

2.      Keys

CMD_KEYS –绘制一行按键

#define ftCoCmdKeys(x, y, w, h, font, options, s)\

{\

   uint16_t len = strlen((char *)s) + 1; \

   ftWrDispCmd(CMD_KEYS);\

   ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

   ftWrDispCmd(((uint32_t)(h) << 16) | (w));\

   ftWrDispCmd(((uint32_t)(options) << 16) | (font));\

   ftWrDispBuf(s, len);  \

}

参数含义与button类似,最后一个参数是字符串,每个按键对应字符串中一个字符,TAG功能自动添加,读REG_TOUCH_TAG可以读到按键行为,参数options中除支持0,OPT_FLAT,OPT_CENTER(设置后按钮长宽是根据字符长宽决定)外,如果或上字符串中的字符值则表示对应的按钮显示为按住的状态。

ftCoCmdKeys((PANEL_WIDTH / 2 - 150), (PANEL_HEIGHT / 2 - 40), 140, 30, 26, 0, "12345");

ftCoCmdKeys((PANEL_WIDTH / 2 - 150), (PANEL_HEIGHT / 2 + 40), 140, 30, 26, OPT_FLAT "12345");

ftCoCmdKeys((PANEL_WIDTH / 2 + 10), (PANEL_HEIGHT / 2 - 56), 116, 28, 29, 0 | tagValue, "789");

ftCoCmdKeys((PANEL_WIDTH / 2 + 10), (PANEL_HEIGHT / 2 - 26), 116, 28, 29, 0 | tagValue, "456");

ftCoCmdKeys((PANEL_WIDTH / 2 + 10), (PANEL_HEIGHT / 2 + 3), 116, 28, 29, 0 | tagValue, "123");

ftCoCmdKeys((PANEL_WIDTH / 2 + 10), (PANEL_HEIGHT / 2 + 33), 116, 28, 29, 0 | tagValue, "0.");

tagValue的值就是从REG_TOUCH_TAG读回来的TAG值。

 

3.      Progress

CMD_PROGRESS –绘制一个进度条

#define ftCoCmdProgress(x, y, w, h, options, val, range)\

{\

      ftWrDispCmd(CMD_PROGRESS);\

      ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

      ftWrDispCmd(((uint32_t)(h) << 16) | (w));\

      ftWrDispCmd(((uint32_t)(val) << 16) | (options));\

      ftWrDispCmd(((uint32_t)range);

}

如果w大于h,进度条是横向显示,如果w小于等于h,进度条是竖向显示。options只支持0和OPT_FLAT。val是进度条当前的值,range是进度条的最大值。

ftCoCmdProgress((PANEL_WIDTH / 2 - 60), (PANEL_HEIGHT / 2 - 30), 120, 12, 0, progress, 10);

ftCoCmdProgress((PANEL_WIDTH / 2 + 120), (PANEL_HEIGHT / 2 - 60), 12, 120, OPT_FLAT, progress, 10);

 

4.      Scrollbar

CMD_SCROLLBAR – 绘制一个卷动条

#define ftCoCmdScrollBar(x, y, w, h, options, val, size, range)\

{\

      ftWrDispCmd(CMD_SCROLLBAR);\

      ftWrDispCmd(((uint32_t)(y) << 16) | ((x) & 0xffff));\

      ftWrDispCmd(((uint32_t)(h) << 16) | (w));\

      ftWrDispCmd(((uint32_t)(val) << 16) | (options));\

      ftWrDispCmd(((uint32_t)(range) << 16) | (size));\

}

size是卷动条移动部分的大小,其他参数含义与Progress相同。

if (progress < 10 - 4)

{

      ftCoCmdScrollbar((PANEL_WIDTH / 2 - 60), (PANEL_HEIGHT / 2 - 30), 120, 12, 0, progress, 4, 10);

}

else

{

      ftCoCmdScrollbar((PANEL_WIDTH / 2 - 60), (PANEL_HEIGHT / 2 - 30), 120, 12, 0, 6, 4, 10);

}

if (progress < 10 - 5)

{

      ftCoCmdScrollbar((PANEL_WIDTH / 2 + 120), (PANEL_HEIGHT / 2 - 60), 12, 120, OPT_FLAT, progress, 5, 10);

}

else

{

      ftCoCmdScrollbar((PANEL_WIDTH / 2 + 120), (PANEL_HEIGHT / 2 - 60), 12, 120, OPT_FLAT, 5, 5, 10);

}

 

转载地址:http://lqqx.baihongyu.com/

你可能感兴趣的文章
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>
MySQL8,体验不一样的安装方式!
查看>>
MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
查看>>
Mysql: 对换(替换)两条记录的同一个字段值
查看>>
mysql:Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘解决方法
查看>>
MYSQL:基础——3N范式的表结构设计
查看>>
MYSQL:基础——触发器
查看>>
Mysql:连接报错“closing inbound before receiving peer‘s close_notify”
查看>>
mysqlbinlog报错unknown variable ‘default-character-set=utf8mb4‘
查看>>
mysqldump 参数--lock-tables浅析
查看>>
mysqldump 导出中文乱码
查看>>
mysqldump 导出数据库中每张表的前n条
查看>>
mysqldump: Got error: 1044: Access denied for user ‘xx’@’xx’ to database ‘xx’ when using LOCK TABLES
查看>>
Mysqldump参数大全(参数来源于mysql5.5.19源码)
查看>>
mysqldump备份时忽略某些表
查看>>
mysqldump实现数据备份及灾难恢复
查看>>
mysqldump数据库备份无法进行操作只能查询 --single-transaction
查看>>
mysqldump的一些用法
查看>>