Hey Suresh,
I'm going to go ahead and CC inkscape-devel on my reply. That list, in general, is more likely to get you a timely e-mail than sending it directly to me. Plus it helps everyone learn together. I hope that's okay.
On Thu, 2012-05-10 at 03:14 -0700, $uresh... wrote:
Ted, I am using InkScape for vector drawing, mostly I will generated Vector graphics, generate svg file, and parse the file using C++ coding and load the final value to CNC machine. By default, when there is a group of object, by default matrix apply to only group not a single object, so in some complex drawing with group, group and sub group to find the object property I have to move to the parent group and apply the value to group, well this is time taking and in some big vector image, my binary hand and crash, because i traverse the svg, find the root parent and apply parent property to child object..
For ex.
Parent -> Child 1 (transform) -> child, in this case i need to traverse upto the child parent that is Child 1 and if there is any transform, I will strore it and apply it.
Now I want to find out how can reduce the whole method using some simple logic? Is there any way to simplified this process, so that i will have exact object property of that group.
In general, this is the way that SVG is structured, so that is how Inkscape represents it as well. What you're basically asking for is the rendered version that flattens the stack. I'm not sure exactly what you need as the final output, but if you could get it from the renderer directly that might be a solution for you. I'm not that familiar with the renderer code as it's been updated heavily recently, but if you think it might be, reply to the list with your questions.
If not, I'd recommend not going up the stack, but in fact down it and keeping the matrix transformations themselves in a stack. So then you effectively have a cache of last few matrices as you move down. Computing the entire stack for each object is much more costly.
Good luck! Ted