当前位置:网站首页>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比特代表颜色是:蓝、绿、红)
边栏推荐
- 爱可可AI前沿推介(7.5)
- Install PHP extension spoole
- Common MySQL interview questions
- qt creater断点调试程序详解
- MySQL之CRUD
- SQL Server learning notes
- Can gbase 8A view the location of SQL statement history?
- Garbage collection mechanism of PHP (theoretical questions of PHP interview)
- Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
- Ctfshow web entry information collection
猜你喜欢
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
Common MySQL interview questions
市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生
Coding devsecops helps financial enterprises run out of digital acceleration
超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
Huiyuan, 30, is going to have a new owner
美团优选管理层变动:老将刘薇调岗,前阿里高管加盟
MySQL之CRUD
Aike AI frontier promotion (7.5)
1330: [example 8.3] minimum steps
随机推荐
[recruitment position] infrastructure software developer
SQL Server learning notes
你童年的快乐,都是被它承包了
What are CSRF, XSS, SQL injection, DDoS attack and timing attack respectively and how to prevent them (PHP interview theory question)
Bugku's Ah Da
[recruitment position] Software Engineer (full stack) - public safety direction
P1451 calculate the number of cells / 1329: [example 8.2] cells
JS bright blind your eyes date selector
maxcompute有没有能查询 表当前存储容量的大小(kb) 的sql?
MySQL之CRUD
【華為機試真題詳解】歡樂的周末
华为哈勃化身硬科技IPO收割机
Photoshop插件-动作相关概念-非加载执行动作文件中动作-PS插件开发
Super wow fast row, you are worth learning!
Detailed explanation of QT creator breakpoint debugger
社区团购撤城“后遗症”
GPS original coordinates to Baidu map coordinates (pure C code)
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
1330: [example 8.3] minimum steps
Ten billion massage machine blue ocean, difficult to be a giant