Author: vhennebert
Date: Thu Jul 10 17:51:53 2014
New Revision: 1609526

URL: http://svn.apache.org/r1609526
Log:
Small adjustments to make duplication in PDF and PostScript gradients more 
apparent

Modified:
    
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
    
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java

Modified: 
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java?rev=1609526&r1=1609525&r2=1609526&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
 (original)
+++ 
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java
 Thu Jul 10 17:51:53 2014
@@ -104,24 +104,24 @@ public class PSSVGGraphics2D extends PSG
 
         List<Double> matrix = createGradientTransform(gp);
 
-        List<Double> theCoords = new java.util.ArrayList<Double>();
-        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<Double> coords = new java.util.ArrayList<Double>(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<Color> colors = createGradientColors(gp);
 
         List<Double> 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 PSG
         List<Color> colors = createGradientColors(gp);
 
         List<Double> 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<Double> createGradientTransform(MultipleGradientPaint 
gradient) {

Modified: 
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=1609526&r1=1609525&r2=1609526&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java
 (original)
+++ 
xmlgraphics/fop/branches/FOP-2393_gradient-rendering/src/java/org/apache/fop/svg/PDFGraphics2D.java
 Thu Jul 10 17:51:53 2014
@@ -856,13 +856,13 @@ public class PDFGraphics2D extends Abstr
 
         List<Double> matrix = createGradientTransform(gp);
 
-        Point2D p1 = gp.getStartPoint();
-        Point2D p2 = gp.getEndPoint();
-        List<Double> theCoords = new java.util.ArrayList<Double>();
-        theCoords.add(new Double(p1.getX()));
-        theCoords.add(new Double(p1.getY()));
-        theCoords.add(new Double(p2.getX()));
-        theCoords.add(new Double(p2.getY()));
+        Point2D startPoint = gp.getStartPoint();
+        Point2D endPoint = gp.getEndPoint();
+        List<Double> coords = new java.util.ArrayList<Double>(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<Color> colors = createGradientColors(gp);
 
@@ -871,10 +871,9 @@ public class PDFGraphics2D extends Abstr
         //Gradients are currently restricted to sRGB
         PDFDeviceColorSpace colSpace = new 
PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
         PDFGradientFactory gradientFactory = new PDFGradientFactory(this);
-        PDFPattern myPat = gradientFactory.createGradient(false, colSpace, 
colors, bounds,
-                theCoords, matrix);
-        currentStream.write(myPat.getColorSpaceOut(fill));
+        PDFPattern pattern = gradientFactory.createGradient(false, colSpace, 
colors, bounds, coords, matrix);
 
+        currentStream.write(pattern.getColorSpaceOut(fill));
         return true;
     }
 
@@ -898,7 +897,6 @@ public class PDFGraphics2D extends Abstr
         double ar = gp.getRadius();
         Point2D ac = gp.getCenterPoint();
         Point2D af = gp.getFocusPoint();
-
         List<Double> theCoords = new java.util.ArrayList<Double>();
         double dx = af.getX() - ac.getX();
         double dy = af.getY() - ac.getY();
@@ -925,10 +923,9 @@ public class PDFGraphics2D extends Abstr
         //Gradients are currently restricted to sRGB
         PDFDeviceColorSpace colSpace = new 
PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
         PDFGradientFactory gradientFactory = new PDFGradientFactory(this);
-        PDFPattern myPat = gradientFactory.createGradient(true, colSpace, 
colors, bounds,
-                theCoords, matrix);
-        currentStream.write(myPat.getColorSpaceOut(fill));
+        PDFPattern pattern = gradientFactory.createGradient(true, colSpace, 
colors, bounds, theCoords, matrix);
 
+        currentStream.write(pattern.getColorSpaceOut(fill));
         return true;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to