]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Simplified makeShading and makePattern methods
authorVincent Hennebert <vhennebert@apache.org>
Fri, 11 Jul 2014 17:41:49 +0000 (17:41 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Fri, 11 Jul 2014 17:41:49 +0000 (17:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1609754 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/shading/GradientFactory.java
src/java/org/apache/fop/render/shading/PDFGradientFactory.java
src/java/org/apache/fop/render/shading/PSGradientFactory.java

index 666bc0a7704347b0ac8bd3da2d7883ffcc145d72..94fe21ae909425a841af9f53d991e8ac5f9017b0 100644 (file)
@@ -77,12 +77,12 @@ public abstract class GradientFactory<P extends Pattern> {
         List<Double> matrix = createTransform(gradient, baseTransform, transform);
         List<Double> bounds = createBounds(gradient);
         List<Function> functions = createFunctions(gradient);
-        //Gradients are currently restricted to sRGB
-        PDFDeviceColorSpace colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
+        // Gradients are currently restricted to sRGB
+        PDFDeviceColorSpace colorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
         Function function = new Function(3, null, null, functions, bounds, null);
-        Shading shading = makeShading(gradient instanceof LinearGradientPaint ? 2 : 3,
-                colSpace, null, null, false, coords, null, function, null);
-        return makePattern(2, shading, null, null, matrix);
+        Shading shading = makeShading(gradient instanceof LinearGradientPaint ? 2 : 3, colorSpace,
+                coords, function);
+        return makePattern(2, shading, matrix);
     }
 
     private List<Double> createTransform(MultipleGradientPaint gradient,
@@ -149,11 +149,8 @@ public abstract class GradientFactory<P extends Pattern> {
         return gradientColors;
     }
 
-    public abstract Shading makeShading(int shadingType,
-            PDFDeviceColorSpace colorSpace, List<Double> background, List<Double> bbox,
-            boolean antiAlias, List<Double> coords, List<Double> domain,
-            Function function, List<Integer> extend);
+    protected abstract Shading makeShading(int shadingType, PDFDeviceColorSpace colorSpace,
+            List<Double> coords, Function function);
 
-    public abstract P makePattern(int patternType, Shading shading, List xuid,
-            StringBuffer extGState, List<Double> matrix);
+    protected abstract P makePattern(int patternType, Shading shading, List<Double> matrix);
 }
index 4cab73a80067d5dd28bde9b6e0367f594676e0e5..576ae36494a750bfe0215aa8a8508ec2b37a81c6 100644 (file)
@@ -35,27 +35,22 @@ public class PDFGradientFactory extends GradientFactory<PDFPattern> {
     }
 
     @Override
-    public Shading makeShading(int shadingType,
-            PDFDeviceColorSpace colorSpace, List<Double> background, List<Double> bbox,
-            boolean antiAlias, List<Double> coords, List<Double> domain,
-            Function function, List<Integer> extend) {
+    protected Shading makeShading(int shadingType, PDFDeviceColorSpace colorSpace,
+            List<Double> coords, Function function) {
         List<PDFFunction> pdfFunctions = new ArrayList<PDFFunction>(function.getFunctions().size());
         for (Function f : function.getFunctions()) {
             pdfFunctions.add(graphics2D.registerFunction(new PDFFunction(f)));
         }
         PDFFunction pdfFunction = graphics2D.registerFunction(new PDFFunction(function, pdfFunctions));
-        PDFShading newShading = new PDFShading(shadingType, colorSpace, background,
-                    bbox, antiAlias, coords, domain, pdfFunction, extend);
-        newShading = graphics2D.registerShading(newShading);
-        return newShading;
+        PDFShading shading = new PDFShading(shadingType, colorSpace, null, null, false,
+                coords, null, pdfFunction, null);
+        return graphics2D.registerShading(shading);
     }
 
     @Override
-    public PDFPattern makePattern(int patternType, Shading shading, List xuid,
-            StringBuffer extGState, List<Double> matrix) {
-        PDFPattern newPattern = new PDFPattern(patternType, shading, xuid, extGState, matrix);
-        newPattern = graphics2D.registerPattern(newPattern);
-        return newPattern;
+    protected PDFPattern makePattern(int patternType, Shading shading, List<Double> matrix) {
+        PDFPattern pattern = new PDFPattern(patternType, shading, null, null, matrix);
+        return graphics2D.registerPattern(pattern);
     }
 
 }
index 7bd7ba245de18a057f38c88900d8ae9cf457922b..0efdc3192e6aeb6e6634ccd5f73c2bf59d70ce48 100644 (file)
@@ -26,18 +26,13 @@ import org.apache.fop.render.ps.svg.PSShading;
 public class PSGradientFactory extends GradientFactory<PSPattern> {
 
     @Override
-    public Shading makeShading(int shadingType,
-            PDFDeviceColorSpace colorSpace, List<Double> background, List<Double> bbox,
-            boolean antiAlias, List<Double> coords, List<Double> domain,
-            Function function, List<Integer> extend) {
-        Shading newShading = new PSShading(shadingType, colorSpace, background, bbox,
-                    antiAlias, coords, domain, function, extend);
-        return newShading;
+    protected Shading makeShading(int shadingType,
+            PDFDeviceColorSpace colorSpace, List<Double> coords, Function function) {
+        return new PSShading(shadingType, colorSpace, null, null, false, coords, null, function, null);
     }
 
     @Override
-    public PSPattern makePattern(int patternType, Shading shading, List xuid,
-            StringBuffer extGState, List<Double> matrix) {
-        return new PSPattern(patternType, shading, xuid, extGState, matrix);
+    protected PSPattern makePattern(int patternType, Shading shading, List<Double> matrix) {
+        return new PSPattern(patternType, shading, null, null, matrix);
     }
 }