The SVG rect element makes x, y, width & height available as SVG Animated 
lengths.  These are a bit more complex but can be used for this.



On Jun 22, 2012, at 8:12 AM, m...@mherrn.de wrote:

> Hi Thomas,
> 
>>> final Element element= document.createElement("rect");
>> 
>>    This creates a 'rect' element in the no name namespace.
>> I think you want to use createElementNS with the SVG Namespace.
>> If you are using a Batik SVGDocument then this will return an
>> SVGRectElement.
> 
> Yes, actually I am doing it that way and just ommited it from my example.
> I didn't know that batik actually creates an SVGRectElement out of it.
> So it is enough to just cast the created element to the relevant
> interface? e.g.:
> 
> final SVGRectElement rect= (SVGRectElement) document.createElementNS(ns,
> "rect");
> 
> But that gives me an SVGRectElement that has the getters for the specific
> attributes. Is there a way to get a class that provides the setters as in
> my second (hypothetical) example?:
> 
> -------------------------/--------------------------
> final SVGRect rectElement= ..... //create the element
> rectElement.setX(10);
> rectElement.setY(10);
> rectElement.setWidth(100);
> rectElement.setHeight(100);
> document.getDocumentElement().appendChild(rectElement);
> -------------------------/--------------------------
> 
>> Make sure you read about booting the CSS and
>> SVG DOM on the Wiki, otherwise some of the more advanced SVG
>> methods won't work (also the element needs to be part of the SVG
>> tree for some of those methods to work).
> 
> I will have a look at the wiki again. Quite possible that I have
> overlooked some important info there.
> 
> 
> Thanks and regards
> Marco
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Reply via email to