Hi Carsten,

   I actually suspect the problem was/is in the PNG encoder.  I've
attached a potential patch.  It would be great if you could apply
the change and see if this fixes your original problem.


Index: sources/org/apache/batik/ext/awt/image/codec/PNGImageEncoder.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/codec/PNGImageEncoder.java,v
retrieving revision 1.9
diff -w -u -r1.9 PNGImageEncoder.java
--- sources/org/apache/batik/ext/awt/image/codec/PNGImageEncoder.java 18 Aug 2004 07:13:52 -0000 1.9
+++ sources/org/apache/batik/ext/awt/image/codec/PNGImageEncoder.java 29 Sep 2004 11:03:25 -0000
@@ -371,15 +371,16 @@
int val = clamp(samples[s] >> bitShift, maxValue);
tmp = (tmp << bitDepth) | val;


-                    if ((pos++ & mask) == mask) {
+                    if (pos++  == mask) {
                         currRow[count++] = (byte)tmp;
                         tmp = 0;
+                        pos = 0;
                     }
                 }

                 // Left shift the last byte
-                if ((pos & mask) != 0) {
-                    tmp <<= ((8/bitDepth) - pos)*bitDepth;
+                if (pos != 0) {
+                    tmp <<= (samplesPerByte - pos)*bitDepth;
                     currRow[count++] = (byte)tmp;
                 }
                 break;


Carsten Birn wrote:

Thanks for a pretty cool piece of work (Batik).

Thanks for the thanks!


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to