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

边栏推荐
- Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
- I spring and autumn blasting-1
- 1330: [example 8.3] minimum steps
- Talking about how dataset and dataloader call when loading data__ getitem__ () function
- Ten billion massage machine blue ocean, difficult to be a giant
- sql server学习笔记
- Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
- Reasons and solutions for redis cache penetration and cache avalanche
- Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
- ICML 2022 | explore the best architecture and training method of language model
猜你喜欢

729. My schedule I: "simulation" & "line segment tree (dynamic open point) &" block + bit operation (bucket Division) "

Interpretation of Apache linkage parameters in computing middleware
![P1451 calculate the number of cells / 1329: [example 8.2] cells](/img/c4/c62f3464608dbd6cf776c2cd7f07f3.png)
P1451 calculate the number of cells / 1329: [example 8.2] cells

Bugku cyberpunk

Garbage collection mechanism of PHP (theoretical questions of PHP interview)

计算中间件 Apache Linkis参数解读

Select sort and bubble sort

No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle

两个BI开发,3000多张报表?如何做的到?

How to paste the contents copied by the computer into mobaxterm? How to copy and paste
随机推荐
Brief introduction of machine learning framework
机器学习笔记 - 灰狼优化
Super wow fast row, you are worth learning!
Bugku's Ping
CODING DevSecOps 助力金融企业跑出数字加速度
Misc Basic test method and knowledge points of CTF
JMeter performance test: serveragent resource monitoring
CODING DevSecOps 助力金融企业跑出数字加速度
百亿按摩仪蓝海,难出巨头
我想咨询一下,mysql一个事务对于多张表的更新,怎么保证数据一致性的?
I spring and autumn blasting-2
Can I pass the PMP Exam in 20 days?
Selection and use of bceloss, crossentropyloss, sigmoid, etc. in pytorch classification
Install and configure Jenkins
Common MySQL interview questions (1) (written MySQL interview questions)
漫画:程序员不是修电脑的!
Bugku alert
[JVM] operation instruction
Bugku telnet
Install PHP extension spoole