xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TJ Teegan" <tjtee...@hotmail.com>
Subject RE: Modifying path elements.
Date Tue, 07 Dec 2004 18:37:18 GMT
Hello,

I am pretty sure you have to set the path's entire "d" attribute, even if 
you only want to change one point.

The only way I know how to do this in Batik looks something like this:

//Get the element to modify, there are a number of ways to do this, here is 
one
SVGDocument svgDoc = svgCanvas.getSVGDocument();
Element myPath = svgDoc.getElementById("myPath");

//Get the attribute to modify
String currentD = myPath.getAttributeNS(null, "d");

/*
*Provide some code to change the point, store the result in String newD
*/

//Set the new attribute
myPath.setAttributeNS(null, "d", newD);

I am not sure if this is the most efficient way to set an attribute, but it 
works.

Depending on what you are doing you may have to do this through your canvas' 
update thread to see the results.  For more information on that see 
http://xml.apache.org/batik/javaScripting.html#Threads

Sorry if this is alot of information you already know, hopefully some of it 
is helpful.

Good luck,
TJ Teegan


>From: Fernando Mendez <Fernando.Mendez@enst.fr>
>Reply-To: "Batik Users" <batik-users@xml.apache.org>
>To: Batik Users <batik-users@xml.apache.org>
>Subject: Modifying path elements.
>Date: Tue, 07 Dec 2004 16:54:41 +0100
>
>Hello,
>I am trying to modify path elements, and now, in order to modify a single 
>point I rewrite the whole d attribute for the path. Is there a way to 
>modify only one point in the path without having to rewrite it completely?
>
>Thanks in advance for all your help and attention.
>Fernando MENDEZ.
>ENST - PARIS
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>

_________________________________________________________________
Donít just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message