Hi Teck,

Teck Hua Lee <[email protected]> wrote on 05/10/2010 09:45:24 PM:

> http://markmail.org/message/znky4hbn76ytrdr5
> 
> Thomas DeWeese wrote: 
>> At any point you can get the generated subtree by calling 
>> 'svgg2d.getRoot(parent)'. So you can get the just generated element.
>> You can also look at extending the SVGGeneratorContext (see the web 
>> page for some examples). 

> Do I have to manually keep track of the "parent" element?

   The short answer is yes, but the question implies this represents
significant effort which it should not.  In theory you could pass the
same element to 'getRoot' every time, this would make finding the new
element(s) a little tricky so instead you might have two one you use
to get the new elements and then a second that you 'transfer' those
new elements to for later use.

> Do you think it would be helpful to include a getCurrentElement() 
> API on SVGGraphics2D?

   The problem is that a single draw operation can generate several
elements.  Some in the draw tree some in the 'defs' tree.  So adding
the ability to call 'getCurrentElement' would significantly impact
the quality of the generated SVG content in the more normal case of
just drawing a bunch of stuff you want to save as SVG (every draw 
operation would have to result in a 'stand-alone' subtree, which would
also probably mean needlessly introducing extra groups etc).

Reply via email to