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

公众号免费模板广州网站快速优化排名

公众号免费模板,广州网站快速优化排名,wordpress滚动条插件下载,wordpress手机显示图片在创建应用时,您可能需要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.wangmingla.cn/news/68178.html

相关文章:

  • 网页设计页面图片北京关键词优化报价
  • 沈阳做网站优化的公司百度地图网页版进入
  • 装修网站建设方案书郑州厉害的seo顾问公司
  • 闵行做网站费用游戏代理平台
  • 深圳市点击未来科技网站建设站内营销推广方式
  • 国外做蛋糕的网站浙江网站建设推广
  • 免费素材网站 可商用百度 营销推广是做什么的
  • 算命网站该怎样做网络营销软件哪个好用
  • 自己做网站统计东莞seo网站优化排名
  • 武安做网站昨日凌晨北京突然宣布重大消息
  • 匿名聊天网站开发外贸接单平台哪个最好
  • 谈谈设计和建设网站体会微信小程序
  • 做商城网站简单吗海洋seo
  • 富阳网站建设网站seo哪家做的好
  • 节日的网站怎么做软文
  • 唐山网站建设方案策划浙江网站推广运营
  • 网站规划模板软文案例
  • 微信里面小程序外贸网站优化
  • app软件定制开发周口seo
  • 怎么给网站加外链快速搭建网站的工具
  • 中国网站为什么做的那么丑关键词排名查询工具有什么作用?
  • wordpress 谷歌字体重庆官网seo分析
  • 苏州网站制作价格整合营销名词解释
  • 主体备案与网站备案能打开各种网站的搜索引擎
  • 阿里云网站建设套餐搜索引擎排名google
  • 网站专做盗版小说 会犯法吗免费的自媒体一键发布平台
  • 珠海专业网站制作一个具体网站的seo优化
  • 日照做网站的公司百度指数分析
  • 新注册公司网站怎么做网站收录网
  • 用凡科做的网站打不开品牌推广策略