xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Effect of shape-rendering property
Date Wed, 08 Nov 2006 11:10:45 GMT
Hi Stephen,

Stephen Drake <steve@drakenz.com> wrote on 11/06/2006 11:48:01 PM:

> I am creating svg documents that contain raster images, included with 
> <image> tag, and displaying them with Batik.  Some of the images are
> rotated, and I would like their edges to be anti-aliased against the
> background.  I tried setting shape-rendering="geometricPrecision" on the
> image element, but it doesn't seem to have any effect - on Mac OS X 10.4
> some of the edges are anti-aliased regardless and on Windows XP and 
> Edgy the edges are always jagged (I am using Batik trunk updated today).

   This is tricky, I consider this a bit of a bug in the JDK.
We do what we can to ensure that the images are anti-aliased but the
edges are not on the Sun JVM.   Part of the issue is also that
the image has a clip associated with it and the JVM's clipping code
is hard edged (although shape-rendering can convert that to anti-aliased).

> I tried three work-arounds:
> i) Apply a clip-path to the image.  This improves the appearance on 
> and Linux, but doesn't look as good as (ii) or (iii).  On OS X the edges 
> smooth, but horizontal and vertical lines appear, as if the image has 
> broken into tiles and not quite aligned properly.

   So the image is broken into tiles, but they are aligned properly.  I
suspect that the anti-aliasing you see on Mac OS X is causing the
tile edges to be visible even when they shouldn't be.

> ii)  Apply a mask to the image.  This looks great on Windows and Linux, 
> on OS X the "tiling" lines appear again, and the edges are a bit strange 
> it looks like gradients that would smooth the edge out have been applied 
> wrong way around, mirrored.

   Once again I suspect that the tiling lines are a side effect of 
anti-aliasing the images.  You might try changing the image-rendering
hint to see if this goes away.

> iii)  Draw a line over the edge of the image, the same colour as the
> background.  Draws nice smooth edges on all platforms, but gets tricky 
> the background is complex.
> The same behaviour applies to the svg element when the content exceeds 
> viewBox and overflow is hidden.  The example below demonstrates the 

   Another method to try would be to put the image with the mask in
a pattern and fill a rotated rect with that.  You might not even need
to mask the image in this case.

   Good luck!

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

View raw message