You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Tonny Kohar <to...@kiyut.com> on 2015/05/19 07:05:49 UTC

Re: PATH SVG - retireve coordinates !

Hi,
> i have a little problem and i hope u help me !!
> 
> i'm rendering a path in a simple svgcanvas, and i wanna to retrieve
> the 
> its points.
> 
> for example - <path d="M 10 15 L 100 150 L 40 50 Z"/>, i wanna to 
> retrieve and to record each pair of coordinates, like "10 15", "100
> 150" and "40 50".

You could you SVG DOM API to achive that. especially SVGPathSegList
eg:

SVGPathSegList segList = svgPathElement.getSVGPathSegList();
for (int i=0; i<segList.getItemCount(); i++) {
	SVGPathSeg seg = segList.getItem(i);
	// check out for the type: eg: SVGPathSeg.PATHSEG_MOVETO_ABS, etc and
do casting where appropriate
	short type = seg.getPathSegType();
	// do whatever you want with the point
}

note: I just type the sample code above, maybe some method call is
wrong, just check the SVG DOM Api documentation for correct method call

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



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