pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1868338 - /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
Date Sat, 12 Oct 2019 13:40:41 GMT
Author: tilman
Date: Sat Oct 12 13:40:41 2019
New Revision: 1868338

URL: http://svn.apache.org/viewvc?rev=1868338&view=rev
Log:
PDFBOX-4341: fix matrix setter (it only stored 6 values of the 3x3 matrix), by Emmeran Seehuber

Modified:
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java?rev=1868338&r1=1868337&r2=1868338&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDCalRGB.java
Sat Oct 12 13:40:41 2019
@@ -174,7 +174,18 @@ public class PDCalRGB extends PDCIEDicti
         COSArray matrixArray = null;
         if(matrix != null)
         {
-            matrixArray = matrix.toCOSArray();
+            // We can't use matrix.toCOSArray(), as it only returns a subset of the matrix
+            float[][] values = matrix.getValues();
+            matrixArray = new COSArray();
+            matrixArray.add(new COSFloat(values[0][0]));
+            matrixArray.add(new COSFloat(values[0][1]));
+            matrixArray.add(new COSFloat(values[0][2]));
+            matrixArray.add(new COSFloat(values[1][0]));
+            matrixArray.add(new COSFloat(values[1][1]));
+            matrixArray.add(new COSFloat(values[1][2]));
+            matrixArray.add(new COSFloat(values[2][0]));
+            matrixArray.add(new COSFloat(values[2][1]));
+            matrixArray.add(new COSFloat(values[2][2]));
         }
         dictionary.setItem(COSName.MATRIX, matrixArray);
     }



Mime
View raw message