On Tue, 8 Jun 2004, Julien Keable wrote:
Thanks for the quick reply. I looked into SVG.pm and found no way to 1- load and 2- apply transformations to existing objects. Most important, I forgot to mention all this must be done in real time (~25fps) sparing the cpu as much as possible, so using perl is not an option (yes, I know about SVG animation but I can't use it... read on).
Ah, yes, in that circumstance SVG.pm wouldn't work for what you need. Have you tried using Cairo? Perhaps that is better suited?
Ok, it's time to clarify things a bit :
I have an app that has it's own GUI. Basically, you connect modules together, building a dataflow graph with the nodes acting as filter/generators/renderers, and the connections carrying pieces of SVG information. Here's an example :
[square generator] --------> [rotate] --------> [renderer] ^ | [some changing control value] -|
when the graph is complete you press play and watch.
I already know about the concept SVG animations, however I cannot rely on them since the animation speed is fixed (eg : I want to be able to, say, rotate a box at a speed that is a sinusoidal wave, not constant). This kinda clashes with my concept of animation, but anyway... So what I want to do is animate with API calls like
setRotationAngle(MyBox, sin(time) ) (or myBox.setRotationAngle..... )
I think I said enough so you can tell me if using inkscape would be appropriate, and if so could you answer these questions please :
- am I correct when I assume inkscape already has all the API calls I'm
looking for ?
It does have calls for performing manipulations like this, yes, but it would not really be honest to describe them as API's. There is no interface document, nor ways to easily access the calls external from Inkscape. So unfortunately the best answer would be, "No, not without a lot of digging..."
- how is the internal representation of the graphical objects organised
? As an XML document would be ? A tree?
Yes, and in fact this internal representation is one of the codebases' very interesting features. It is implemented as a DOM 'repr' that contains everything in an object tree, including attributes and references. It's quite sophisticated and powerful. There is some documentation about this but not nearly as much as one would need.
- how to strip the GUI part from the core of inkscape ?
Mental and Nathan have tried stripping the GUI part off of it once before; they'd be the best to answer this. As I understand it, there is not a sufficiently clean separation between the interface and the renderer to make this trivial, but it did not sound impossible.
- when inkscape moves to cairo for rendering, will it use glitz ? if
not, why so?
I don't know; Mental might know, but to be honest we haven't dug very far into investigating Cairo yet. If you choose to use Cairo we'd be very interested in hearing about your experiences with it.
Bryce