博客
关于我
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/

你可能感兴趣的文章
localhost:5000在MacOS V12(蒙特利)中不可用
查看>>
logstash mysql 准实时同步到 elasticsearch
查看>>
Luogu2973:[USACO10HOL]赶小猪
查看>>
mabatis 中出现&lt; 以及&gt; 代表什么意思?
查看>>
Mac book pro打开docker出现The data couldn’t be read because it is missing
查看>>
MAC M1大数据0-1成神篇-25 hadoop高可用搭建
查看>>
mac mysql 进程_Mac平台下启动MySQL到完全终止MySQL----终端八步走
查看>>
Mac OS 12.0.1 如何安装柯美287打印机驱动,刷卡打印
查看>>
MangoDB4.0版本的安装与配置
查看>>
Manjaro 24.1 “Xahea” 发布!具有 KDE Plasma 6.1.5、GNOME 46 和最新的内核增强功能
查看>>
mapping文件目录生成修改
查看>>
MapReduce程序依赖的jar包
查看>>
mariadb multi-source replication(mariadb多主复制)
查看>>
MariaDB的简单使用
查看>>
MaterialForm对tab页进行隐藏
查看>>
Member var and Static var.
查看>>
memcached高速缓存学习笔记001---memcached介绍和安装以及基本使用
查看>>
memcached高速缓存学习笔记003---利用JAVA程序操作memcached crud操作
查看>>
Memcached:Node.js 高性能缓存解决方案
查看>>
memcache、redis原理对比
查看>>