https://issues.apache.org/bugzilla/show_bug.cgi?id=47555





--- Comment #3 from Thomas Deweese <[email protected]>  2009-07-21 18:11:43 
PST ---
The 'fully' transparent bottom pixels is caused by the implicit
clip path of the root SVG element (try adding 'overflow="visible"').

Clip path's in SVG are generally 'hard edged' so the clip either
needs to be at '11' or at '12'.  The G2D rasterizer decides on 11,
the rasterizer rounds to the nearest pixel.

At the same time the ImageTranscoder rounds the width and height to
the nearest integer (12).

The issue here is that if one were to change the ImageTranscoder
to always round down, then someone would complain that we cut off
their 1 pixel high stroke around the image because it only
covered .99 of the bottom pixel, etc.

A perhaps better solution would be to integerize the width and
height before applying the viewing transform then you could 
allow for the slightly non-uniform scaling needed to perfectly
align your viewbox with the pixel grid with the preserveAspectRatio
attribute:

<svg xmlns="http://www.w3.org/2000/svg"; height="10" width="19"
     viewBox="0 0 19 10" preserveAspectRatio="none">
<rect width="19" height="10" fill="lime"/>
</svg>

Index: sources/org/apache/batik/transcoder/image/ImageTranscoder.java
===================================================================
--- sources/org/apache/batik/transcoder/image/ImageTranscoder.java     
(revision 796594 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=796594 ))
+++ sources/org/apache/batik/transcoder/image/ImageTranscoder.java     
(working copy)
@@ -75,6 +75,13 @@
     protected ImageTranscoder() {
     }

+    protected void setImageSize(float docWidth, float docHeight) {
+        super.setImageSize(docWidth, docHeight);
+
+        width  = (int)(width + 0.5f);
+        height = (int)(height + 0.5f);
+    }
+

------------------

   That said I think you are just asking for trouble trying to rasterize
content that doesn't match your desired pixel grid if you require pixle
perfect rendering.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to