There's a bug found while converting an SVG file to PDF file with some functionalities of linearGradient and object translation, using the FOP version xml-fop_20040318232912.tar.gz The source SVG file contains two rect shapes, one is located from the origin, another is translated for some distance. Both of them are employed with a same linearGradient, names "linearGradient1", which is defined based on the origin of the SVG coordinate. However, in the converted PDF file, the translated rect object just displays a single color (the second stop color of the linearGradient), while the un-translated rect object displays normally. We found the root cause of this issue maybe the improper concatinating transformations implemented in the ApplyPaint() function of the class org.apache.fop.svg.PDFGraphics2D, omitting a necessary concatinating transform: ============================= //MultipleGradientPaint.CycleMethodEnum cycenum = gp.getCycleMethod(); //boolean cyclic = (cycenum == MultipleGradientPaint.REPEAT); AffineTransform transform = graphicsState.getTransform(); transform.concatenate(gp.getTransform()); transform.concatenate(getTransform()); ///Here the fixing ============================= The sample of SVG file is attached as below: =================================================================== <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" version="1.1"> <desc>Example lingrad01 - fill a rectangle using a linear gradient paint server</desc> <g> <defs> <linearGradient x1="10" gradientUnits="userSpaceOnUse" x2="300" y1="10" y2="300" id="linearGradient1" spreadMethod="pad"> <stop style="stop-opacity:1; stop-color:blue;" offset="0%" /> <stop style="stop-opacity:1; stop-color:green;" offset="100%" /> </linearGradient> </defs> <!-- The rectangle is filled using a linear gradient paint server --> <rect x="10" y="10" width="290" style="fill:url(#linearGradient1); stroke:none;" height="290" /> <rect transform="translate(300,300)" x="10" y="10" width="290" style="fill:url (#linearGradient1); stroke:none;" height="290" /> <rect x="0" y="0" height="600" width="800" style="stroke:red; fill:none"/> </g> </svg> ============================================================================
Created attachment 11003 [details] The converted PDF file from the given SVG file
Thanks for finding this issue. Please could you submit your suggested change as a unified diff and attach (not copy and paste) it to this bug report. I would also be grateful if you could attach the SVG (rather than copy and paste into the text) Thanks
Looks good. Applied. But as Chris said, we'd be grateful if you sent a unified diff against CVS next time. Thank you!
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed