当前位置: 首页 > news >正文

公众号免费模板厦门seo招聘

公众号免费模板,厦门seo招聘,东莞南城网站制作,泉州网站排名优化在创建应用时,您可能需要TouchGFX中没有包含的控件。在创建应用时,您可能需要TouchGFX中没有包含的控件。但有时此法并不够用,当您需要全面控制帧缓冲时,您需要使用自定义控件法。 TouchGFX Designer目前不支持自定义控件的创建。…

在创建应用时,您可能需要TouchGFX中没有包含的控件。在创建应用时,您可能需要TouchGFX中没有包含的控件。但有时此法并不够用,当您需要全面控制帧缓冲时,您需要使用自定义控件法。

TouchGFX Designer目前不支持自定义控件的创建。 因此,您将需要手动写入自定义控件的代码,然后在视图的用户代码部分插入控件。

示例为自定义一个二维码控件

#ifndef QR_CODE_HPP
#define QR_CODE_HPP
#include <touchgfx/hal/Types.hpp>class QRCode
{
public:/* 获取该坐标值 */bool at(uint16_t x, uint16_t y) const;/* 获取宽度 */uint16_t getWidth() const;/* 获取高度 */uint16_t getHeight() const;
};#endif
#include <gui/model/QRCode.hpp>
#include <stdlib.h>bool QRCode::at(uint16_t x, uint16_t y) const
{srand(x*123456+y*getWidth()*23456789);for(int i = 0; i < 100; i++){srand(rand());}return ((rand() / (float)RAND_MAX) > 0.5f);
}uint16_t QRCode::getWidth() const
{return 16;
}uint16_t QRCode::getHeight() const
{return 16;
}
#ifndef QR_CODE_WIDGET_HPP
#define QR_CODE_WIDGET_HPP
#include <touchgfx/widgets/Widget.hpp>
#include <gui/model/QRCode.hpp>
#include <touchgfx/hal/Types.hpp>class QRCodeWidget : public touchgfx::Widget
{
public:QRCodeWidget();/* 绘制 */virtual void draw(const touchgfx::Rect& invalidatedArea) const;/* 获取实心区域 */virtual touchgfx::Rect getSolidRect() const;/* 设置二维码成员变量 */void setQRCode(QRCode *code);/* 设置缩放比例成员变量 */void setScale(uint8_t s);private:/* 更新二维码控件尺寸 */void updateSize();QRCode *code;uint8_t scale;
};#endif
#include <gui/common/QRCodeWidget.hpp>
#include <touchgfx/hal/HAL.hpp>QRCodeWidget::QRCodeWidget() : code(0),scale(1)
{
}void QRCodeWidget::setQRCode(QRCode *qrCode)
{code = qrCode;updateSize();
}void QRCodeWidget::draw(const touchgfx::Rect& invalidatedArea) const
{if(!code){return;}touchgfx::Rect absolute = getAbsoluteRect();uint16_t *framebuffer = touchgfx::HAL::getInstance()->lockFrameBuffer();for(int y = invalidatedArea.y; y < invalidatedArea.bottom(); y++){for(int x = invalidatedArea.x; x < invalidatedArea.right(); x++){framebuffer[absolute.x + x + (absolute.y + y) * touchgfx::HAL::DISPLAY_WIDTH] = code->at(x / scale, y / scale) ? 0x0000 : 0xffff;}}touchgfx::HAL::getInstance()->unlockFrameBuffer();
}touchgfx::Rect QRCodeWidget::getSolidRect() const
{return touchgfx::Rect(0,0,getWidth(), getHeight());
}void QRCodeWidget::setScale(uint8_t s)
{scale = s;updateSize();
}void QRCodeWidget::updateSize()
{if(code){setWidth(code->getWidth() * scale);setHeight(code->getHeight() * scale);}    
}
#include <gui/screen_screen/screenView.hpp>screenView::screenView()
{}void screenView::setupScreen()
{screenViewBase::setupScreen();myQRCodeWidget.setScale(10);myQRCodeWidget.setQRCode(&myQRCode);add(myQRCodeWidget);
}void screenView::tearDownScreen()
{screenViewBase::tearDownScreen();
}

运行模拟器:显示效果如下

http://www.mmbaike.com/news/57106.html

相关文章:

  • 网站备案应该怎么做网站的建设流程
  • 电脑做网站电脑编程百度网站检测
  • 网站建设vr站长工具seo综合查询烟雨楼
  • pinterest官网入口汕头网站优化
  • 四川省人民政府教育督导委员会东莞seo排名优化
  • 建设一个交易网站要用多少钱如何开网站呢
  • 优异网站北京网站优化步骤
  • 做网站有的浏览器软文推广代理
  • 企业网站html模板朝阳seo建站
  • qq网站访客获取系统微信怎么推广引流客户
  • 做网站宣传费用记什么科目广告门
  • 香港特别行政区政府网站优化设计六年级上册数学答案
  • 中建西部建设广通讯网站推广网站的文案
  • 东软网站建设seo矩阵培训
  • 网站建设优化服务效果企业做个网站多少钱
  • 做网站协议书seo优化啥意思
  • 外汇网站源码 asp中国品牌策划公司排名
  • 徐州最新消息今天seo职业规划
  • 怎样做网站首页网站建设高端公司
  • 广告创意设计案例宁波受欢迎全网seo优化
  • 中国做外贸最好的网站有哪些知道百度
  • asp图片源码网站哪里有免费的网站推广软件
  • 盐城做百度网站windows优化大师电脑版
  • php 购物网站开发网络营销比较成功的企业
  • 门户网站改版短视频培训机构排名
  • 路桥做网站网站域名ip查询
  • 专业制作网站 上海seo每日
  • 中山网站建设是什么seo优化方法有哪些
  • 哪个网站设计好网络营销专业就业方向
  • 做网站安卓客户端大作设计网站