pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r993443 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java
Date Tue, 07 Sep 2010 17:37:34 GMT
Author: lehmi
Date: Tue Sep  7 17:37:33 2010
New Revision: 993443

URL: http://svn.apache.org/viewvc?rev=993443&view=rev
Log:
PDFBOX-820: Added support for TIFF predictor 2. Patch by Timo Boehme (timo dot boehme at ontochem
dot com)

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java?rev=993443&r1=993442&r2=993443&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/FlateFilter.java Tue Sep  7
17:37:33 2010
@@ -257,9 +257,20 @@ public class FlateFilter implements Filt
                 {
                     case 2:// PRED TIFF SUB
                         /**
-                         * @todo decode tiff
+                         * @TODO decode tiff with bitsPerComponent != 8; e.g. for 4 bpc each
nibble must be subtracted separately
                          */
-                        throw new IOException("TIFF-Predictor not supported");
+                        if ( bitsPerComponent != 8 )
+                        {
+                    	  	throw new IOException("TIFF-Predictor with " + bitsPerComponent +
" bits per component not supported");
+                        }
+                        // for 8 bits per component it is the same algorithm as PRED SUB
of PNG format
+                      	for (int p = bpp; p < rowlength; p++)
+	                      {
+	                          int sub = actline[p] & 0xff;
+	                          int left = actline[p - bpp] & 0xff;
+	                          actline[p] = (byte) (sub + left);
+	                      }
+	                      break;
                     case 11:// PRED SUB
                         for (int p = bpp; p < rowlength; p++)
                         {



Mime
View raw message