Hi Archie,

Archie Cobbs wrote:
We're seeing a new problem in 1.6 with the SVGGraphics2D generator.

Congratulations (of a sort), I think you are the first one to find an honest to goodness regression in Batik 1.6.

In 1.5 it worked fine, however with 1.6 a certain picture we're
generating contains a <path> with an arc, and the arc is getting
drawn in the wrong way. It appears that the "large-arc-flag"
is being sent as "0" when it should be "1" for this particular arc.

In 1.6 I added support for generating elliptical arc path commands for the Arc2D JDK object, previously they were output as a series of bezier curves.

I've attached an (abridged) example. If you look at this pie chart,
the big solid green chunk is drawn wrong.

I've attached a patch that should fix the problem, when the arc is drawn CW (negative extent angle) and is > 180 degrees the code wouldn't turn on the large-arc flag. This will go into CVS shortly, along with a few other changes that were pending the release.

Index: sources/org/apache/batik/svggen/SVGArc.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGArc.java,v
retrieving revision 1.1
diff -w -u -r1.1 SVGArc.java
--- sources/org/apache/batik/svggen/SVGArc.java 31 Oct 2004 11:21:30 -0000 1.1
+++ sources/org/apache/batik/svggen/SVGArc.java 14 Apr 2005 23:51:44 -0000
@@ -80,11 +80,19 @@
d.append(SPACE);
d.append("0"); // no rotation with J2D arc.
d.append(SPACE);
+ if (ext > 0) {
+ // CCW sweep case, ext > 0
if (ext > 180) d.append("1"); // use large arc.
else d.append("0"); // use small arc.
d.append(SPACE);
- if (ext > 0) d.append("0"); // sweep ccw
- else d.append("1"); // sweep cw
+ d.append("0"); // sweep ccw
+ } else {
+ // CW sweep case, ext < 0
+ if (ext < -180) d.append("1"); // use large arc.
+ else d.append("0"); // use small arc.
+ d.append(SPACE);
+ d.append("1"); // sweep cw
+ }


         d.append(SPACE);
         d.append(doubleString(endPt.getX()));

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to