当前位置:网站首页>lvgl 显示图片示例
lvgl 显示图片示例
2022-07-05 14:57:00 【Neo Wordsworth】
通过 在线图像转换工具 获得一个图片文件,这里提取出数据便于了解图片的显示(这个数据可以通过网络或蓝牙传输过来)
uint8_t myimg_map[] = {
0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00,
0xfe, 0x7f,
0xfd, 0xbf,
0xc0, 0x03,
0xd7, 0xdb,
0xcf, 0xeb,
0xdf, 0xf3,
0x9e, 0x79,
0x5d, 0xba,
0x5d, 0xba,
0x9e, 0x79,
0xdf, 0xfb,
0xcf, 0xe3,
0xd7, 0xdb,
0xc0, 0x03,
0xfd, 0xbf,
0xfe, 0x7f,
};
void test1(){
static lv_img_dsc_t myimg;
myimg.header.cf = LV_IMG_CF_INDEXED_1BIT;
myimg.header.always_zero = 0;
myimg.header.reserved = 0;
myimg.header.w = 16;
myimg.header.h = 16;
myimg.data_size = 40;
myimg.data = myimg_map;
lv_obj_t * icon = lv_img_create(lv_scr_act());
lv_obj_center(icon);
lv_img_set_src(icon, &myimg);
//#define LV_MY_RECOLOR 1 //注释这里则显示原来的红色
#if LV_MY_RECOLOR
static lv_style_t img_style;
lv_style_init(&img_style);
lv_style_set_img_recolor(&img_style,lv_color_hex(0x0000ff));
lv_style_set_img_recolor_opa(&img_style,255);
lv_obj_add_style(icon, &img_style, 0);
#endif
}运行后显示这样一张小图

如果使能定义LV_MY_RECOLOR
可以重新着色,原本的红色,重新着色为蓝色
(LV_IMG_CF_INDEXED_1BIT数据前3比特代表颜色是:蓝、绿、红)

边栏推荐
- Ctfshow web entry explosion
- 1330:【例8.3】最少步数
- [JVM] operation instruction
- mapper.xml文件中的注释
- Super wow fast row, you are worth learning!
- NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
- Coding devsecops helps financial enterprises run out of digital acceleration
- How can I quickly check whether there is an error after FreeSurfer runs Recon all—— Core command tail redirection
- Coding devsecops helps financial enterprises run out of digital acceleration
- CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
猜你喜欢

Bugku cyberpunk

Creation and use of thymeleaf template

Run faster with go: use golang to serve machine learning

Common MySQL interview questions

做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
![P6183 [USACO10MAR] The Rock Game S](/img/f4/d8c8763c27385d759d117b515fbf0f.png)
P6183 [USACO10MAR] The Rock Game S

Ecotone technology has passed ISO27001 and iso21434 safety management system certification

Common redis data types and application scenarios

Drive brushless DC motor based on Ti drv10970

华为哈勃化身硬科技IPO收割机
随机推荐
[JVM] operation instruction
Using tensorboard to visualize the training process in pytoch
Machine learning notes - gray wolf optimization
华为哈勃化身硬科技IPO收割机
R 熵权法计算权重及综合得分
Huiyuan, 30, is going to have a new owner
Run faster with go: use golang to serve machine learning
ICML 2022 | explore the best architecture and training method of language model
STM32+BH1750光敏传感器获取光照强度
MySQL----函数
Interpretation of Apache linkage parameters in computing middleware
机器学习笔记 - 灰狼优化
CPU design related notes
Creation and use of thymeleaf template
[detailed explanation of Huawei machine test] character statistics and rearrangement
超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
可转债打新在哪里操作开户是更安全可靠的呢
The elimination strategy of redis
基于TI DRV10970驱动直流无刷电机
Where is the operation of convertible bond renewal? Is it safer and more reliable to open an account