当前位置:网站首页>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比特代表颜色是:蓝、绿、红)

边栏推荐
- 我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
- 计算中间件 Apache Linkis参数解读
- 两个BI开发,3000多张报表?如何做的到?
- Cartoon: programmers don't repair computers!
- Aike AI frontier promotion (7.5)
- GPS原始坐标转百度地图坐标(纯C代码)
- STM32+BH1750光敏传感器获取光照强度
- Common redis data types and application scenarios
- sql server char nchar varchar和nvarchar的区别
- Easyocr character recognition
猜你喜欢

Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification

Fr exercise topic --- comprehensive question

基于TI DRV10970驱动直流无刷电机

Mongdb learning notes

Change multiple file names with one click

Ctfshow web entry command execution

超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜

1330:【例8.3】最少步数

Creation and optimization of MySQL index

Two Bi development, more than 3000 reports? How to do it?
随机推荐
MySQL之CRUD
超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
Bugku's Ping
Your childhood happiness was contracted by it
30岁汇源,要换新主人了
Detailed explanation of QT creator breakpoint debugger
Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de
Change multiple file names with one click
mapper.xml文件中的注释
CPU design related notes
qt creater断点调试程序详解
Bugku's steganography
Mongdb learning notes
Long list optimized virtual scrolling
Bugku telnet
Easyocr character recognition
Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
Au - delà du PARM! La maîtrise de l'Université de Pékin propose diverse pour actualiser complètement le classement du raisonnement du NLP
Creation and use of thymeleaf template
sql server char nchar varchar和nvarchar的区别