Skip to content
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

Render SVG files at output resolution #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mstoeckl
Copy link
Collaborator

@mstoeckl mstoeckl commented Oct 26, 2024

This PR would close #60 .

  • This adds an additional dependency, which recursively links a few more libraries; this increases startup time by about 10ms for me.
  • librsvg is LGPL, like libgdk-pixbuf
  • Opening the SVG file with rsvg_handle_new_from_file lets the SVG recursively load linked images (see https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/class.Handle.html#security-and-locations-of-referenced-files ; SVGs can already embed other image types via data-URI, and librsvg blocks web resources entirely.) Should this behavior be disabled?
  • This also fixed rendering of SVG files with 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.)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Render SVG files at output resolution
1 participant