aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java5
-rw-r--r--src/java/org/apache/fop/render/shading/GradientFactory.java17
-rw-r--r--src/java/org/apache/fop/render/shading/PDFGradientFactory.java7
-rw-r--r--src/java/org/apache/fop/svg/PDFGraphics2D.java5
4 files changed, 11 insertions, 23 deletions
diff --git a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
index 4f897dad6..7bb230323 100644
--- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
@@ -40,7 +40,6 @@ import org.apache.xmlgraphics.ps.PSGenerator;
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 PSGraphics2D implements GradientRegistrar {
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 PSGraphics2D implements GradientRegistrar {
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);
diff --git a/src/java/org/apache/fop/render/shading/GradientFactory.java b/src/java/org/apache/fop/render/shading/GradientFactory.java
index 87ac11c83..882faa302 100644
--- a/src/java/org/apache/fop/render/shading/GradientFactory.java
+++ b/src/java/org/apache/fop/render/shading/GradientFactory.java
@@ -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
diff --git a/src/java/org/apache/fop/render/shading/PDFGradientFactory.java b/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
index 3b3dcab75..c40ac0671 100644
--- a/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
+++ b/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
@@ -24,9 +24,16 @@ import org.apache.fop.pdf.PDFDeviceColorSpace;
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) {
diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java
index c6727057f..afc80e9bf 100644
--- a/src/java/org/apache/fop/svg/PDFGraphics2D.java
+++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java
@@ -97,7 +97,6 @@ import org.apache.fop.render.pdf.ImageRawCCITTFaxAdapter;
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 AbstractGraphics2D implements NativeImageHand
//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 AbstractGraphics2D implements NativeImageHand
}
}
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));