You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Carsten Birn <Ca...@rose.de> on 2004/09/27 14:07:05 UTC
Re: Possible problem with SVGGraphics2D drawImage
Hi Thomas (And other)
I just wanted to say that the problem i previously mentioned is probably Javax.ImageIO related.
Whether it has to do with the loading or an error in the image reader, i couldn't determine.
All i know is after skipping ImageIO and assuring the complete load of the bitmap every thing worked fine.
So i am sorry about the mistake.
Thanks for a pretty cool piece of work (Batik).
Carsten Birn
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Possible problem with SVGGraphics2D drawImage
Posted by Carsten Birn <Ca...@rose.de>.
Hi
The problem with SVGGraphics2D was actually a small bug in the PNGImageEncoder.java.
Thanks to Thomas for finding out and the bugfix.
Everything now works perfect! :-)
Regards
Carsten Birn
> Hi Carsten,
>
> Carsten L. Birn wrote:
>
> > It looks like your patch is working :o)
> > The lines at the right of the images have disappeared.
>
> Good, I'll check the patch in then.
>
> > The bitDepth was probably the Joker here, because the encoder worked for
> > images loaded with toolkit.getImage(file).
>
> Yes, ImageIO appears to (quite properly) create a 1 bit/pixel
> image, which the PNG Encoder had a small bug with.
>
> > I am very very happy that the patch worked, because the use of ImageIo
> > is prefered due to its extensibility.
> > The hacks with the loading ( thread.sleep) can also be removed.
>
> There are better ways to handle loading properly, I pointed you
> at a class that you could use - which introduces a minimal amount
> of code ugliness.
>
> > So a lot of thanks for the investigation and solve.
>
> Thanks for raising the issue.
>
> BTW you might want to let the Batik mail-list know that this
> fixed your problem.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Possible problem with SVGGraphics2D drawImage
Posted by Thomas DeWeese <Th...@Kodak.com>.
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: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org