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 Rolf Sigg <ro...@ergon.ch> on 2012/06/28 14:08:35 UTC

SVGGraphics2D omits certain java Arc2D input

Hi,

In our web application, we create dynamic pie charts with JFreeChart. 
Depending on the browser brand and version, we output bitmaps or SVG. 
The SVG code is produced by batik SVGGraphics2D.

We noticed that some pie charts were empty if rendered as SVG but 
showing correctly if rendered as a bitmap (using java 
BufferedImage.createGraphics()). After some investigation I found that 
for the faulty charts, batik produces SVG paths with elliptical arcs 
that have the same start- and end point. The SVG specification states 
that such arcs are omitted 
(http://www.w3.org/TR/SVG11/implnote.html#ArcOutOfRangeParameters). 
Therefore, the SVG renderers in the browsers (correctly) skip these path 
segments resulting in faulty chart display.

However, in the Graphics2D API it is ok to represent circles by arcs. 
Arc2D are defined by the bounding rectangle without restriction.

Since the input API of SVGGraphics2D is Graphics2D, I would expect batik 
to generate (visible) SVG representing every valid java input. Therefore 
I think this is a bug in SVGGraphics2D.

Do you agree? Do I miss something?

Regards
Rolf

P.S. Increasing the numeric precision may help in some situations. For 
me this may be a workaround, but not a solution.


-- 
rolf.sigg@ergon.ch, +41 44 268 89 00       http://www.ergon.ch
Ergon Informatik AG, Kleinstrasse 15, 8008 Zurich, Switzerland
______________________________________________________________
e r g o n         smart people - smart software


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


Re: SVGGraphics2D omits certain java Arc2D input

Posted by Rolf Sigg <ro...@ergon.ch>.
Am 29.06.2012 12:48, schrieb Thomas DeWeese:
>     A small standalone example would be a good first step.
>     Filing a bug with the example would be a great second step.

Ok, see https://issues.apache.org/bugzilla/show_bug.cgi?id=53486 
(includes standalone example).

Regards,
Rolf

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


Re: SVGGraphics2D omits certain java Arc2D input

Posted by Thomas DeWeese <th...@gmail.com>.
Hi Rolf,
   What you describe sounds like a plausible chain of events.

   A small standalone example would be a good first step.
   Filing a bug with the example would be a great second step.
   Providing a patch for the bug would be a fabulous third step.

   Thanks,
   Thomas

On Thu, Jun 28, 2012 at 8:08 AM, Rolf Sigg <ro...@ergon.ch> wrote:

> Hi,
>
> In our web application, we create dynamic pie charts with JFreeChart.
> Depending on the browser brand and version, we output bitmaps or SVG. The
> SVG code is produced by batik SVGGraphics2D.
>
> We noticed that some pie charts were empty if rendered as SVG but showing
> correctly if rendered as a bitmap (using java BufferedImage.createGraphics()
> **). After some investigation I found that for the faulty charts, batik
> produces SVG paths with elliptical arcs that have the same start- and end
> point. The SVG specification states that such arcs are omitted (
> http://www.w3.org/TR/SVG11/**implnote.html#**ArcOutOfRangeParameters<http://www.w3.org/TR/SVG11/implnote.html#ArcOutOfRangeParameters>).
> Therefore, the SVG renderers in the browsers (correctly) skip these path
> segments resulting in faulty chart display.
>
> However, in the Graphics2D API it is ok to represent circles by arcs.
> Arc2D are defined by the bounding rectangle without restriction.
>
> Since the input API of SVGGraphics2D is Graphics2D, I would expect batik
> to generate (visible) SVG representing every valid java input. Therefore I
> think this is a bug in SVGGraphics2D.
>
> Do you agree? Do I miss something?
>
> Regards
> Rolf
>
> P.S. Increasing the numeric precision may help in some situations. For me
> this may be a workaround, but not a solution.
>
>
> --
> rolf.sigg@ergon.ch, +41 44 268 89 00       http://www.ergon.ch
> Ergon Informatik AG, Kleinstrasse 15, 8008 Zurich, Switzerland
> ______________________________**______________________________**__
> e r g o n         smart people - smart software
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: batik-users-unsubscribe@**xmlgraphics.apache.org<ba...@xmlgraphics.apache.org>
> For additional commands, e-mail: batik-users-help@xmlgraphics.**apache.org<ba...@xmlgraphics.apache.org>
>
>