Re: SVG which renders in 1.7 fails in 1.8pre

Joel Uckelman <[email protected]>
Newsgroups gmane.text.xml.batik.user
Message-ID <[email protected]>
Thus spake DeWeese Thomas:
> Hi Joel,
> 	I suspect that you are missing some of the SPI files in the jar =
> file you are building from 1.8pre.
> Do you have the files from resources/META-INF/services/* in your jar =
> files?
> These may not have been needed in 1.7 (since defaults were included).
> 
> 	Thomas

In batik-codec.jar:

  META-INF/services/org.apache.batik.ext.awt.image.spi.ImageWriter
  META-INF/services/org.apache.batik.ext.awt.image.spi.RegistryEntry

In batik-extension.jar:

  META-INF/services/org.apache.batik.bridge.BridgeExtension
  META-INF/services/org.apache.batik.dom.DomExtension

In batik-script.jar:

  META-INF/services/org.apache.batik.script.InterpreterFactory

So it looks like I have the resources files in JARs on my classpath
(except the resource file for Squiggle, which I assume is not necessary
for anything but Squiggle.)

I also have a short test case now which exhibits the problem for me:


import java.awt.image.BufferedImage;
import java.io.File;

import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;

public class Test {
  private static class Rasterizer extends ImageTranscoder {
    public BufferedImage createImage(int w, int h) {
      return new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    }

    public void writeImage(BufferedImage img, TranscoderOutput output) {
    }
  }

  public static void main(String[] args) throws Exception {
    final String uri = new File(args[0]).toURI().toString();
    final Rasterizer r = new Rasterizer();
    r.transcode(new TranscoderInput(uri), new TranscoderOutput());
  }
}

Here's the command line:

java -cp lib/batik-anim.jar:lib/batik-awt-util.jar:lib/batik-bridge.jar:lib/batik-codec.jar:lib/batik-css.jar:lib/batik-dom.jar:lib/batik-ext.jar:lib/batik-extension.jar:lib/batik-gui-util.jar:lib/batik-gvt.jar:lib/batik-parser.jar:lib/batik-rasterizer-ext.jar:lib/batik-script.jar:lib/batik-svg-dom.jar:lib/batik-svggen.jar:lib/batik-swing.jar:lib/batik-transcoder.jar:lib/batik-util.jar:lib/batik-xml.jar:lib/xerces_2_5_0.jar:lib/xml-apis.jar:lib/xml-apis-ext.jar:. Test tmp/images/Ottoman_hand.svg

Here's the exception:

org.apache.batik.bridge.BridgeException: file:/home/uckelman/projects/VASSAL/VASSAL-src/tmp/images/Ottoman_hand.svg:0
The URI "data:image/png;base64,iVBORw0KG
...
5Cc6 P3b8DhjQm/8Dgk9CDmp9DwIAAAAASUVORK5CYII= "
on element <image> can't be opened because:
URL data in unsupported format or corrupt
  at org.apache.batik.bridge.UserAgentAdapter.getBrokenLinkDocument(Unknown Source)
  at org.apache.batik.bridge.SVGImageElementBridge.createRasterImageNode(Unknown Source)
  at org.apache.batik.bridge.SVGImageElementBridge.createImageGraphicsNode(Unknown Source)
  at org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(Unknown Source)
  at org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(Unknown Source)
  at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
  at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
  at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
  at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
  at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
  at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
  at Test.main(Test.java:23)
Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
file:/home/uckelman/projects/VASSAL/VASSAL-src/tmp/images/Ottoman_hand.svg:0
The URI "data:image/png;base64,iVBORw0KGgoAAAANSUhE
...
5Cc6 P3b8DhjQm/8Dgk9CDmp9DwIAAAAASUVORK5CYII= "
on element <image> can't be opened because:
URL data in unsupported format or corrupt
  at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
  at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
  at Test.main(Test.java:23)

Here's the test SVG:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Ottoman_hand.svg (image/svg+xml, 6.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.