-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use MEMFS correctly in lv_web_emscripten? #23
Comments
To display a PNG image you don't need MEMFS as a PNG image can be directly loaded from an array too. See here. However, something is not clear to me either. @XuNeo, can we use LVGLImage.py to create a raw image (e.g. PNG data as it is) as a C array with |
@kisvegabor Thank you for your reply, but my requirement is to be able to load font bin files from memfs or other file systems without the need for precompilation. Displaying png images is an example |
As you have opened the issue in the Emsripten repo, I assume you are using Emspripten. If so, from JS you can't open arbitrary files from your file system. (Else any website could read any files on your computer) So first, you need to push the files to JS's local file system storage. Does it already work on your end? If not, I suggest taking a look at this part of Emsripten's docs. Sorry for I cannot be more specific but it's an unknown territory for me too. |
Thank you. The reason why I raised this question is because I saw File Explorer in the latest LVgl document, and its web example seems to be loaded through the memfs file system. I want to learn, but I haven't found the source code for this part, so I am asking here I saw something like this in the HTML source code of the example https://docs.lvgl.io/master/others/file_explorer.html
|
Really there are some files and folder in the JS filesystem that you can see in the file explorer example. However these not added by us, but they are there by default. So custom images and fonts needs to added explicitly as described here. |
Thank you, I will try. I just want to inquire about how to initialize memfs in lvgl here |
Once lv_fs_path_ex_t mempath;
lv_fs_make_path_from_buffer(&mempath, LV_FS_MEMFS_LETTER, buffer, size);
lv_fs_file_t file;
lv_fs_res_t fs_res = lv_fs_open(&file, (const char *)&mempath, LV_FS_MODE_RD); cc @zjanosy I think it's really not documented. |
#define LV_USE_FS_MEMFS 1
I have seen the relevant macro definitions, but there are no relevant examples. I would like to inquire about how to use the mem file system, such as having the img control display a png image?
The text was updated successfully, but these errors were encountered: