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 Sujesh Babu N <su...@gmail.com> on 2006/10/25 14:17:35 UTC

Converting elliptical Arc to Curve

Hi ,

I am a java developer new to Batik . I am working on an application , which
converts SVG to SVG tiny. SVG tiny wont support elliptical arc command . Is
there any function/mechanism available to convert elliptical arc to curve in
Batik ?

i am trying the following way ..
//getting the path data
String pathData = path.getAttribute("d");
ExtendedGeneralPath egp = null;
ExtendedGeneralPath newPath=new ExtendedGeneralPath();
try {
 //creating the path
 egp = (ExtendedGeneralPath) AWTPathProducer.createShape(
   new StringReader(pathData), 0);
} catch (ParseException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
} catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}
ExtendedPathIterator pathIterator = egp
  .getExtendedPathIterator();

// Iterating through the path
while (!pathIterator.isDone()) {
    // construct new path , on the way ,
    //try to convert elliptical arc to corresponding curve commands

}

any help will be appreciated , thanks in advance .

Best Regards
Sujesh

Re: Converting elliptical Arc to Curve

Posted by th...@kodak.com.
Hi Sejush,

     Answers below,

"Sujesh Babu N" <su...@gmail.com> wrote on 10/25/2006 
08:17:35 AM:

> I am a java developer new to Batik . I am working on an application , 
which 
> converts SVG to SVG tiny. SVG tiny wont support elliptical arc command . 
Is 
> there any function/mechanism available to convert elliptical arc to 
curve in Batik ? 

> i am trying the following way ..

    The code up to here looks good...

> ExtendedPathIterator pathIterator = egp
>   .getExtendedPathIterator();

    I think if you just use:
        PathIterator pathIter = egp.getPathIterator(null);

    The returned PathIterator will not include any elliptical
arc commands.

> // Iterating through the path
> while (!pathIterator.isDone()) {
>     // construct new path , on the way , 
>     //try to convert elliptical arc to corresponding curve commands
> 
> }

   You only need to support the SEG_* types from:
http://java.sun.com/j2se/1.3/docs/api/java/awt/geom/PathIterator.html


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