You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2014/07/10 19:13:45 UTC

svn commit: r1609511 - in /xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop: render/ps/svg/PSSVGGraphics2D.java render/shading/GradientFactory.java render/shading/PDFGradientFactory.java svg/PDFGraphics2D.java

Author: vhennebert
Date: Thu Jul 10 17:13:45 2014
New Revision: 1609511

URL: http://svn.apache.org/r1609511
Log:
Removed pseudo-factory method GradientFactory.newInstance

Modified:
    xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
    xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/GradientFactory.java
    xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
    xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java

Modified: xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java?rev=1609511&r1=1609510&r2=1609511&view=diff
==============================================================================
--- xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java (original)
+++ xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java Thu Jul 10 17:13:45 2014
@@ -40,7 +40,6 @@ import org.apache.xmlgraphics.ps.PSGener
 
 import org.apache.fop.pdf.PDFDeviceColorSpace;
 import org.apache.fop.render.shading.Function;
-import org.apache.fop.render.shading.GradientFactory;
 import org.apache.fop.render.shading.GradientRegistrar;
 import org.apache.fop.render.shading.PSGradientFactory;
 import org.apache.fop.render.shading.Pattern;
@@ -148,7 +147,7 @@ public class PSSVGGraphics2D extends PSG
         PDFDeviceColorSpace colSpace;
         colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
 
-        PSGradientFactory gradientFactory = (PSGradientFactory)GradientFactory.newInstance(this);
+        PSGradientFactory gradientFactory = new PSGradientFactory();
         PSPattern myPattern = gradientFactory.createGradient(false, colSpace,
                 someColors, theBounds, theCoords, theMatrix);
 
@@ -235,7 +234,7 @@ public class PSSVGGraphics2D extends PSG
         PDFDeviceColorSpace colSpace;
         colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
 
-        PSGradientFactory gradientFactory = (PSGradientFactory)GradientFactory.newInstance(this);
+        PSGradientFactory gradientFactory = new PSGradientFactory();
         PSPattern myPattern = gradientFactory.createGradient(true, colSpace,
                 someColors, theBounds, theCoords, theMatrix);
 

Modified: xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/GradientFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/GradientFactory.java?rev=1609511&r1=1609510&r2=1609511&view=diff
==============================================================================
--- xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/GradientFactory.java (original)
+++ xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/GradientFactory.java Thu Jul 10 17:13:45 2014
@@ -26,26 +26,9 @@ import java.util.List;
 import org.apache.xmlgraphics.java2d.color.ColorUtil;
 
 import org.apache.fop.pdf.PDFDeviceColorSpace;
-import org.apache.fop.render.ps.svg.PSSVGGraphics2D;
 
 public abstract class GradientFactory {
 
-    static GradientRegistrar registrar;
-
-    /**
-     * Constructor
-     * @param registrar The object used to register new embedded objects in the
-     * output format.
-     */
-    public static GradientFactory newInstance(GradientRegistrar theRegistrar) {
-        registrar = theRegistrar;
-        if (registrar instanceof PSSVGGraphics2D) {
-            return new PSGradientFactory();
-        } else {
-            return new PDFGradientFactory();
-        }
-    }
-
     /**
      * Creates a new gradient
      * @param radial Determines whether the gradient is radial

Modified: xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/PDFGradientFactory.java?rev=1609511&r1=1609510&r2=1609511&view=diff
==============================================================================
--- xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/PDFGradientFactory.java (original)
+++ xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/shading/PDFGradientFactory.java Thu Jul 10 17:13:45 2014
@@ -24,9 +24,16 @@ import org.apache.fop.pdf.PDFDeviceColor
 import org.apache.fop.pdf.PDFFunction;
 import org.apache.fop.pdf.PDFPattern;
 import org.apache.fop.pdf.PDFShading;
+import org.apache.fop.svg.PDFGraphics2D;
 
 public class PDFGradientFactory extends GradientFactory {
 
+    private final GradientRegistrar registrar;
+
+    public PDFGradientFactory(PDFGraphics2D pdfGraphics2D) {
+        this.registrar = pdfGraphics2D;
+    }
+
     @Override
     public PDFPattern createGradient(boolean radial, PDFDeviceColorSpace theColorspace, List<Color> theColors,
             List<Double> theBounds, List<Double> theCoords, List<Double> theMatrix) {

Modified: xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1609511&r1=1609510&r2=1609511&view=diff
==============================================================================
--- xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java Thu Jul 10 17:13:45 2014
@@ -97,7 +97,6 @@ import org.apache.fop.render.pdf.ImageRa
 import org.apache.fop.render.pdf.ImageRawJPEGAdapter;
 import org.apache.fop.render.pdf.ImageRenderedAdapter;
 import org.apache.fop.render.shading.Function;
-import org.apache.fop.render.shading.GradientFactory;
 import org.apache.fop.render.shading.GradientRegistrar;
 import org.apache.fop.render.shading.PDFGradientFactory;
 import org.apache.fop.render.shading.Pattern;
@@ -897,7 +896,7 @@ public class PDFGraphics2D extends Abstr
 
             //Gradients are currently restricted to sRGB
             PDFDeviceColorSpace colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
-            PDFGradientFactory gradientFactory = (PDFGradientFactory)GradientFactory.newInstance(this);
+            PDFGradientFactory gradientFactory = new PDFGradientFactory(this);
             PDFPattern myPat = gradientFactory.createGradient(false, colSpace, someColors, theBounds,
                     theCoords, theMatrix);
             currentStream.write(myPat.getColorSpaceOut(fill));
@@ -980,7 +979,7 @@ public class PDFGraphics2D extends Abstr
                 }
             }
             PDFDeviceColorSpace colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
-            PDFGradientFactory gradientFactory = (PDFGradientFactory) GradientFactory.newInstance(this);
+            PDFGradientFactory gradientFactory = new PDFGradientFactory(this);
             PDFPattern myPat = gradientFactory.createGradient(true, colSpace, someColors, theBounds,
                     theCoords, theMatrix);
             currentStream.write(myPat.getColorSpaceOut(fill));



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org