SVG can’t be constructed because file is corrupted, and tons of chars for you
Posted: 24 April 2012 08:13 AM   [ Ignore ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

Hi there,

I’ve found a new problem in my footage with MT4j. For loading SVG files, I’ve been taking a look at the svg example, and defined this function:

private MTSvg constructSVG(final String fileName, final float xPos,
            final 
float yPos, final float width, final float height{
        
final MTSvg ret = new MTSvg(this.mtApp"data"
                
MTApplication.separator fileName ".svg");
        
ret.setPositionGlobal(new Vector3D(xPosyPos0));
        
// if ((width != 0) && (height != 0)) {
        // ret.setWidthXYGlobal(width);
        // ret.setHeightXYGlobal(height);
        // } else if (width != height) {
        // throw new IllegalArgumentException(
        // "Invalid arguments for method constructSVG in class StateGraph.\nWidth - "
        // + width + "\nHeight - " + height
        // + "\nExpected pair of zeros or non-zero values.");
        // }
        
return ret;
    
}

And then in the constructor:

sc.getCanvas().addChild(
                
this.constructSVG("banner_netaurant",
                        
this.horizontalTransform(878), 000));

But then I get the most strange exception I’ve ever seen:

The URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPUAAAAZCAYAAADpN2icAAAACXBIWXMAAAsSAAALEgHS3X78AAAA GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAE/1JREFUeNrsnGlwHMd1x/8ze9+L xbXESfASQYAUScmiFdmWHEWybFUOuypR4qocH2K74tKHpMqplMtxDlcl+RD7W5z4Q2IlkRMrSlkV q3Q5OiiJEkmJpMQbJAjwAHFjgb3v3Zn8u2dmMQuAUmxSDiu1zXo1s9PX697+9Xuvd0AFwAOUg2il Vmql2yopLie80QjC0SiibW1S2kyJmFeZR4lQfH4/FOB1Z2vqWqmVbmOYBbAmwBLqWEyKHXBRLhwO w0+odda/CahHKH9NCVNqlFcp36FU15TbSvlDyg6Ki1KkHKf8DaXU+gZbqZUkyQpUrxs+wikhjUTW W2YT6JgNbAG9KO/1BpDP6Uiu5G8G6gsmrL9OeZSyn/Iw5fk15a5SvkW5n/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ElFTkSuQmCC"
on element <imagecan't be opened because:
URL data in unsupported format or corrupt
    at org.apache.batik.bridge.UserAgentAdapter.getBrokenLinkDocument(UserAgentAdapter.java:449)
    at org.apache.batik.bridge.SVGImageElementBridge.createRasterImageNode(SVGImageElementBridge.java:604)
    at org.apache.batik.bridge.SVGImageElementBridge.createImageGraphicsNode(SVGImageElementBridge.java:327)
    at org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(SVGImageElementBridge.java:177)
    at org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(SVGImageElementBridge.java:119)
    at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213)
    at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
    at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
    at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
    at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
    at org.mt4j.util.xml.svg.SVGLoader.parseSvg(SVGLoader.java:309)
    at org.mt4j.util.xml.svg.SVGLoader.loadSvg(SVGLoader.java:254)
    at org.mt4j.components.visibleComponents.widgets.MTSvg.<init>(MTSvg.java:80)
    at tableApp.StateGraph.constructSVG(StateGraph.java:140)
    at tableApp.StateGraph.<init>(StateGraph.java:42)
    at tableApp.MenuGraph.<init>(MenuGraph.java:27)
    at tableApp.InstanceScene.<init>(InstanceScene.java:12)
    at tableApp.MainClass$InnerMTApplication.startUp(MainClass.java:70)
    at org.mt4j.MTApplication.setup(MTApplication.java:490)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.core.PApplet.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

What is it due to?

Profile
 
 
Posted: 27 April 2012 05:04 AM   [ Ignore ]   [ # 1 ]
Avatar
RankRankRankRank
Joined  2008-04-30
Total Posts:  612
Elite

Try to load and save the svg in another program or svg file version/protocol (e.g. Inkscape). But keep in mind that not all and every SVG fetaure is supported. The error seems to stem from the <image> object which usually links to another bitmap file included in the svg. That is not supported. Maybe you dont need to use svg and could just save the svg as a bitmap image and use that in your application.

 Signature 

MT4j - Multi-Touch for Java!

Profile
 
 
Posted: 27 April 2012 05:20 AM   [ Ignore ]   [ # 2 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

I had been performing some tests and they look exactly like what you’re saying. My proceed to create the SVG was create them as psd in Photoshop and then, with Illustrator, open and save them as SVG. But that causes this exception to be thrown, most likely because of the features of the PSD or something like that I guess. I wanted to make some more tests to confirm this before posting my conclusions for future people facing this same problem, but your reply is the best confirmation rasberry

Thanks,

Greetings.

Profile