export without style=, xlink:href on gradients

Bug #170464 reported by Darobin
2
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Wishlist
Unassigned

Bug Description

Using the style attribute to serialize SVG is a bad idea: using
attributes instead is far better. While even for Full viewers it has
the downside of being more painful to script, the biggest problem
is that it gratuitously makes the content unusable on SVG Tiny
implementations, even though the rest of the content may be
perfectly Tiny-renderable. It's a pity that one can't use Inkscape to
create mobile content simply because Inkscape picked the wrong
serialization!

There is no good reason to use the style attribute, and in fact an
upcoming Authoring Guidelines document from the SVG WG is
likely to advise strongly against its use. I wouldn't be surprised if it
were deprecated in a future version of SVG (eg 1.3).

Likewise, xlink:href on gradients has very small advantages
(though a little more than the style attribute which has none) but it
similarly makes content that could easily be valid Tiny 1.2 (or even
1.1+, the intermediate version used by some vendors) unusable on
those devices. Tiny 1.2 has most of gradients, but not xlink:href.
Similarly, the Authoring Guidelines document will likely
recommend against it (especially as it was introduced before
gradients changed to become what they are now, and was created
for a use case that is no longer relevant) and it might be
deprecated as well.

Thanks for the cool stuff!

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

I agree on style attribute, but hreffing gradients has a
very practical use in Inkscape. It is the only way to share
gradients between objects. E.g. if two objects share the
same color transition for gradient but use different vector
coordinates, you cannot have them use the same gradient.
Doing so will prevent gradient from transforming in sync
when an object is transformed. Using bbox gradient
coordinates (which seem to have been invented for keeping
gradient in sync automatically) is a stupid idea, because
bbox changes unpredictably for rotations and shears.
Therefore we always use userSpaceOnUse coordinates and apply
the same transformation matrix to both the object and its
gradient vector. And this is why we need a two-step gradient
definition: the gradient referenced by the object (called
its "private") holds only the vector coords and hrefs the
actual gradient with stops, which may be shared by any
number of objects via their privates.

Though, of course, there's no reason not to provide an
export-to-Tiny command which would flatten the gradient href
chains and move style to CSS attributes. I therefore move
this to RFEs.

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

And by the way the same approach is used for patterns, too.
A "private" patterns only keeps the patternTransform which
is kept in sync with the object, while the actual pattern is
hreffed by the private and thus can be shared among objects
without them stepping on each others' toes when transforming.

Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
jazzynico (jazzynico)
tags: added: gradient styles svg
removed: saving
Revision history for this message
jazzynico (jazzynico) wrote :

The Optimized SVG export format, added in version 0.47, has an option that allows you to convert styles into XML attributes.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.