diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2014-07-10 18:17:36 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2014-07-10 18:17:36 +0000 |
commit | 09781c3b8f0ff0f20fe10cb3c449c842d92a9581 (patch) | |
tree | 78375fe792302c93c95b6ada2d9ead3700eb7401 | |
parent | 3a36357fca704d9182047c84bbee79a2ec091b2e (diff) | |
download | xmlgraphics-fop-09781c3b8f0ff0f20fe10cb3c449c842d92a9581.tar.gz xmlgraphics-fop-09781c3b8f0ff0f20fe10cb3c449c842d92a9581.zip |
Removed makeGradient and moved its content into createGradient
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1609542 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/render/shading/GradientFactory.java | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/java/org/apache/fop/render/shading/GradientFactory.java b/src/java/org/apache/fop/render/shading/GradientFactory.java index 2c74eceed..ba76f3071 100644 --- a/src/java/org/apache/fop/render/shading/GradientFactory.java +++ b/src/java/org/apache/fop/render/shading/GradientFactory.java @@ -79,7 +79,11 @@ 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 makeGradient(gradient instanceof RadialGradientPaint, colSpace, colors, bounds, coords, matrix); + List<Function> functions = createFunctions(colors); + Function function = makeFunction(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); } private List<Double> createTransform(MultipleGradientPaint gradient, @@ -130,25 +134,6 @@ public abstract class GradientFactory<P extends Pattern> { return bounds; } - /** - * Creates a new gradient. - * - * @param radial whether the gradient is linear or radial - * @param colorspace the colorspace used in PDF and Postscript - * @param colors the colors to be used in the gradient - * @param bounds the bounds of each color - * @param coords the coordinates of the gradient - * @param matrix the transformation matrix - * @return the Pattern object of the gradient - */ - protected P makeGradient(boolean radial, PDFDeviceColorSpace colorspace, - List<Color> colors, List<Double> bounds, List<Double> coords, List<Double> matrix) { - List<Function> functions = createFunctions(colors); - Function function = makeFunction(3, null, null, functions, bounds, null); - Shading shading = makeShading(radial ? 3 : 2, colorspace, null, null, false, coords, null, function, null); - return makePattern(2, shading, null, null, matrix); - } - private List<Function> createFunctions(List<Color> colors) { List<Function> functions = new ArrayList<Function>(); for (int currentPosition = 0, lastPosition = colors.size() - 1; |