aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/shading
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2014-07-10 18:00:58 +0000
committerVincent Hennebert <vhennebert@apache.org>2014-07-10 18:00:58 +0000
commited15912213167d400aab00ece6766362d4430e41 (patch)
tree4fe3d77ccbf5145d4ac7a66926657859bfeb717f /src/java/org/apache/fop/render/shading
parent1cc7422fab91ce2f6dfb07762b6bed6c4913793f (diff)
downloadxmlgraphics-fop-ed15912213167d400aab00ece6766362d4430e41.tar.gz
xmlgraphics-fop-ed15912213167d400aab00ece6766362d4430e41.zip
Removed createGradient abstract method, that was not having any specific implementation in sub-classes
Removed unnecessary GradientRegistrar interface git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1609532 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/shading')
-rw-r--r--src/java/org/apache/fop/render/shading/GradientFactory.java10
-rw-r--r--src/java/org/apache/fop/render/shading/GradientRegistrar.java45
-rw-r--r--src/java/org/apache/fop/render/shading/PDFGradientFactory.java30
-rw-r--r--src/java/org/apache/fop/render/shading/PSGradientFactory.java11
4 files changed, 15 insertions, 81 deletions
diff --git a/src/java/org/apache/fop/render/shading/GradientFactory.java b/src/java/org/apache/fop/render/shading/GradientFactory.java
index 9a68cdf7d..3ec03d60f 100644
--- a/src/java/org/apache/fop/render/shading/GradientFactory.java
+++ b/src/java/org/apache/fop/render/shading/GradientFactory.java
@@ -79,7 +79,7 @@ public abstract class GradientFactory<P extends Pattern> {
List<Double> bounds = createBounds(gradient);
//Gradients are currently restricted to sRGB
PDFDeviceColorSpace colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
- return createGradient(gradient instanceof RadialGradientPaint, colSpace, colors, bounds, coords, matrix);
+ return makeGradient(gradient instanceof RadialGradientPaint, colSpace, colors, bounds, coords, matrix);
}
private List<Double> createTransform(MultipleGradientPaint gradient,
@@ -134,11 +134,7 @@ public abstract class GradientFactory<P extends Pattern> {
* @param theMatrix The matrix for any transformations
* @return Returns the Pattern object of the gradient
*/
- public abstract P createGradient(boolean radial,
- PDFDeviceColorSpace theColorspace, List<Color> theColors, List<Double> theBounds,
- List<Double> theCoords, List<Double> theMatrix);
-
- protected Pattern makeGradient(boolean radial, PDFDeviceColorSpace theColorspace,
+ protected P makeGradient(boolean radial, PDFDeviceColorSpace theColorspace,
List<Color> theColors, List<Double> theBounds,
List<Double> theCoords, List<Double> theMatrix) {
Shading myShad;
@@ -226,7 +222,7 @@ public abstract class GradientFactory<P extends Pattern> {
boolean theAntiAlias, List<Double> theCoords, List<Double> theDomain,
Function theFunction, List<Integer> theExtend);
- public abstract Pattern makePattern(int thePatternType, Shading theShading, List theXUID,
+ public abstract P makePattern(int thePatternType, Shading theShading, List theXUID,
StringBuffer theExtGState, List<Double> theMatrix);
private List<Double> toColorVector(Color nextColor) {
diff --git a/src/java/org/apache/fop/render/shading/GradientRegistrar.java b/src/java/org/apache/fop/render/shading/GradientRegistrar.java
deleted file mode 100644
index 617fcd4fb..000000000
--- a/src/java/org/apache/fop/render/shading/GradientRegistrar.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.fop.render.shading;
-
-public interface GradientRegistrar {
-
- /**
- * Registers a function object against the output format document
- * @param function The function object to register
- * @return Returns either the function which has already been registered
- * or the current new registered object.
- */
- Function registerFunction(Function function);
-
- /**
- * Registers a shading object against the output format document
- * @param shading The shading object to register
- * @return Returns either the shading which has already been registered
- * or the current new registered object
- */
- Shading registerShading(Shading shading);
-
- /**
- * Registers a pattern object against the output format document
- * @param pattern The pattern object to register
- * @return Returns either the pattern which has already been registered
- * or the current new registered object
- */
- Pattern registerPattern(Pattern pattern);
-}
diff --git a/src/java/org/apache/fop/render/shading/PDFGradientFactory.java b/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
index 7254b1669..e12fa82e5 100644
--- a/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
+++ b/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
@@ -17,7 +17,6 @@
package org.apache.fop.render.shading;
-import java.awt.Color;
import java.util.List;
import org.apache.fop.pdf.PDFDeviceColorSpace;
@@ -28,35 +27,28 @@ import org.apache.fop.svg.PDFGraphics2D;
public class PDFGradientFactory extends GradientFactory<PDFPattern> {
- private final GradientRegistrar registrar;
+ private final PDFGraphics2D graphics2D;
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) {
- return (PDFPattern)makeGradient(radial, theColorspace, theColors, theBounds,
- theCoords, theMatrix);
+ this.graphics2D = pdfGraphics2D;
}
@Override
public Function makeFunction(int functionType, List<Double> theDomain,
List<Double> theRange, List<Function> theFunctions,
List<Double> theBounds, List<Double> theEncode) {
- Function newFunction = new PDFFunction(functionType, theDomain, theRange, theFunctions,
+ PDFFunction newFunction = new PDFFunction(functionType, theDomain, theRange, theFunctions,
theBounds, theEncode);
- newFunction = registrar.registerFunction(newFunction);
+ newFunction = graphics2D.registerFunction(newFunction);
return newFunction;
}
public Function makeFunction(int functionType, List<Double> theDomain,
List<Double> theRange, List<Double> theCZero, List<Double> theCOne,
double theInterpolationExponentN) {
- Function newFunction = new PDFFunction(functionType, theDomain, theRange, theCZero,
+ PDFFunction newFunction = new PDFFunction(functionType, theDomain, theRange, theCZero,
theCOne, theInterpolationExponentN);
- newFunction = registrar.registerFunction(newFunction);
+ newFunction = graphics2D.registerFunction(newFunction);
return newFunction;
}
@@ -65,18 +57,18 @@ public class PDFGradientFactory extends GradientFactory<PDFPattern> {
PDFDeviceColorSpace theColorSpace, List<Double> theBackground, List<Double> theBBox,
boolean theAntiAlias, List<Double> theCoords, List<Double> theDomain,
Function theFunction, List<Integer> theExtend) {
- Shading newShading = new PDFShading(theShadingType, theColorSpace, theBackground,
+ PDFShading newShading = new PDFShading(theShadingType, theColorSpace, theBackground,
theBBox, theAntiAlias, theCoords, theDomain, theFunction, theExtend);
- newShading = registrar.registerShading(newShading);
+ newShading = graphics2D.registerShading(newShading);
return newShading;
}
@Override
- public Pattern makePattern(int thePatternType, Shading theShading, List theXUID,
+ public PDFPattern makePattern(int thePatternType, Shading theShading, List theXUID,
StringBuffer theExtGState, List<Double> theMatrix) {
- Pattern newPattern = new PDFPattern(thePatternType, theShading, theXUID, theExtGState,
+ PDFPattern newPattern = new PDFPattern(thePatternType, theShading, theXUID, theExtGState,
theMatrix);
- newPattern = registrar.registerPattern(newPattern);
+ newPattern = graphics2D.registerPattern(newPattern);
return newPattern;
}
diff --git a/src/java/org/apache/fop/render/shading/PSGradientFactory.java b/src/java/org/apache/fop/render/shading/PSGradientFactory.java
index 156ace52a..afd23ad75 100644
--- a/src/java/org/apache/fop/render/shading/PSGradientFactory.java
+++ b/src/java/org/apache/fop/render/shading/PSGradientFactory.java
@@ -17,7 +17,6 @@
package org.apache.fop.render.shading;
-import java.awt.Color;
import java.util.List;
import org.apache.fop.pdf.PDFDeviceColorSpace;
@@ -27,14 +26,6 @@ import org.apache.fop.render.ps.svg.PSShading;
public class PSGradientFactory extends GradientFactory<PSPattern> {
- @Override
- public PSPattern createGradient(boolean radial, PDFDeviceColorSpace theColorspace,
- List<Color> theColors, List<Double> theBounds, List<Double> theCoords,
- List<Double> theMatrix) {
- return (PSPattern)makeGradient(radial, theColorspace, theColors, theBounds,
- theCoords, theMatrix);
- }
-
public Function makeFunction(int functionType, List<Double> theDomain,
List<Double> theRange, List<Function> theFunctions,
List<Double> theBounds, List<Double> theEncode) {
@@ -63,7 +54,7 @@ public class PSGradientFactory extends GradientFactory<PSPattern> {
}
@Override
- public Pattern makePattern(int thePatternType, Shading theShading, List theXUID,
+ public PSPattern makePattern(int thePatternType, Shading theShading, List theXUID,
StringBuffer theExtGState, List<Double> theMatrix) {
return new PSPattern(thePatternType, theShading, theXUID, theExtGState, theMatrix);
}