Open Caellian opened 7 months ago
A good option in Rust would be image-rs/image and it supports a lot of formats. But it comes without C bindings, so we'd need to write those... and add Rust to build requirements.
The up sides are:
We can use cbindgen by mozilla (if that means "stable") to generate bindings, but we'd still need to write C API wrapper.
Another option is SDL2_image maybe?
Another option is SDL2_image maybe?
SDL2 is a huge dependency (4.4MB; entire Conky is ~11MB) which is why I didn't mention it. It would be nice to use it, but sadly SDL2_image returns loaded images in SDL_Surface
struct which is part of the parent library.
Imlib2 doesn't work for Wayland because it requires X11. As we provide bindings to Imlib2 for Lua, we need to find an alternative that's similar in functionality for Wayland.
Imlib2 supports following features:
Not sure if such a thing exists even. So this is an open ended question - let me know if you know of any.
Direct Wayland support isn't really a hard requirement though. It seems these days libraries tend to be much smaller in scope (which is a good thing ig), so we might end up having to combine multiple different libraries:
I can't find which formats Imlib2 supports, but Imlib supports PPM, PGM, TIFF, PNG, XPM, JPEG and EIM, so I guess maybe a few more. Most images these days come in PNG, JPEG, BMP and WebP, so I guess those are a good starting place. Loader for BMP format can probably be copied from SO bc it's simple.
Important detail to keep in mind is that image loading and manipulation are very susceptible to arbitrary (malicious) code execution, so any work on this has to be triple-checked.