aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2014-07-11 17:58:59 +0000
committerVincent Hennebert <vhennebert@apache.org>2014-07-11 17:58:59 +0000
commitfd5c47183ea4a2d9bbee434b5333c539113042d1 (patch)
tree729a1cf6deefde816a3dbb1bcd8910e581645d85 /src/java/org/apache/fop/render
parent27b5b411cd520f757764fcdf0bfa7694c5bf46ec (diff)
downloadxmlgraphics-fop-fd5c47183ea4a2d9bbee434b5333c539113042d1.tar.gz
xmlgraphics-fop-fd5c47183ea4a2d9bbee434b5333c539113042d1.zip
Renamed GradientFactory into GradientMaker
Moved PDF/PSGradientMaker into dedicated packages Factory stands for a pattern relating to application deployment. This is just about rendering a gradient to a certain output format. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1609758 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/pdf/svg/PDFGradientMaker.java (renamed from src/java/org/apache/fop/render/shading/PDFGradientFactory.java)9
-rw-r--r--src/java/org/apache/fop/render/ps/svg/PSGradientMaker.java (renamed from src/java/org/apache/fop/render/shading/PSGradientFactory.java)9
-rw-r--r--src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java9
-rw-r--r--src/java/org/apache/fop/render/shading/GradientMaker.java (renamed from src/java/org/apache/fop/render/shading/GradientFactory.java)29
4 files changed, 30 insertions, 26 deletions
diff --git a/src/java/org/apache/fop/render/shading/PDFGradientFactory.java b/src/java/org/apache/fop/render/pdf/svg/PDFGradientMaker.java
index 576ae3649..dca2801a2 100644
--- a/src/java/org/apache/fop/render/shading/PDFGradientFactory.java
+++ b/src/java/org/apache/fop/render/pdf/svg/PDFGradientMaker.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.fop.render.shading;
+package org.apache.fop.render.pdf.svg;
import java.util.ArrayList;
import java.util.List;
@@ -24,13 +24,16 @@ import org.apache.fop.pdf.PDFDeviceColorSpace;
import org.apache.fop.pdf.PDFFunction;
import org.apache.fop.pdf.PDFPattern;
import org.apache.fop.pdf.PDFShading;
+import org.apache.fop.render.shading.Function;
+import org.apache.fop.render.shading.GradientMaker;
+import org.apache.fop.render.shading.Shading;
import org.apache.fop.svg.PDFGraphics2D;
-public class PDFGradientFactory extends GradientFactory<PDFPattern> {
+public class PDFGradientMaker extends GradientMaker<PDFPattern> {
private final PDFGraphics2D graphics2D;
- public PDFGradientFactory(PDFGraphics2D pdfGraphics2D) {
+ public PDFGradientMaker(PDFGraphics2D pdfGraphics2D) {
this.graphics2D = pdfGraphics2D;
}
diff --git a/src/java/org/apache/fop/render/shading/PSGradientFactory.java b/src/java/org/apache/fop/render/ps/svg/PSGradientMaker.java
index 0efdc3192..c66cd8c24 100644
--- a/src/java/org/apache/fop/render/shading/PSGradientFactory.java
+++ b/src/java/org/apache/fop/render/ps/svg/PSGradientMaker.java
@@ -15,15 +15,16 @@
* limitations under the License.
*/
-package org.apache.fop.render.shading;
+package org.apache.fop.render.ps.svg;
import java.util.List;
import org.apache.fop.pdf.PDFDeviceColorSpace;
-import org.apache.fop.render.ps.svg.PSPattern;
-import org.apache.fop.render.ps.svg.PSShading;
+import org.apache.fop.render.shading.Function;
+import org.apache.fop.render.shading.GradientMaker;
+import org.apache.fop.render.shading.Shading;
-public class PSGradientFactory extends GradientFactory<PSPattern> {
+public class PSGradientMaker extends GradientMaker<PSPattern> {
@Override
protected Shading makeShading(int shadingType,
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 8e7315801..ebc7ef8a0 100644
--- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
+++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
@@ -33,7 +33,6 @@ import org.apache.batik.ext.awt.RadialGradientPaint;
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
import org.apache.xmlgraphics.ps.PSGenerator;
-import org.apache.fop.render.shading.PSGradientFactory;
import org.apache.fop.render.shading.Pattern;
@@ -71,16 +70,16 @@ public class PSSVGGraphics2D extends PSGraphics2D {
protected void applyPaint(Paint paint, boolean fill) {
super.applyPaint(paint, fill);
if (paint instanceof LinearGradientPaint) {
- Pattern pattern = new PSGradientFactory()
- .createLinearGradient((LinearGradientPaint) paint, getBaseTransform(), getTransform());
+ Pattern pattern = new PSGradientMaker()
+ .makeLinearGradient((LinearGradientPaint) paint, getBaseTransform(), getTransform());
try {
gen.write(pattern.toString());
} catch (IOException ioe) {
handleIOException(ioe);
}
} else if (paint instanceof RadialGradientPaint) {
- Pattern pattern = new PSGradientFactory()
- .createRadialGradient((RadialGradientPaint) paint, getBaseTransform(), getTransform());
+ Pattern pattern = new PSGradientMaker()
+ .makeRadialGradient((RadialGradientPaint) paint, getBaseTransform(), getTransform());
try {
gen.write(pattern.toString());
} catch (IOException ioe) {
diff --git a/src/java/org/apache/fop/render/shading/GradientFactory.java b/src/java/org/apache/fop/render/shading/GradientMaker.java
index 94fe21ae9..62eab6a48 100644
--- a/src/java/org/apache/fop/render/shading/GradientFactory.java
+++ b/src/java/org/apache/fop/render/shading/GradientMaker.java
@@ -33,9 +33,9 @@ import org.apache.xmlgraphics.java2d.color.ColorUtil;
import org.apache.fop.pdf.PDFDeviceColorSpace;
-public abstract class GradientFactory<P extends Pattern> {
+public abstract class GradientMaker<P extends Pattern> {
- public P createLinearGradient(LinearGradientPaint gp,
+ public P makeLinearGradient(LinearGradientPaint gp,
AffineTransform baseTransform, AffineTransform transform) {
Point2D startPoint = gp.getStartPoint();
Point2D endPoint = gp.getEndPoint();
@@ -44,10 +44,10 @@ public abstract class GradientFactory<P extends Pattern> {
coords.add(new Double(startPoint.getY()));
coords.add(new Double(endPoint.getX()));
coords.add(new Double(endPoint.getY()));
- return createGradient(gp, coords, baseTransform, transform);
+ return makeGradient(gp, coords, baseTransform, transform);
}
- public P createRadialGradient(RadialGradientPaint gradient,
+ public P makeRadialGradient(RadialGradientPaint gradient,
AffineTransform baseTransform, AffineTransform transform) {
double radius = gradient.getRadius();
Point2D center = gradient.getCenterPoint();
@@ -69,14 +69,14 @@ public abstract class GradientFactory<P extends Pattern> {
coords.add(Double.valueOf(center.getX()));
coords.add(Double.valueOf(center.getY()));
coords.add(Double.valueOf(radius));
- return createGradient(gradient, coords, baseTransform, transform);
+ return makeGradient(gradient, coords, baseTransform, transform);
}
- private P createGradient(MultipleGradientPaint gradient, List<Double> coords,
+ private P makeGradient(MultipleGradientPaint gradient, List<Double> coords,
AffineTransform baseTransform, AffineTransform transform) {
- List<Double> matrix = createTransform(gradient, baseTransform, transform);
- List<Double> bounds = createBounds(gradient);
- List<Function> functions = createFunctions(gradient);
+ List<Double> matrix = makeTransform(gradient, baseTransform, transform);
+ List<Double> bounds = makeBounds(gradient);
+ List<Function> functions = makeFunctions(gradient);
// Gradients are currently restricted to sRGB
PDFDeviceColorSpace colorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
Function function = new Function(3, null, null, functions, bounds, null);
@@ -85,7 +85,7 @@ public abstract class GradientFactory<P extends Pattern> {
return makePattern(2, shading, matrix);
}
- private List<Double> createTransform(MultipleGradientPaint gradient,
+ private List<Double> makeTransform(MultipleGradientPaint gradient,
AffineTransform baseTransform, AffineTransform transform) {
AffineTransform gradientTransform = new AffineTransform(baseTransform);
gradientTransform.concatenate(transform);
@@ -105,7 +105,7 @@ public abstract class GradientFactory<P extends Pattern> {
return c.getColorSpace().isCS_sRGB() ? c : ColorUtil.toSRGBColor(c);
}
- private List<Double> createBounds(MultipleGradientPaint gradient) {
+ private List<Double> makeBounds(MultipleGradientPaint gradient) {
// TODO is the conversion to double necessary?
float[] fractions = gradient.getFractions();
List<Double> bounds = new java.util.ArrayList<Double>(fractions.length);
@@ -117,8 +117,8 @@ public abstract class GradientFactory<P extends Pattern> {
return bounds;
}
- private List<Function> createFunctions(MultipleGradientPaint gradient) {
- List<Color> colors = createColors(gradient);
+ private List<Function> makeFunctions(MultipleGradientPaint gradient) {
+ List<Color> colors = makeColors(gradient);
List<Function> functions = new ArrayList<Function>();
for (int currentPosition = 0, lastPosition = colors.size() - 1;
currentPosition < lastPosition;
@@ -133,7 +133,7 @@ public abstract class GradientFactory<P extends Pattern> {
return functions;
}
- private List<Color> createColors(MultipleGradientPaint gradient) {
+ private List<Color> makeColors(MultipleGradientPaint gradient) {
Color[] svgColors = gradient.getColors();
List<Color> gradientColors = new ArrayList<Color>(svgColors.length + 2);
float[] fractions = gradient.getFractions();
@@ -153,4 +153,5 @@ public abstract class GradientFactory<P extends Pattern> {
List<Double> coords, Function function);
protected abstract P makePattern(int patternType, Shading shading, List<Double> matrix);
+
}