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

你可能感兴趣的文章
Nitrux 3.8 发布!性能全面提升,带来非凡体验
查看>>
NiuShop开源商城系统 SQL注入漏洞复现
查看>>
NI笔试——大数加法
查看>>
NLog 自定义字段 写入 oracle
查看>>
NLog类库使用探索——详解配置
查看>>
NLP 基于kashgari和BERT实现中文命名实体识别(NER)
查看>>
NLP 模型中的偏差和公平性检测
查看>>
Vue3.0 性能提升主要是通过哪几方面体现的?
查看>>
NLP 项目:维基百科文章爬虫和分类【01】 - 语料库阅读器
查看>>
NLP_什么是统计语言模型_条件概率的链式法则_n元统计语言模型_马尔科夫链_数据稀疏(出现了词库中没有的词)_统计语言模型的平滑策略---人工智能工作笔记0035
查看>>
NLP三大特征抽取器:CNN、RNN与Transformer全面解析
查看>>
NLP学习笔记:使用 Python 进行NLTK
查看>>
NLP度量指标BELU真的完美么?
查看>>
NLP的不同研究领域和最新发展的概述
查看>>
NLP的神经网络训练的新模式
查看>>
NLP采用Bert进行简单文本情感分类
查看>>
NLP问答系统:使用 Deepset SQUAD 和 SQuAD v2 度量评估
查看>>
NLP项目:维基百科文章爬虫和分类【02】 - 语料库转换管道
查看>>
NLP:从头开始的文本矢量化方法
查看>>
NLP:使用 SciKit Learn 的文本矢量化方法
查看>>