After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764610 - API: librsvg should provide a way to list sub element IDs
API: librsvg should provide a way to list sub element IDs
Status: RESOLVED OBSOLETE
Product: librsvg
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: librsvg maintainers
librsvg maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-04 18:55 UTC by Tim Janik
Modified: 2017-12-13 18:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add rsvg_handle_list() to gather sub element IDs (2.39 KB, patch)
2016-04-04 18:55 UTC, Tim Janik
none Details | Review

Description Tim Janik 2016-04-04 18:55:07 UTC
Created attachment 325377 [details] [review]
Add rsvg_handle_list() to gather sub element IDs

The Rapicorn project has been shipping a modified version of librsvg for a long time. One of the reasons is the lack of an ability to list the sub element IDs of an SVG file to use exiting APIs correctly, like:
rsvg_handle_render_cairo_sub()
rsvg_handle_get_pixbuf_sub()
rsvg_handle_get_dimensions_sub()
rsvg_handle_get_position_sub()

I'd suggest adding an API like
  GSList* rsvg_handle_list (RsvgHandle *handle);
to fix this situation. An example patch is attached.
Comment 1 Federico Mena Quintero 2017-08-29 23:06:52 UTC
How would you use this API?  The named elements are not necessarily renderable ones.  For example, when filter primitives are referenced, or clip paths, etc.
Comment 2 Tim Janik 2017-08-30 00:39:46 UTC
(In reply to Federico Mena Quintero from comment #1)
> How would you use this API? 

Individual elements in svg files can be referenced with '#element' syntax, e.g. in CSS or in a rendering context: foo.svg#element

Here's the code Rapicorn uses:
  https://github.com/tim-janik/rapicorn/blob/a8a06328b19bec7ce6268e46ebb47acb3b30beee/rcore/svg.cc#L331

It allows rendering requests for "foo.svg#element" and will automatically pick variants thereof if those a are present. Examples for variants could be "foo.svg#element+insensitive" or #element.{small|medium|large}, etc.

The way Rapicorn currently copes with the lack of this API is, it scans the SVG for all sorts of potential XML ids and brute force tests their presence with rsvg_handle_has_sub():
  https://github.com/tim-janik/rapicorn/blob/a8a06328b19bec7ce6268e46ebb47acb3b30beee/rcore/svg.cc#L295

> The named elements are not necessarily
> renderable ones.  For example, when filter primitives are referenced, or
> clip paths, etc.

What elements exactly are referenced is up to the user. Conceivable examples also include path alterations before an SVG is rendered, and for any such actions the elements to be used or altered need to be referenced and depending on the reference scheme used enumeration may be needed.
Comment 3 GNOME Infrastructure Team 2017-12-13 18:17:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/139.