当前位置:网站首页>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比特代表颜色是:蓝、绿、红)
边栏推荐
- PHP high concurrency and large traffic solution (PHP interview theory question)
- Bugku's eyes are not real
- 市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生
- easyOCR 字符识别
- I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
- webRTC SDP mslabel lable
- Crud of MySQL
- 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
- IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
- 计算中间件 Apache Linkis参数解读
猜你喜欢
计算中间件 Apache Linkis参数解读
I spring and autumn blasting-1
Common MySQL interview questions
729. My schedule I: "simulation" & "line segment tree (dynamic open point) &" block + bit operation (bucket Division) "
1330: [example 8.3] minimum steps
Crud de MySQL
机器学习笔记 - 灰狼优化
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
Database learning - Database Security
爱可可AI前沿推介(7.5)
随机推荐
Crud de MySQL
【数组和进阶指针经典笔试题12道】这些题,满足你对数组和指针的所有幻想,come on !
华为哈勃化身硬科技IPO收割机
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
Ctfshow web entry information collection
社区团购撤城“后遗症”
【華為機試真題詳解】歡樂的周末
DVWA range clearance tutorial
ICML 2022 | explore the best architecture and training method of language model
sql server学习笔记
Reconnaissance des caractères easycr
How to paste the contents copied by the computer into mobaxterm? How to copy and paste
Detailed explanation of QT creator breakpoint debugger
Go learning ----- relevant knowledge of JWT
Mysql---- function
Ctfshow web entry explosion
easyOCR 字符識別
webRTC SDP mslabel lable
Huiyuan, 30, is going to have a new owner
Leetcode: Shortest Word Distance II