Re: Convert path arcs to cubic splines?

Mark McKay wrote:

> I have looked at Batik.  They deal with th eproblem by implementing a 
> completely new general path that uses actual arcs to draw the arcs.

    No it simply stores the arc info so that it doesn't get markers
wrong:

http://svn.apache.org/viewcvs.cgi/*checkout*/xmlgraphics/batik/trunk/samples/tests/spec/painting/markersExt.svg

    All the drawing is done via the contained GeneralPath.

> (GerenalPath is frusteratingly declared final)  This is quite a bit 
> different from converting arcs to splines.  

    Take a closer look, in particular the 'computeArc' class that
calculates an Arc2D which when added to a GeneralPath is converted
to cubics for you.

> From what I remember, ExtendedGeneralPath also has a whole lot 
> of dependancies.  I'd prefer to simply come up with the 
> arc/spline aproximation if I can.
> 
> Also, this is for my SVG Salamander viewer, which does a lot of what 
> Batik does, plus animation.   Everything is in place for paths except 
> for arcs.  http://svgsalamader.java.dev.net.

    Good luck!

> 
> Mark McKay
> 
> 
> 
> Thomas DeWeese wrote:
> 
>> Hi Mark,
>>
>>    You might want to look at the Apache Batik project:
>>     http://xml.apache.org/batik
>>
>>    It includes a class called 'ExtendedGeneralPath' that
>> wraps a standard GeneralPath and supports all of the SVG
>> draw commands.  Batik also includes a parser for the
>> path syntax which might be helpful.  In general if you want
>> to do something with SVG in Java you should look carefully
>> at Batik.
>>
>> http://svn.apache.org/viewcvs.cgi/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/ 
>>
>>
> 
> 
> 

Received on Saturday, 6 August 2005 19:17:40 UTC