Conversation
376f89d to
e885035
Compare
This adds an optional dependency on librsvg to directly render the SVG images, instead of using gdk-pixbuf to draw them to an intermediate image.
|
Glycin supports SVG, do you know if it would be possible/reasonable to rely on glycin to render SVG images instead of having a separate codepath? |
This can be done, since Glycin can perform SVG image scaling similarly to gdk-pixbuf. (Using I've implemented a test branch doing this at https://github.com/mstoeckl/swaybg/commits/glycin-svg/ . The main limitations are:
In practice, for wallpaper style images, I expect neither of these to be a significant issue. |
This PR would close #60 .
rsvg_handle_new_from_stream_syncinstead ofrsvg_handle_new_from_file, to match the current and historical behavior of gdk-pixbuf in which linked images are not recursively loaded (see https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/class.Handle.html#security-and-locations-of-referenced-files ; SVGs can continue to embed other image types via data-URI, and librsvg blocks web resources entirely.)width="100%" height="100%"viewport -- gdk-pixbuf loaded them at 1x1 size.It is possible to render SVG files at higher resolution using just GdkPixbuf, but doing so is somewhat complicated, and appears to always preserve aspect ratio so that scaling/cropping afterwards is still necessary. See branch https://github.com/mstoeckl/swaybg/tree/pixbuf-scale for an example.
Edit: it looks like librsvg's headers produce a compilation error; this is probably something they should fix and that this should be considered blocked on? (filed as https://gitlab.gnome.org/GNOME/librsvg/-/issues/1136; edit: resolved, should appear in next release;edit2: 2.60 has been released with the fix.)