Hi Ronald,

Ronald Paloschi <[email protected]> wrote on 12/03/2009 11:44:35 AM:

> So, my goal is to use batik inside my c++ application. How? What I 
> thought till now:
>    * We already have a C++ model defined (legacy, so we wont change 
that).
>    * My main goal is to tell batik to read an SVG and provide-me with 
>      the data so that I can manually convert it to my model.

> Now my questions:
>    * I realized that it uses a GVTBuilder class to generate GraphicsNode 

>      interface objects (now they are high level as I want).
>    * I would like to simply iterate this GraphicsNode objects and 
>      convertt them to my structures (a small layer tying Java and C++ 
worlds).
>    * I observed that all of this is done thinking about the screen (of 
>      course). Even the Shapes are the AWT shapes inside the ShapeNode 
objects 
>      for example. I think its acceptable since I dont care about this 
>      objects. I have my model.
>    * Basically I need a list of GraphicsNode objects and a class that 
>      provides this to me.

   If you take a look at the Wiki page "Boot SVG & CSS DOM":
        http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom

   You will see at the end of the sequence of code you have the
'rootGN'.  This is the top of the rendering tree for the document.
If you simply walk that tree (CompositeGraphicsNode provides
an interface to iterate over their children).

   Doing this to get the basic geometry will be fairly simple.
Where you are likely to run into problem is when you hit documents
that use more complex features of SVG, such as multi-stop gradients,
patters (the fill is defined by another rendering tree of SVG),
Masking, and Filters.

   Supporting all of that stuff will be a lot of work and I
suspect that your existing graphics model won't handle it all.

   Also this approach obviously makes it essentially impossible
to handle dynamic content.

   Anyway good luck!

Reply via email to