From 2cf4301b4fae392b6d904457974092f3634902c0 Mon Sep 17 00:00:00 2001 From: Vincent Hennebert Date: Thu, 10 Jul 2014 17:51:53 +0000 Subject: Small adjustments to make duplication in PDF and PostScript gradients more apparent git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1609526 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/ps/svg/PSSVGGraphics2D.java | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/java/org/apache/fop/render/ps') 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 abfbdd859..12a482c94 100644 --- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java @@ -104,24 +104,24 @@ public class PSSVGGraphics2D extends PSGraphics2D implements GradientRegistrar { List matrix = createGradientTransform(gp); - List theCoords = new java.util.ArrayList(); - theCoords.add(gp.getStartPoint().getX()); - theCoords.add(gp.getStartPoint().getX()); - theCoords.add(gp.getEndPoint().getX()); - theCoords.add(gp.getEndPoint().getY()); + Point2D startPoint = gp.getStartPoint(); + Point2D endPoint = gp.getEndPoint(); + List coords = new java.util.ArrayList(4); + coords.add(new Double(startPoint.getX())); + coords.add(new Double(startPoint.getY())); + coords.add(new Double(endPoint.getX())); + coords.add(new Double(endPoint.getY())); List colors = createGradientColors(gp); List bounds = createGradientBounds(gp); - PDFDeviceColorSpace colSpace; - colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB); + //Gradients are currently restricted to sRGB + PDFDeviceColorSpace colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB); PSGradientFactory gradientFactory = new PSGradientFactory(); - PSPattern myPattern = gradientFactory.createGradient(false, colSpace, - colors, bounds, theCoords, matrix); - - gen.write(myPattern.toString()); + PSPattern pattern = gradientFactory.createGradient(false, colSpace, colors, bounds, coords, matrix); + gen.write(pattern.toString()); } private void handleRadialGradient(RadialGradientPaint gp, PSGenerator gen) throws IOException { @@ -157,14 +157,13 @@ public class PSSVGGraphics2D extends PSGraphics2D implements GradientRegistrar { List colors = createGradientColors(gp); List bounds = createGradientBounds(gp); - PDFDeviceColorSpace colSpace; - colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB); + //Gradients are currently restricted to sRGB + PDFDeviceColorSpace colSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB); PSGradientFactory gradientFactory = new PSGradientFactory(); - PSPattern myPattern = gradientFactory.createGradient(true, colSpace, - colors, bounds, theCoords, matrix); + PSPattern pattern = gradientFactory.createGradient(true, colSpace, colors, bounds, theCoords, matrix); - gen.write(myPattern.toString()); + gen.write(pattern.toString()); } private List createGradientTransform(MultipleGradientPaint gradient) { -- cgit v1.2.3