当前位置:网站首页>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比特代表颜色是:蓝、绿、红)
边栏推荐
- Bugku's steganography
- 百亿按摩仪蓝海,难出巨头
- Super wow fast row, you are worth learning!
- 当代人的水焦虑:好水究竟在哪里?
- Stop B makes short videos, learns Tiktok to die, learns YouTube to live?
- 1330: [example 8.3] minimum steps
- Interview shock 62: what are the precautions for group by?
- "Sequelae" of the withdrawal of community group purchase from the city
- R 熵权法计算权重及综合得分
- Calculate weight and comprehensive score by R entropy weight method
猜你喜欢
数据库学习——数据库安全性
Machine learning notes - gray wolf optimization
No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle
30岁汇源,要换新主人了
Reasons and solutions for redis cache penetration and cache avalanche
Bugku's steganography
危机重重下的企业发展,数字化转型到底是不是企业未来救星
Huiyuan, 30, is going to have a new owner
Aike AI frontier promotion (7.5)
Creation and use of thymeleaf template
随机推荐
GPS原始坐标转百度地图坐标(纯C代码)
Machine learning notes - gray wolf optimization
I spring and autumn blasting-1
做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
The difference between abstract classes and interfaces in PHP (PHP interview theory question)
Database learning - Database Security
qt creater断点调试程序详解
[C question set] of Ⅷ
How to solve the problem of garbled code when installing dependency through NPM or yarn
Super wow fast row, you are worth learning!
How can I quickly check whether there is an error after FreeSurfer runs Recon all—— Core command tail redirection
1330: [example 8.3] minimum steps
华为哈勃化身硬科技IPO收割机
CODING DevSecOps 助力金融企业跑出数字加速度
Install and configure Jenkins
DVWA range clearance tutorial
MySQL----函数
Leetcode: Shortest Word Distance II
Want to ask the big guy, is there any synchronization from Tencent cloud Mysql to other places? Binlog saved by Tencent cloud MySQL on cos
漫画:程序员不是修电脑的!