Java 1.6 Windows Vista - Batik 1.7

I have been trying to apply a drop shadow to a rectangle with a gradient
fill and have been getting a strange banding effect.
The banding can be reproduced using the following SVG:

<?xml version="1.0" encoding="UTF-8"?>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg"; width="900" height="300"
version="1.1">
<svg:defs xmlns:f="http://www.w3.org/2001/02/xml-fragment";>
<svg:linearGradient id="g1" x1="0%" y1="0%" x2="0%" y2="128px"
gradientUnits="userSpaceOnUse">
<svg:stop stop-color="#fff" offset="0"/>
<svg:stop stop-color="#aaa" offset="0.03"/>
<svg:stop stop-color="#222" offset="0.06"/>
<svg:stop stop-color="#000" offset="1"/>
</svg:linearGradient>
<svg:filter id="i1" width="150%" height="150%">
<svg:feComposite in="SourceGraphic" in2="SourceAlpha"/>
</svg:filter>
</svg:defs>
<svg:rect width="799" height="199"
style="fill:url(#g1);stroke-width:1;stroke:black;stroke-opacity:0.7;" rx="5"
ry="5" x="0.5" y="0.5" filter="url(#i1)"/>
</svg:svg>


The banding seems to be caused by trying to perform a composite operation
with a filter on a shape with a gradient fill. For instance - changing the
filter to an feOffset will not cause banding.

Strangly I get similar banding in Firefox, but not in Inkscape. So I'm
wondering if this banding is caused by something in the SVG spec?

Bryn

Reply via email to