DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27971>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27971

Bugs on the transformation of the linearGradient element for SVG to PDF

           Summary: Bugs on the transformation of the linearGradient element
                    for SVG to PDF
           Product: Fop
           Version: 1.0dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: svg
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


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>
============================================================================

Reply via email to