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

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

FT81x和BT81x系列显示器命令参考手册

1. 渐变色绘制命令

CMD_GRADIENT用于绘制渐变色,需要结合SCISSOR功能使用。以下是命令定义及示例代码:

#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:起点颜色(RGB888格式)
  • rgb1:终点颜色(RGB888格式)

示例代码:

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(PANEL_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));

2. 按键绘制命令

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);}

命令参数说明:

  • x, y:按键的位置坐标
  • w, h:按键的宽度和高度
  • font:字体大小和类型
  • options:按键样式控制(如OPT_FLATOPT_CENTER等)
  • s:按键对应的显示字符串

示例代码:

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.");

3. 进度条绘制命令

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(range);}

命令参数说明:

  • x, y:进度条的位置坐标
  • w, h:进度条的宽度和高度
  • options:样式控制(如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. 卷动条绘制命令

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);}

命令参数说明:

  • x, y:卷动条的位置坐标
  • w, h:卷动条的宽度和高度
  • options:样式控制(如OPT_FLAT
  • val:当前滚动值
  • size:卷动条移动部分的大小
  • range:滚动的最大范围

示例代码:

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/

你可能感兴趣的文章
NLP:使用 SciKit Learn 的文本矢量化方法
查看>>
Nmap扫描教程之Nmap基础知识
查看>>
Nmap端口扫描工具Windows安装和命令大全(非常详细)零基础入门到精通,收藏这篇就够了
查看>>
NMAP网络扫描工具的安装与使用
查看>>
NMF(非负矩阵分解)
查看>>
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
查看>>
No new migrations found. Your system is up-to-date.
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>