xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Bad anti-aliasing?
Date Thu, 02 Mar 2006 14:57:28 GMT
Hi Anders,

Anders Straadt <aks@esoft.dk> wrote on 03/02/2006 08:30:38 AM:

> Cameron McCormack:
> > Try putting shape-rendering="geometricPrecision" on your root 'svg'
> > element.  That should solve the problem, I think.
> 
> That doesn't seem to make any difference. 

   It won't make any difference unless you also set this in the referenced
documents.

> Visually it still looks a lot like floating point values getting cast to 

> integers for some reason or another. The artifacts are not present when 
> I render on a Graphics2D object with no transform (plain identity 
matrix). 
> Artifacts appear when I scale it up and down.

   You two problems here.
        1) Non-uniform scaling of individual image elements.
        2) 'Drop outs' between tiles.

   Each image is scaled separately based on the Width/Height of
the image element and the Width/Height/viewBox of the referenced
SVG file.  So it is important that these exactly match or small
changes in scale can occur.

   For 2 I suspect the main culprit is the clip imposed by the image 
element.
You might try setting overflow="visible".

   This all said I think you will still have problems whenever a seam
lies 1/2 across a pixel.  When this happens on a line you will
get a fractional 'drop out'.  You need to understand how Anti-Aliasing
is implemented to see why this is the case.  Basically when a pixel
is fractionally covered (say because the line ends 1/2 way across the 
pixel) The renderer notes that the pixel is 1/2 covered.  Now you may
think that isn't a problem because the line from the other SVG file
will also cover the pixel 1/2 way - and this is true but the question is
what 1/2 of the pixel do each cover?  As it turns out the only workable
solution is to assume that they proportionally cover each other
(so 1/2 of each line covers 1/2 of the other line) leading to a
total coverage of only 75%.

   The best solution to this is to 'extend' the lines a bit so the
tiles overlap slightly - this however can have some other (generally
more subtle) artifacts of it's own (if the line is anti-aliased the
anti-aliasing will be double in the overlap region).

> Another thing worth mentioning is that I can zoom in (scale 
transformation) on
> the artifacts, any number of magnitude (until java2d gives a "bad path" 
> exception), and the artifacts are _not_ magnified. The gaps are still at 
most 
> 1 pixel wide, and the line widths (well, they're actually <rect> shapes 
in the
> SVG file) will still only differ by one pixel.

   This sounds like the clipping which is 'hard edged' (pushes to pixel 
boundary)

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


Mime
View raw message