gradientUnits userSpaceOnUse using wrong viewport

Bug #1153706 reported by Patrick Storz on 2013-03-11
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Undecided
Unassigned

Bug Description

When a gradient uses gradientUnits="userSpaceOnUse" the values of the gradient vector (x1,y1,x2,y1) are rendered using the wrong viewport. It seems the same viewport is used as if gradientUnits="objectBoundingBox" was set.

Therefore when specifying the gradient vector using percentages of the viewport, the SVG is rendered wrongly.

See the testcases for details.
- testcase1 specifies a linear gradient with <linearGradient gradientUnits="userSpaceOnUse" x2="1">.
- testcase2 specifies a linear gradient with <linearGradient gradientUnits="userSpaceOnUse" x2="100%">. x2 could be left out here however since 100% is the default.

As long as the viewport doesn't extend from (0,0) to (1,1) - the testcase should have a viewport from (0,0) to (256,256) - those gradients should render differently. In Inkscape 0.48.4 they render exactly the same however. When setting x2 from the XML editor Inkscape even automatically changes every percentage value automatically assuming the viewport would extend to (1,1), e.g. e.g. 70% to 0.7.

su_v (suv-lp) on 2013-03-11
tags: added: gradient svg
su_v (suv-lp) on 2013-03-11
summary: - gradienUnits userSpaceOnUse using wrong viewport
+ gradientUnits userSpaceOnUse using wrong viewport
Patrick Storz (ede123) wrote :

Just stumbled across this behavior again when investigating [1].
Could somebody firm with the SVG spec confirm whether this is an actually bug or if I'm misinterpreting what should be the correct rendering in this case?

[1] https://github.com/scour-project/scour/issues/66

Simon May (socob) wrote :

Ran into this issue when saving an image from Inkscape as “optimized SVG”. One gradient had gradientUnits="userSpaceOnUse" set, so the resulting SVG was not displaying as intended outside of Inkscape.

For what it’s worth, all of the following programs disagree with Inkscape (i.e. do not render the same image for test cases 1 and 2):
– Firefox
– Chromium
– GIMP
– Eye of GNOME
– GPicView
(ImageMagick, on the other hand, seems to follow Inkscape’s behavior…)

So at least from an “implementations defining standards” point of view, it seems pretty clear that Inkscape’s behavior is wrong.

jazzynico (jazzynico) on 2017-02-05
Changed in inkscape:
status: New → Confirmed
Tavmjong Bah (tavmjong-free) wrote :

Yes, Inkscape is rendering the gradients using 'userSpaceOnUse' wrong.

Note: ImageMagick (and thus Emacs) may be using Inkscape as a backend to render SVG.

Attached is a more complete test case.

Simon May (socob) wrote :

Thanks for that test case – much nicer to have it all in one file. I assume that the gradients are all supposed to look the same? (A bit hard to interpret a test case if you don’t know what the expected result is.)

Jonathan Hofinger (jhofinger) wrote :

Hi, the file now renders correctly when loaded, however, there are still errors during editing. They are tracked in https://gitlab.com/inkscape/inkscape/-/issues/787.

Please feel free to file new bugs about the issues you're seeing at http://inkscape.org/report.

Closed by: https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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