aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/ps/svg
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2014-07-14 21:24:32 +0000
committerVincent Hennebert <vhennebert@apache.org>2014-07-14 21:24:32 +0000
commitcc8de67793c578b4e33860db6f11ab18e2aeee20 (patch)
tree7ee856c0ee1be368a01ee940feeace1468073903 /src/java/org/apache/fop/render/ps/svg
parent137171a8e7b96fcff3b9c87195cda692b1fdbfa0 (diff)
downloadxmlgraphics-fop-cc8de67793c578b4e33860db6f11ab18e2aeee20.tar.gz
xmlgraphics-fop-cc8de67793c578b4e33860db6f11ab18e2aeee20.zip
Delegate function rendering to dedicated class intead of taking as parameter a list of Strings coming from who knows where
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1610535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps/svg')
-rw-r--r--src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java25
1 files changed, 10 insertions, 15 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 55811f2c9..b8ddc20d8 100644
--- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
@@ -23,8 +23,6 @@ import java.awt.Graphics;
import java.awt.Paint;
import java.awt.geom.AffineTransform;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,6 +34,7 @@ import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.fop.render.gradient.Function;
+import org.apache.fop.render.gradient.Function.SubFunctionRenderer;
import org.apache.fop.render.gradient.GradientMaker;
import org.apache.fop.render.gradient.Pattern;
import org.apache.fop.render.gradient.Shading;
@@ -127,24 +126,20 @@ public class PSSVGGraphics2D extends PSGraphics2D {
Shading.FunctionRenderer functionRenderer = new Shading.FunctionRenderer() {
public void outputFunction(StringBuilder out) {
- List<String> functionsStrings = new ArrayList<String>(function.getFunctions().size());
- for (Function f : function.getFunctions()) {
- functionsStrings.add(functionToString(f));
- }
- out.append(function.toWriteableString(functionsStrings));
+ SubFunctionRenderer subFunctionRenderer = new Function.SubFunctionRenderer() {
+
+ public void outputFunction(StringBuilder out, int functionIndex) {
+ Function subFunction = function.getFunctions().get(functionIndex);
+ assert subFunction.getFunctions().isEmpty();
+ out.append(subFunction.toWriteableString(null));
+ }
+ };
+ out.append(function.toWriteableString(subFunctionRenderer));
}
};
shading.output(p, functionRenderer);
}
- private String functionToString(Function function) {
- List<String> functionsStrings = new ArrayList<String>(function.getFunctions().size());
- for (Function f : function.getFunctions()) {
- functionsStrings.add(functionToString(f));
- }
- return function.toWriteableString(functionsStrings);
- }
-
protected AffineTransform getBaseTransform() {
AffineTransform at = new AffineTransform(this.getTransform());
return at;