Skip to main content

Re: SvgTranscoder question

  • From: Kirill Grouchnikov <kirillcool@...>
  • To: dev@...
  • Subject: Re: SvgTranscoder question
  • Date: Thu, 7 Aug 2008 10:56:50 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024;; h=Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=l1uaOR9CQHEGPLmwAXtGxweM7lPU3y5+whQitm2OTld6pMiuZldjyOPL27ghWNkS+aQwPZqxaxRdJC1f1jXYk7wp7+rlu+S22xnUjc57ze9t2vOdM9SVSnSlh36sKiXqSwTlg5QBFzntbo71XC27cQ7YJ9r5lKb8zVz9YPaQvsE=;
  • Mailing-list: contact dev-help@...; run by ezmlm

Glad that you have found a workaround, but i'm not sure where does the code in your example go.

If you're interested in contributing your extension back to the project (under BSD license), i'd be happy to see this code as a part of the SvgTranscoder class. Perhaps it would go somewhere into the main transcode() method? Or is this your implementation of the transcode() method?


----- Original Message ----
From: Elie Naulleau <semiosys@...>
To: dev@...
Sent: Thursday, August 7, 2008 10:30:55 AM
Subject: Re: SvgTranscoder question

Hi Kirill,

Thanks for your answer. You are right it is actually a Batik question. It seems that the Batik mailing list is host on a yahoo group, and I could not post there.

Actually I just found the solution
The trick was to declare "ctx.setDynamicState(BridgeContext.DYNAMIC); "
Otherwise the BridgeContext does not map GraphicsNodes with SVG DOM Nodes.

UserAgentAdapter ua = new UserAgentAdapter();
        userAgent = ua;
        loader = new DocumentLoader(userAgent);
        ctx = new BridgeContext(userAgent, loader);

        GVTBuilder builder = new GVTBuilder();
        Document svgDoc;
        try {
            svgDoc = loader.loadDocument(this.uri);
            System.out.println("Building: " + this.uri);
            GraphicsNode gvtRoot =, svgDoc);
            transcodeGraphicsNode(gvtRoot, "");
        } catch (IOException ex) {
            Logger.getLogger(SVGCustomTranscoder.class.getName()).log(Level.SEVERE, null, ex);

Kirill Grouchnikov a écrit :

In the future i would suggest mailing to the "users" list since that is a more active place.

To your question - i think that it might be better addressed to the Batik developers. It has been quite some time since i've written the SvgTranscoder, and looking in the debugger i don't see any relevant information in the ShapeNode or its ancestors to link back to the original SVG DOM. This might be by Batik's design since sometimes a single SVG construct is transcoded into multiple Java2D nodes. But you'd be much better off asking this question in the Batik lists.

This is not specific to Flamingo's transcoder - that would apply to any application that registers a GVTTreeBuilderListener on a JSVGCanvas and examines the GVT root in the gvtBuildCompleted event.


----- Original Message ----
From: Elie Naulleau <semiosys@...>
To: dev@...
Sent: Thursday, August 7, 2008 3:53:32 AM
Subject: SvgTranscoder question

Hi all,

I am extending SvgTranscoder into a SVGCustomTranscoder for the
following purpose :

I need to be able to access the generated java2D shapes, through an
array of a map for instance.

so each time we have a
shape = new Something();
I want to add
map.put( shapeId, shape);

Indeed, the initial SVG file is going to be defined by hand, specifiying
for each shape a unique id. Inkscape allow this very well.

<rect  id="myId001" width="174.28572"  height="60"  x="54.285713" 

So my question is : how to retrieve the initial SVG node id when
SvgTranscoder uses batik ShapeNode (derived from AbstractGraphicsNode).

ShapeNode seems to have lost any reference to the SVG Dom Node (?)

Any hint ?

Thank you,

To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...

SvgTranscoder question

Elie Naulleau 08/07/2008

<Possible follow-up(s)>

Re: SvgTranscoder question

Kirill Grouchnikov 08/07/2008

Re: SvgTranscoder question

Elie Naulleau 08/07/2008

Re: SvgTranscoder question

Kirill Grouchnikov 08/07/2008
Please Confirm