Author: ssteiner
Date: Fri Dec 21 09:46:17 2018
New Revision: 1849454

URL: http://svn.apache.org/viewvc?rev=1849454&view=rev
Log:
FOP-2836: Update PDFBox to 2.0.13

Added:
    xmlgraphics/fop-pdf-images/trunk/lib/fontbox-2.0.13.jar   (with props)
    xmlgraphics/fop-pdf-images/trunk/lib/pdfbox-2.0.13.jar   (with props)
Removed:
    xmlgraphics/fop-pdf-images/trunk/lib/fontbox-2.0.11.jar
    xmlgraphics/fop-pdf-images/trunk/lib/pdfbox-2.0.11.jar
Modified:
    
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PSPDFGraphics2D.java
    xmlgraphics/fop-pdf-images/trunk/xmlgraphics-pdfimages-pom-template.pom

Added: xmlgraphics/fop-pdf-images/trunk/lib/fontbox-2.0.13.jar
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/lib/fontbox-2.0.13.jar?rev=1849454&view=auto
==============================================================================
Binary file - no diff available.

Propchange: xmlgraphics/fop-pdf-images/trunk/lib/fontbox-2.0.13.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: xmlgraphics/fop-pdf-images/trunk/lib/pdfbox-2.0.13.jar
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/lib/pdfbox-2.0.13.jar?rev=1849454&view=auto
==============================================================================
Binary file - no diff available.

Propchange: xmlgraphics/fop-pdf-images/trunk/lib/pdfbox-2.0.13.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: 
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PSPDFGraphics2D.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PSPDFGraphics2D.java?rev=1849454&r1=1849453&r2=1849454&view=diff
==============================================================================
--- 
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PSPDFGraphics2D.java
 (original)
+++ 
xmlgraphics/fop-pdf-images/trunk/src/java/org/apache/fop/render/pdf/pdfbox/PSPDFGraphics2D.java
 Fri Dec 21 09:46:17 2018
@@ -62,6 +62,7 @@ import org.apache.pdfbox.pdmodel.graphic
 import org.apache.pdfbox.pdmodel.graphics.shading.AxialShadingPaint;
 import org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingContext;
 import org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingPaint;
+import org.apache.pdfbox.pdmodel.graphics.shading.ShadingPaint;
 import org.apache.pdfbox.util.Matrix;
 
 import org.apache.xmlgraphics.image.loader.ImageInfo;
@@ -120,7 +121,7 @@ public class PSPDFGraphics2D extends PSG
                 try {
                     AxialShadingContext asc = (AxialShadingContext) 
paintContext;
                     float[] fCoords = asc.getCoords();
-                    transformCoords(fCoords, paint, true);
+                    transformCoords(fCoords, (ShadingPaint) paint, true);
                     PDFunction function = asc.getFunction();
                     Function targetFT = getFunction(function);
                     if (targetFT != null) {
@@ -141,7 +142,7 @@ public class PSPDFGraphics2D extends PSG
                 try {
                     RadialShadingContext rsc = (RadialShadingContext) 
paintContext;
                     float[] fCoords = rsc.getCoords();
-                    transformCoords(fCoords, paint, false);
+                    transformCoords(fCoords, (ShadingPaint) paint, false);
                     PDFunction function = rsc.getFunction();
                     Function targetFT3 = getFunction(function);
                     List<Double> dCoords = floatArrayToDoubleList(fCoords);
@@ -196,25 +197,16 @@ public class PSPDFGraphics2D extends PSG
         return rectangle;
     }
 
-    private void transformCoords(float[] coords, Paint paint, boolean 
axialShading) {
-        try {
-            Field f = paint.getClass().getDeclaredField("matrix");
-            f.setAccessible(true);
-            Matrix ctm = (Matrix) f.get(paint);
-            AffineTransform at = ctm.createAffineTransform();
-            if (axialShading) {
-                at.transform(coords, 0, coords, 0, 2);
-            } else {
-                at.transform(coords, 0, coords, 0, 1);
-                at.transform(coords, 3, coords, 3, 1);
-                coords[2] *= ctm.getScalingFactorX();
-                coords[5] *= ctm.getScalingFactorX();
-            }
-
-        } catch (NoSuchFieldException e) {
-            throw new RuntimeException(e);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(e);
+    private void transformCoords(float[] coords, ShadingPaint paint, boolean 
axialShading) {
+        Matrix ctm = paint.getMatrix();
+        AffineTransform at = ctm.createAffineTransform();
+        if (axialShading) {
+            at.transform(coords, 0, coords, 0, 2);
+        } else {
+            at.transform(coords, 0, coords, 0, 1);
+            at.transform(coords, 3, coords, 3, 1);
+            coords[2] *= ctm.getScalingFactorX();
+            coords[5] *= ctm.getScalingFactorX();
         }
     }
 

Modified: 
xmlgraphics/fop-pdf-images/trunk/xmlgraphics-pdfimages-pom-template.pom
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/xmlgraphics-pdfimages-pom-template.pom?rev=1849454&r1=1849453&r2=1849454&view=diff
==============================================================================
--- xmlgraphics/fop-pdf-images/trunk/xmlgraphics-pdfimages-pom-template.pom 
(original)
+++ xmlgraphics/fop-pdf-images/trunk/xmlgraphics-pdfimages-pom-template.pom Fri 
Dec 21 09:46:17 2018
@@ -80,12 +80,12 @@ http://maven.apache.org/xsd/maven-4.0.0.
     <dependency>
       <groupId>org.apache.pdfbox</groupId>
       <artifactId>pdfbox</artifactId>
-      <version>2.0.11</version>
+      <version>2.0.13</version>
     </dependency>
     <dependency>
       <groupId>org.apache.pdfbox</groupId>
       <artifactId>fontbox</artifactId>
-      <version>2.0.11</version>
+      <version>2.0.13</version>
     </dependency>
    </dependencies>
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org

Reply via email to