Incorrect rendering of radial gradients

Bug #913431 reported by Alexandre Prokoudine on 2012-01-08
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
High
Unassigned

Bug Description

The report is coming from Andrey Bayrak of SVG Cleaner team.

According to SVG standard, default values for cx, cy and r elements for radialGradients is 50%. To quote it: “If the attribute is not specified, the effect is as if a value of '50%' were specified.”

That means if cx and cy are 1/2 of viewBox's width and height, they can be safely wiped during optimization. E.g. Firefox will render such an optimized SVG file just fine, but Inkscape won't.

Andrey illustrates that with two attached files: database-bug.svg is the optimized version of database-normal.svg and has the cx="64" attribute removed from lines 112 and 114.

description: updated
su_v (suv-lp) on 2012-01-08
tags: added: gradient svg
su_v (suv-lp) wrote :

Difference in rendering reproduced with Inkscape 0.48.2 and 0.48+devel r10860 on OS X Lion,
compared to how Firefox 9 and Chromium 18 render the file

Note:
- while Opera 11.6 and Squiggle (Batik 1.7) also appear to render the two versions identically, they do not agree with Firefox and Chromium about how to render the radial gradients of the stacked objects in the background.
- rsvg-view doesn't render the objects stacked in the background, and also shows a difference (in the background) between the two versions.

Any chance to get a more reduced test case?

<off-topic>
BTW - Squiggle (Batik 1.7) initially refused to open both SVG files with the error message
  Unsupport SVG version '1'
Changing 'version="1"' to 'version="1.0"' fixed that.
<http://www.w3.org/TR/SVG11/struct.html#SVGElementVersionAttribute>
</off-topic>

Changed in inkscape:
status: New → Confirmed

> Any chance to get a more reduced test case?

You mean, a file with less objects?

su_v (suv-lp) wrote :

@prokoudine - a reduced test case, as simple as possible (without viewBox, clips/masks, filter effects and matrix transformations on nested groups), which renders identically in most modern SVG viewers (even before getting cleaned).

Reduced test case

Firefox 9, Chromium 18, Squiggle (Batik 1.7):
- all gradients are rendered identically
   cx = cy = fx = fy = 200px = 1/2 of current viewport
   viewport: <svg height="400" width="400">

Inkscape 0.48.2, 0.48+devel r10865 as well as rsvg-view 2.34.2:
- focus stays centered (unchanged)
- center apparently offset by r * gradientTransform * (-1)
   if cx / cy omitted (assumed default would be 400px / 2 = 200px)

su_v (suv-lp) wrote :

Screenshot comparing reduced test case in Inkscape 0.48+devel r10865 (upper row) and Squiggle/Batik 1.7 (lower row) on OS X Lion.

jazzynico (jazzynico) wrote :

Setting importance to "High" (SVG-compliant documents misinterpreted).

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

Duplicates of this bug

Other bug subscribers