When exporting to XAML from Inkscape, RadialGradientBrush brushes are saved with empty GradientStopCollection
Summary:
A radialGradient
in SVG with gradient stops is saved as a RadialGradientBrush
in XAML with no gradient stops (empty <GradientStopCollection/>
)
As a result the gradient cannot be rendered in XAML rendering applications.
Steps to reproduce:
Just create a simple shape like a Rectangle in Inkscape and give it a radial gradient, 2 stops is enough. Then save both in SVG format and XAML format and compare the output in a text editor.
What happened?
In SVG the gradient is saved as a linearGradient
AND a radialGradient
with the radial having a reference (xlink:href
) to the linear.
The linear contains the stops (color and offset) while the radial contains the rest and the reference.
The linearGradient
gets translated "as is" to the XAML couterpart LinearGradientBrush
and since in XAML brush objects don't refer stops from other brushes, the radialGradient
is translated to a RadialGradientBrush
which cannot reference the linear one and whose stop collection is empty.
What should have happened?
The RadialGradientBrush
should have incorporated the gradient stops in its own GradientStopCollection
.
Sample attachments:
Attached are the .svg and .xaml versions of the same shape - a rectangle with radial gradient
Version info
Inkscape 1.2.1 (9c6d41e410, 2022-07-14)
GLib version: 2.72.2
GTK version: 3.24.34
glibmm version: 2.66.4
gtkmm version: 3.24.6
libxml2 version: 2.9.14
libxslt version: 1.1.35
Cairo version: 1.17.6
Pango version: 1.50.7
HarfBuzz version: 4.4.1
OS version: Windows 10 21H2