EVE-13 Gradient Keys Progress Scrollbar

22 篇文章 0 订阅

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

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值