Is it possible to scale the svg before getting its pixel buffer through librsvg? I can see API like rsvg_pixbuf_from_file_at_zoom but it is marked as deprecated.
Is there some other way to do it? I wan to avoid using cairo for this, if possible.
You do not have many choices, it's either:
- using a deprecated function like rsvg_pixbuf_from_file_at_size() (which is not that bad, it's not very likely this function will go away any time soon)
- or using the RsvgHandle object with rsvg_handle_new_from_file() and rsvg_handle_render_cairo() on a cairo surface create at the right dimension
You can limit the usage of cairo to a minimum if you want a GdkPixbuf at the end by:
- creating a RsvgHandle with rsvg_handle_new_from_file()
- creating a cairo context and setting up the transformation matrix you want
- render the svg with rsvg_handle_render_cairo()
- grab the pixbuf with rsvg_handle_get_pixbuf()