您尚未登录。

楼主 #1 2018-12-06 15:26:23

k455619
会员
注册时间: 2018-07-29
已发帖子: 151
积分: 80

关于little_vgl demo_image中的问题

当使用外部资源作为图像源的时候, pcfs_drv.letter = 'P';为什么这个要为字符P呢。
在源码里面看见如下:
lv_img_src_get_type()中有:
/*The first byte shows the type of the image source*/
    if(u8_p[0] >= 0x20 && u8_p[0] <= 0x7F) {
        img_src_type = LV_IMG_SRC_FILE;     /*If it's an ASCII character then it's file name*/
    } else if(u8_p[0] >= 0x80) {
        img_src_type = LV_IMG_SRC_SYMBOL;   /*Symbols begins after 0x7F*/
    } else {
        img_src_type = LV_IMG_SRC_VARIABLE; /*`lv_img_dsc_t` is design to the first byte < 0x20*/
    }
那么 pcfs_drv.letter = 'P';这个字符P是不是可以为0x20到0x7E的任意ASCILL码呢?



pcfs_drv.file_size = sizeof(pc_file_t);       /*Set up fields...*/
    pcfs_drv.letter = 'P';
    pcfs_drv.open = pcfs_open;
    pcfs_drv.close = pcfs_close;
    pcfs_drv.read = pcfs_read;
    pcfs_drv.seek = pcfs_seek;
    pcfs_drv.tell = pcfs_tell;
    lv_fs_add_drv(&pcfs_drv);


    lv_obj_t * img_bin = lv_img_create(lv_scr_act(), NULL); /*Create an image object*/
    /* Set the image's file according to the current color depth
     * a blue flower picture*/
#if LV_COLOR_DEPTH == 32
    lv_img_set_src(img_bin, "P:/lv_examples/lv_tutorial/6_images/blue_flower_32.bin");

离线

楼主 #2 2018-12-06 17:47:11

k455619
会员
注册时间: 2018-07-29
已发帖子: 151
积分: 80

Re: 关于little_vgl demo_image中的问题

解决了,应该是一个类似设备描述符的

离线

#3 2018-12-06 18:28:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 关于little_vgl demo_image中的问题

感谢分享!





离线

#4 2020-07-07 16:18:09

lastliudexi
会员
注册时间: 2020-07-07
已发帖子: 1
积分: 1

Re: 关于little_vgl demo_image中的问题

请问下楼主,我现在用外部SD卡显示image图片lv_img_set_src(image1,"P:abc.bin");是用的官网的在线工具转换的,可以显示图片就一个白板提示 No data,请问你遇到过吗,怎么解决的

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn