You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Tonny Kohar <to...@kiyut.com> on 2006/02/22 03:47:57 UTC

Re: how i can convert a path into Its composer points by using batik ?

Hi,

On Fri, 2006-02-17 at 13:46 +0330, Legolas Woodland wrote:
> Can you please explain more , 
> I have an java.awt.shape object   , now i want to have a sequence of
> straight lines that create that shape , can you give me more details
> on , how i can achieve this ?
> I should say that , indeed i have SVGDocument and i build the above
> shape by using the document node.
> so if it is require i have the SVGdocument too.

If you already have java Shape object it will be simpler, just use
PathIterator

PathIterator pi = shape.getPathIterator(null)
float[] coords = new float[6];
        while (!pi.isDone()) {
            int segment = pi.currentSegment(coords);
            if (segment == PathIterator.SEG_MOVETO) {
                
            } else if (segment == PathIterator.SEG_CLOSE) {
                
            } else if (segment == PathIterator.SEG_LINETO) {
                
            } else if (segment == PathIterator.SEG_QUADTO) {
                
            } else if (segment == PathIterator.SEG_CUBICTO) {
                
            }
            pi.next();
        }

Please note, the above code is straight typing, probably have syntax
error, etc. Please check the Java API PathIterator doc for correct
syntax and other option like flatten

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


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