You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Trejkaz (JIRA)" <ji...@apache.org> on 2014/06/26 12:34:24 UTC
[jira] [Comment Edited] (BATIK-1077) ArrayIndexOutOfBoundsException
in AbstractWMFPainter.getImage for 8-bit image inside WMF
[ https://issues.apache.org/jira/browse/BATIK-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14044551#comment-14044551 ]
Trejkaz edited comment on BATIK-1077 at 6/26/14 10:33 AM:
----------------------------------------------------------
Stack trace from trunk build as of right now:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 9064
at org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(Unknown Source)
at org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(Unknown Source)
at org.apache.batik.transcoder.wmf.tosvg.WMFPainter.paint(Unknown Source)
{noformat}
Also the other issue said it was specifically about 1-bit WMFs and this one is not 1-bit.
Test program used:
{code:java}
import org.apache.batik.transcoder.wmf.tosvg.WMFPainter;
import org.apache.batik.transcoder.wmf.tosvg.WMFRecordStore;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.DataInputStream;
import java.io.FileInputStream;
public class Test {
public static void main(String[] args) throws Exception {
WMFRecordStore store = new WMFRecordStore();
store.read(new DataInputStream(new FileInputStream("test.wmf")));
WMFPainter painter = new WMFPainter(store, 100.0f);
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
painter.paint(graphics);
}
}
{code}
was (Author: trejkaz):
Stack trace from trunk build as of right now:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 9064
at org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(Unknown Source)
at org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(Unknown Source)
at org.apache.batik.transcoder.wmf.tosvg.WMFPainter.paint(Unknown Source)
{noformat}
Also the other issue said it was specifically about 1-bit WMFs and this one is not 1-bit.
> ArrayIndexOutOfBoundsException in AbstractWMFPainter.getImage for 8-bit image inside WMF
> ----------------------------------------------------------------------------------------
>
> Key: BATIK-1077
> URL: https://issues.apache.org/jira/browse/BATIK-1077
> Project: Batik
> Issue Type: Bug
> Components: Utilities
> Reporter: Trejkaz
> Attachments: test.wmf
>
>
> I get this error trying to get an image for a WMF.
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 9064
> at org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(AbstractWMFPainter.java:162)
> at org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(AbstractWMFPainter.java:74)
> at org.apache.batik.transcoder.wmf.tosvg.WMFPainter.paint(WMFPainter.java:837)
> {noformat}
> I had a quick look already.
> 28 00 00 00 = header size (40 bytes)
> c0 00 00 00 = width of image (192)
> 2f 00 00 00 = height of image (47)
> 01 00 = number of planes (1)
> 08 00 = bits per pixel (8)
> 00 00 00 00
> 40 23 00 00 = size of the image (9024)
> 00 00 00 00
> 00 00 00 00
> 00 00 00 00 = number of used colours (0, meaning "use all of them")
> 00 00 00 00 <- end of header (40th byte)
> 192 (width) x 47 (height) x 1 (bytes per pixel) x 1 (planes) = 9024
> Header = 40 bytes
> Palette = 256 bytes (2^8 because it's 8 bits per pixel)
> Size of image = 9024 bytes (from calculation above)
> Total size = 9320 > 9068 bytes available data
> Despite these calculations seeming to show that the image is invalid, it does open in OpenOffice perfectly fine, leading me to wonder how they are doing that...
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org