From 09781c3b8f0ff0f20fe10cb3c449c842d92a9581 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Thu, 10 Jul 2014 18:17:36 +0000 Subject: [PATCH] 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 --- .../fop/render/shading/GradientFactory.java | 25 ++++--------------- 1 file 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

{ List 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 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 createTransform(MultipleGradientPaint gradient, @@ -130,25 +134,6 @@ public abstract class GradientFactory

{ 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 colors, List bounds, List coords, List matrix) { - List 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 createFunctions(List colors) { List functions = new ArrayList(); for (int currentPosition = 0, lastPosition = colors.size() - 1; -- 2.39.5