Hi apmatthews,

apm <[email protected]> wrote on 12/21/2008 08:53:36 PM:

> It is entirely possible that the heart of the issue lies in the SVGs I 
> am attempting to render.  However when I load this same SVG back into 
> Illustrator or The Gimp or any web browser it renders without the 
> vertical gaps.  Only with Batik do I get these anomalies.
> 
> This leads me to believe there is something unique in Batik's anti- 
> aliasing technique that, in this case, does not work to my favor.

   Batik simply uses the Java2D rendering engine, so there isn't a
lot we can do about this problem.  I've checked the various rendering
hints that we can set and they don't help.  I'll just mention that
as the SVG rendering requirements stand Batik's rendering is likely
fully conformant (rendering must be within 1px of the mathematically
correct value).

   The one thing that did help was building an 'Area' object for
the shape.  I don't want to put this in the main-line code as I
suspect it has very large performance implications (especially for
dynamic content) but it might be useful for you.  (see end of message).

> The only quick fix I can think of is to rasterize the SVG (with 
> crispEdges) at a very high resolution and then resize it to the 
> resolution I need using bicubic resampling from an image library to 
> get a pseudo-antialiased rendering.

   There is nothing pseudo-antialiasing about this, in fact the 
anti-aliasing renderers do is an approximation of this approach. 
This will generally give you better results (at the cost of much greater
CPU/Memory usage).

Index: sources/org/apache/batik/gvt/ShapeNode.java
===================================================================
--- sources/org/apache/batik/gvt/ShapeNode.java (revision 718310)
+++ sources/org/apache/batik/gvt/ShapeNode.java (working copy)
@@ -85,7 +85,8 @@
     public void setShape(Shape newShape) {
         fireGraphicsNodeChangeStarted();
         invalidateGeometryCache();
-        this.shape = newShape;
+        this.shape = new java.awt.geom.Area(newShape);
         if(this.shapePainter != null){
             if (newShape != null) {
                 this.shapePainter.setShape(newShape);

> On Dec 20, 2008, at 7:37 AM, Helder Magalhães wrote:
> 
> >> I have an SVG file:
> >> http://apmatthe.ws/svg/132g1.svg
> >
> >> therefore *any* help would be greatly appreciated.
> >
> > The file itself seems a bit broken. The shapes within the file don't
> > make much sense and there is a number of vertical lines which seem to
> > be causing this symptom. Try setting 'stroke="blue"' in the "main"
> > group ("g" element), which will highlight the contour of shapes, to
> > see what's going on...
> >
> > There have been a number of reports that the SVG export plug-in of
> > Adobe Illustrator has a few issues. Nevertheless, by looking at the
> > file, it seems as if someone had tried to vectorize a preexistent
> > file, due to the large number of weird curves (try zooming in a couple
> > of times). Is this the case? Are the shapes within the original file
> > correct?
> >
> > I'm not arguing about the geometric precision of Batik - I believe
> > this should be further investigated to check for a lack of precision
> > (in Batik or Illustrator?), possibly a content issue, etc...
> >
> > Finally, I've confirmed that using "crispEdges" seems to workaround
> > the issue. I'm using Java 6 update 7 on Windows XP SP3 and Squiggle of
> > both Batik 1.7 release and of the latest nightly build [1].
> >
> > Regards,
> >
> > Helder Magalhães
> >
> > [1] http://arc.mcc.id.au/batik-nightly/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: 
[email protected]
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

Reply via email to