M5ez icon indicating copy to clipboard operation
M5ez copied to clipboard

Add support for background images

Open EternityForest opened this issue 6 years ago • 3 comments

This might be somewhat of a controversial way to do this, because of the complexity and RAM, but I think caching is useful, because embedded devices should be able to run for decades without issues, and it's only 5kb for a full screen jpg. I don't know what the read disturb effect is like on the M5Stack.

It might be worth getting rid of caching, but that wouldn't be too hard.

Editable textboxes need the background color highlight behind the words, so it looks a little odd, but should still work. No noticeable performance hit despite re-rendering the jpg all the time.

The theme option is background_img, and SD cards and SPIFFS filenames are both supported(Selected by filename, either starting with /spiffs/ or /sd/). I've also got fallback code to use the solid color background if the file is missing.

In the process, I've also abstracted out the "drawBackground" function, which draws a patch of whatever the current background is.

EternityForest avatar Jan 06 '19 06:01 EternityForest

I like the first looks of it. I can't really play with this for the coming week or two. It would be easier for me and others to understand if the pull request also had the README changes needed to document the feature though.

ropg avatar Jan 06 '19 08:01 ropg

Yeah, a README change is probably in order, but I wasn't sure if theming documentation goes there or if that should be in a separate file.

Maybe a quick sentence mentioning that you can add a background image via the theme object is the way to go?

On Sun, Jan 6, 2019, 12:54 AM Rop Gonggrijp <[email protected] wrote:

I like the first looks of it. I can't really play with this for the coming week or two. It would be easier for me and others to understand if the pull request also had the README changes needed to document the feature though.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ropg/M5ez/pull/23#issuecomment-451725851, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuRH3cWOzRX1gXz0dyTypGtBtfFZMhDks5vAbnjgaJpZM4ZySLt .

EternityForest avatar Jan 06 '19 09:01 EternityForest

Looking at this again, sorry to have been away. How are you sure we need caching, it seems to add quite a bit of complexity? Reading from internal flash SPIFFS should be fast and reliable, no?

ropg avatar Jun 10 '19 12:06 ropg