Bug 14773

Summary: Radial gradients fail to pad in libsvg-cairo-0.1.6
Product: cairo Reporter: Mark Pazolli <cedarsx>
Component: generalAssignee: Vladimir Vukicevic <vladimir>
Status: RESOLVED INVALID QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: cedarsx
Version: 1.5.12   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: the svg file failing to render properly
png of the problem (as rendered by Cairo 1.5.12)
png of correct rendering (as rendered by Batik 1.6)
patch for svg_cairo.c in libsvg-cairo-0.1.6

Description Mark Pazolli 2008-03-02 00:04:52 UTC
Created attachment 14755 [details]
the svg file failing to render properly

Please see the attached SVG file. When using the Quartz backend, Cairo fails to pad out the radial gradient.

For example, in the attached file, the part inside the square after the gradient ends appears transparent when in fact it should appear blue (#0000ff).

A PNG rendering of the problem will be attached once this bug is posted (Bugzilla does not seem to allow multiple initial attachments). My expectation is this bug does not affect non-Quartz renderers.

My current system is running Mac OS 10.4.7 on an Intel-based iMac. I am using the Cairo 1.5.12 snapshot.

I have also tried Cairo 1.5.6 and Cairo 1.4.14 on my iMac and Cairo 1.5.6 on a friend's PowerPC-based laptop - the problem appears on them all. Camino 1.5.5 (Mac-based web browser) renders the SVG file correctly.

The configure line I am using to compile Cairo on Intel is:

./configure i386 darwin-i386-cc --prefix="/tmp/i386" --enable-quartz=yes --enable-pdf=no --enable-ps=no --enable-xlib=no --enable-atsui=yes --enable-svg=yes "CC=cc -arch i386" "PKG_CONFIG_PATH=/tmp/i386/lib/pkgconfig"
Comment 1 Mark Pazolli 2008-03-02 00:09:27 UTC
Created attachment 14756 [details]
png of the problem (as rendered by Cairo 1.5.12)
Comment 2 Mark Pazolli 2008-03-02 00:14:32 UTC
Created attachment 14757 [details]
png of correct rendering (as rendered by Batik 1.6)
Comment 3 Vladimir Vukicevic 2008-03-02 02:08:31 UTC
Erm.. Cairo isn't a SVG renderer, so you'll have to post some cairo code that demonstrates the problem.  I'm reasonably sure that EXTEND_PAD works fine for the quartz backed...
Comment 4 Mark Pazolli 2008-03-02 02:45:37 UTC
This is what I am testing at the moment (whether EXTEND_PAD works for the Quartz back-end generally). The code I am using is "svg2png-0.1.3" which you can download from "http://cairographics.org/snapshots/svg2png-0.1.3.tar.gz". I am calling the svg2png code from a paint program I built (http://seashore.sourceforge.net/). I will let you know when I have more knowledge about the issue.
Comment 5 Mark Pazolli 2008-03-02 08:03:38 UTC
An update on this issue before I go to bed...

After running the standard tests as well as rolling one of my own I verified that the Quartz backend handled padding of the radial gradients fine.

After a little rummaging through the code I discovered the problem was with libsvg-cairo which had not accounted for padding of radial gradients (only repeating and reflecting). By adding the following after line 601:

+	case SVG_GRADIENT_SPREAD_PAD:
+	cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
+	break;

The bug was solved. I went to file a bug report but couldn't find the right component. It then occurred to me it would be best to check git to see if the problem had already been fixed - but I had no luck finding the git for libsvg-cairo.

Perplexed I went on to IRC, where it was suggested that libsvg and libsvg-cairo might have been deprecated and librsvg was now the preferred renderer. This is unfortunate as I don't know how well librsvg will support Mac OS X/Quartz also I had invested some time in getting libsvg to work.

I will write to the Cairo mailing list in the morning to get a feel for what's happening with libsvg and whether there's any interest in continuing its development and, if not, whether there are any suitable alternatives for Mac OS X/Quartz. At the very least maybe I can get the libsvg snapshots put in an "unsupported" directory so others don't make the same mistake as me.
Comment 6 Mark Pazolli 2008-03-21 07:26:17 UTC
Created attachment 15378 [details] [review]
patch for svg_cairo.c in libsvg-cairo-0.1.6

The attached patch should fix this bug when applied to svg_cairo.c in libsvg-cairo-0.1.6.
Comment 7 Chris Wilson 2008-10-10 08:33:42 UTC
At this point, I feel it's safe to say that libsvg is completely unmaintained and its successor would appear to be librsvg. Also looking into /snapshots shows a treasure trove of obsolete and redundant software, all of which by their very nature is unsupported ;-)

Your are free to take libsvg and do as you wish - even to assume maintainership and usurp the current champion. But as this is not a cairo bug per se (and libsvg will need lots of work before it fully supports even the rendering aspects of the SVG specification) I do not see any justification in keeping this bug alive (or a suitable product to transfer it to).

Have fun with cairo and svg - please let us know if there is anything we can do to improve cairo for you.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.