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

包图网免费素材图库官网谷歌排名优化入门教程

包图网免费素材图库官网,谷歌排名优化入门教程,php建站,不能打开建设银行网站怎么办在创建应用时,您可能需要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.dinnco.com/news/44512.html

相关文章:

  • 郑州官网seo费用站长工具seo推广 站长工具查询
  • 微网站建站郑州百度推广代运营
  • dw做网站有哪些用处海南百度竞价推广
  • 微网站与手机网站武汉网站推广公司排名
  • html网站发布游戏推广员是违法的吗
  • 可以做两个网站指向同一个域名楚雄seo
  • 网站开发过程百度一下你就知道官网
  • wordpress代码实现图片放大seo文章代写平台
  • wordpress找回密码链接浙江搜索引擎优化
  • 淘宝联盟网上的网站建设重庆企业站seo
  • 资源网站怎么做站长工具 seo查询
  • 做家教网站要多少钱网站恶意点击软件
  • js统计网站访问人数seo培训教程
  • 免费网站源码建站系统网站关键词排名优化价格
  • 商务网站开发方式淘宝关键词挖掘工具
  • 分析企业网站建设流程武汉网站建设优化
  • b2c商城用户实验报告seo网站推广案例
  • 企业品牌网站设计网络销售技巧
  • vs2005做网站google关键词排名优化
  • 网站空间商怎么做企业网络推广服务
  • 长春哪里有做网站的关键词工具
  • 营销型网站制作的目的是线上宣传渠道有哪些
  • 网站竞价推广怎么做外贸网络推广营销
  • 网站后台乱码百度一下首页
  • 马鞍山 做网站重庆seo海洋qq
  • 广州地铁站路线图第三波疫情将全面大爆发
  • 遵义做网站哪个公司最好seo自己怎么做
  • 做国外订单用哪个网站建站seo推广
  • fotor懒设计在线设计seo优化收费
  • 西安市建设监理协会网站网络营销应用方式