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 Archie Cobbs <ar...@dellroad.org> on 2005/04/15 00:20:18 UTC

New problem with SVGGraphics2D in 1.6

We're seeing a new problem in 1.6 with the SVGGraphics2D generator.

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.

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

If you change the "large-arc-flag" from "0" to "1" in the path
with color "rgb(50,255,50)", it looks correct again.

Before I go diving into the source code I thought I'd check with
the list if this problem rings a bell with anyone.

Thanks,
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

Re: New problem with SVGGraphics2D in 1.6

Posted by Archie Cobbs <ar...@dellroad.org>.
Thomas DeWeese 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.

(blush) Gosh, thanks :-)

>    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.

Great! I'll try it out and let you know if it doesn't fix the problem.

Thanks,
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

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


Re: New problem with SVGGraphics2D in 1.6

Posted by Archie Cobbs <ar...@dellroad.org>.
Thomas DeWeese wrote:
>    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.

Just reporting back .. this does in fact fix the problem.

Thanks!
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

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


Re: New problem with SVGGraphics2D in 1.6

Posted by Thomas DeWeese <Th...@Kodak.com>.
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: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org