Kalle Vahlman schrieb: > 2009/4/17 Stefan Kost <[email protected]>: > >> hi, >> >> I am using librsvg to get pixbufs for my app. I could not find a dedicated >> list, >> for it, hope this one is okay. >> >> First I am using deprecated api: >> rsvg_pixbuf_from_file_at_size >> as when using >> rsvg_handle_get_pixbuf >> I can specify the size it should be rendered (tried rsvg_handle_set_dpi and >> rsvg_handle_set_dpi_x_y). Any idea here? >> >> I would like to use not deprecated rsvg_handle_ API, as I need to resize the >> images and I'd like to keep the svg loaded. Just set new size and rerender. >> > > To do that, you'll need to render to a cairo surface with approperiate > scaling and convert that to pixbuf. You can get the "natural" pixel > size of the SVG with rsvg_handle_get_dimensions() to calculate the > scaling factor. > I was wondering if there is a direct way, as with the deprecated api there was. But thanks for your suggestions.
Stefan > The conversion can be done by either rendering to a GdkDrawable (ie. > pixmap) and then using gdk_pixbuf_get_from_drawable() or using an > image surface and then converting the image data to the format used by > GdkPixbuf. GOffice has an example implementation of that conversion: > > http://git.gnome.org/cgit/goffice/tree/goffice/utils/go-cairo.c#n305 > > Personally I'd prefer the latter in the current X.Org driver > landscape; drawing a complex SVG (specially with gradients) can > seriously suck if the server needs to do lots of fallbacks to software > rendering... > > >> Besides some more dom exposure would be sweet. >> > > Indeed! > > >> Not sure if anyone is actually even working on the lib still (which would be >> sad). >> > > It seriously lacks some loving, that's for sure. > > _______________________________________________ desktop-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/desktop-devel-list
