Gradients cannot be swapped with other gradients if they do not get their properties by referencing another gradient
Steps to reproduce:
- open Inkscape
- create a shape with any gradient
- create a second shape with a different gradient
- Save as
gradient-before.svg
- optimize the SVG with
scour --set-precision=8 --enable-viewboxing --enable-comment-stripping --remove-descriptive-elements --create-groups --strip-xml-space --strip-xml-prolog --nindent=4 gradient-before.svg gradient-after.svg
- open
gradient-after.svg
in Inkscape - Attempt to swap shape 1's gradient with shape 2's gradient
What happened?
The gradients cannot be swapped
What should have happened?
The gradients should be swapped
Inkscape Version and Operating System:
- Inkscape Versions: 0.92.4 (5da689c313, 2019-01-14) and 1.0beta1 (1a794d5274, 2019-11-01)
- Operating System: openSUSE Tumbleweed
- Operating System version: 20191030
Example files:
gradient-before.svg gradient-after.svg
What the title refers to
gradient-before.svg
:
<defs id="defs6">
<linearGradient id="linearGradient851" inkscape:collect="always">
<stop id="stop847" offset="0" style="stop-color:#ff0000;stop-opacity:1;" />
<stop id="stop849" offset="1" style="stop-color:#ff0000;stop-opacity:0;" />
</linearGradient>
<linearGradient id="linearGradient841" inkscape:collect="always">
<stop id="stop837" offset="0" style="stop-color:#0000ff;stop-opacity:1;" />
<stop id="stop839" offset="1" style="stop-color:#0000ff;stop-opacity:0;" />
</linearGradient>
<linearGradient gradientUnits="userSpaceOnUse" y2="64" x2="64" y1="0" x1="0" id="linearGradient843" xlink:href="#linearGradient841" inkscape:collect="always" />
<linearGradient gradientUnits="userSpaceOnUse" y2="56" x2="131.5" y1="9" x1="84.5" id="linearGradient853" xlink:href="#linearGradient851" inkscape:collect="always" />
</defs>
<rect y="0" x="0" height="64" width="64" id="rect835" style="fill:url(#linearGradient843);fill-rule:evenodd;fill-opacity:1" />
<rect y="9" x="83" height="47" width="50" id="rect845" style="fill:url(#linearGradient853);fill-rule:evenodd;fill-opacity:1" />
gradient-after.svg
:
<defs id="defs6">
<linearGradient id="linearGradient843" x2="64" y2="64" gradientUnits="userSpaceOnUse">
<stop id="stop837" stop-color="#00f" offset="0"/>
<stop id="stop839" stop-color="#00f" stop-opacity="0" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient853" x1="84.5" x2="131.5" y1="9" y2="56" gradientUnits="userSpaceOnUse">
<stop id="stop847" stop-color="#f00" offset="0"/>
<stop id="stop849" stop-color="#f00" stop-opacity="0" offset="1"/>
</linearGradient>
</defs>
<rect id="rect835" width="64" height="64" fill="url(#linearGradient843)" fill-rule="evenodd"/>
<rect id="rect845" x="83" y="9" width="50" height="47" fill="url(#linearGradient853)" fill-rule="evenodd"/>
Workarounds:
- Click the unset paint button (not the no paint button!) and then click the gradient button to get the gradient back. This allows the gradient to be swapped again.