Re: Radial symmetry lost during rasterization

DeWeese Thomas <[email protected]>
Newsgroups gmane.text.xml.batik.user
Message-ID <[email protected]>
Hi Ryan,
	It looks like there is a shift of the center of the radial gradient by ~.5 a pixel 
relative to the geometry. Feel free to register a bug.

	Thomas

This version makes it a little clearer:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   version="1.1"
   width="16"
   height="16"
   id="svg6152"
   shape-rendering="geometricPrecision"
   color-rendering="optimizeQuality"
   inkscape:version="0.48.2 r9819"
   sodipodi:docname="cluster.svg">
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1680"
     inkscape:window-height="988"
     id="namedview14"
     showgrid="false"
     inkscape:zoom="48.048722"
     inkscape:cx="5.5129408"
     inkscape:cy="8"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg6152" />
  <defs
     id="defs6154">
    <linearGradient
       id="linearGradient6830">
      <stop
         id="stop6832"
         style="stop-color:#eeb111;stop-opacity:1"
         offset="0" />
      <stop
         id="stop6838"
         style="stop-color:#eeb111;stop-opacity:1"
         offset="0.80000001" />
      <stop
         id="stop6834"
         style="stop-color:#eeb111;stop-opacity:0"
         offset="1" />
    </linearGradient>
    <radialGradient
       cx="8.4242573"
       cy="7.3054457"
       r="6.0816832"
       fx="8.4242573"
       fy="7.3054457"
       id="radialGradient6836"
       xlink:href="#linearGradient6830"
       gradientUnits="userSpaceOnUse"
       gradientTransform="matrix(1,0,0,1.037037,0,-0.27057189)" />
  </defs>
  <metadata
     id="metadata6157">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     id="layer1"
     style="display:inline"
     transform="matrix(1,0,0,0.99971334,0,0.0022932)">
    <path
       d="m 14.50594,7.3054457 a 6.0816832,6.3069305 0 1 1
-12.1633659,0 6.0816832,6.3069305 0 1 1 12.1633659,0 z"
       transform="matrix(1.3154253,0,0,1.2684459,-3.0814812,-1.2665626)"
       id="path6806"
       style="fill:#000;fill-opacity:1"
       inkscape:connector-curvature="0" />
    <path
       d="m 14.50594,7.3054457 a 6.0816832,6.3069305 0 1 1
-12.1633659,0 6.0816832,6.3069305 0 1 1 12.1633659,0 z"
       transform="matrix(1.3154253,0,0,1.2684459,-3.0814812,-1.2665626)"
       id="path6806"
       style="fill:url(#radialGradient6836);fill-opacity:1"
       inkscape:connector-curvature="0" />
  </g>
  <g
     id="layer2"
     style="display:inline"
     transform="matrix(1,0,0,0.99951699,0,0.0038645)">
    <path
       d="m 11.082178,7.3730197 a 1.2839109,1.1487623 0 1 1
-2.5678215,0 1.2839109,1.1487623 0 1 1 2.5678215,0 z"
       transform="matrix(4.6732216,0.0143752,0,5.2229872,-37.789475,-30.65004)"
       id="path6670"
       style="fill:#f7d888;fill-opacity:1"
       inkscape:connector-curvature="0" />
  </g>
  <g transform="matrix(1,0,0,0.99971334,0,0.0022932)">
    <g transform="matrix(1.3154253,0,0,1.2684459,-3.0814812,-1.2665626)">
    <circle
       cx="8.4242573"
       cy="7.3054457"
       r="1"
       fill="#F00"
      transform="matrix(1,0,0,1.037037,0,-0.27057189)"/>
    </g>
  </g>
</svg>


On Mar 28, 2012, at 5:03 PM, Ryan Gustafson wrote:

> The following SVG is essentially two circles centered on top of each
> other.  It has radial symmetry.  However, when I rasterize this to a
> 16x16 image, I get something quite obviously lacking radial symmetry.
> It appears as though things are shifted to the upper left toward
> (0,0), and smells to me like an integer truncation issue.  If I
> increase the raster dimensions, the problem becomes less pronounced,
> and ultimately unnoticeable at higher resolutions (e.g. 512x512).  I
> can likely work around this by rasterizing at high resolution and then
> scaling down to my desired resolution.
> 
> This was with Batik 1.7, on with Oracle Java 1.6.0_22 and 1.6.0_29 on Windows 7.
> 
> For reference, Inkscape will export a raster that appears correct.
> 
> Regards,
> Ryan Gustafson
> 
> ---
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!-- Created with Inkscape (http://www.inkscape.org/) -->
> 
> <svg
>    xmlns:dc="http://purl.org/dc/elements/1.1/"
>    xmlns:cc="http://creativecommons.org/ns#"
>    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>    xmlns:svg="http://www.w3.org/2000/svg"
>    xmlns="http://www.w3.org/2000/svg"
>    xmlns:xlink="http://www.w3.org/1999/xlink"
>    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
>    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
>    version="1.1"
>    width="16"
>    height="16"
>    id="svg6152"
>    inkscape:version="0.48.2 r9819"
>    sodipodi:docname="cluster.svg">
>   <sodipodi:namedview
>      pagecolor="#ffffff"
>      bordercolor="#666666"
>      borderopacity="1"
>      objecttolerance="10"
>      gridtolerance="10"
>      guidetolerance="10"
>      inkscape:pageopacity="0"
>      inkscape:pageshadow="2"
>      inkscape:window-width="1680"
>      inkscape:window-height="988"
>      id="namedview14"
>      showgrid="false"
>      inkscape:zoom="48.048722"
>      inkscape:cx="5.5129408"
>      inkscape:cy="8"
>      inkscape:window-x="-8"
>      inkscape:window-y="-8"
>      inkscape:window-maximized="1"
>      inkscape:current-layer="svg6152" />
>   <defs
>      id="defs6154">
>     <linearGradient
>        id="linearGradient6830">
>       <stop
>          id="stop6832"
>          style="stop-color:#eeb111;stop-opacity:1"
>          offset="0" />
>       <stop
>          id="stop6838"
>          style="stop-color:#eeb111;stop-opacity:1"
>          offset="0.80000001" />
>       <stop
>          id="stop6834"
>          style="stop-color:#eeb111;stop-opacity:0"
>          offset="1" />
>     </linearGradient>
>     <radialGradient
>        cx="8.4242573"
>        cy="7.3054457"
>        r="6.0816832"
>        fx="8.4242573"
>        fy="7.3054457"
>        id="radialGradient6836"
>        xlink:href="#linearGradient6830"
>        gradientUnits="userSpaceOnUse"
>        gradientTransform="matrix(1,0,0,1.037037,0,-0.27057189)" />
>   </defs>
>   <metadata
>      id="metadata6157">
>     <rdf:RDF>
>       <cc:Work
>          rdf:about="">
>         <dc:format>image/svg+xml</dc:format>
>         <dc:type
>            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
>         <dc:title />
>       </cc:Work>
>     </rdf:RDF>
>   </metadata>
>   <g
>      id="layer1"
>      style="display:inline"
>      transform="matrix(1,0,0,0.99971334,0,0.0022932)">
>     <path
>        d="m 14.50594,7.3054457 a 6.0816832,6.3069305 0 1 1
> -12.1633659,0 6.0816832,6.3069305 0 1 1 12.1633659,0 z"
>        transform="matrix(1.3154253,0,0,1.2684459,-3.0814812,-1.2665626)"
>        id="path6806"
>        style="fill:url(#radialGradient6836);fill-opacity:1"
>        inkscape:connector-curvature="0" />
>   </g>
>   <g
>      id="layer2"
>      style="display:inline"
>      transform="matrix(1,0,0,0.99951699,0,0.0038645)">
>     <path
>        d="m 11.082178,7.3730197 a 1.2839109,1.1487623 0 1 1
> -2.5678215,0 1.2839109,1.1487623 0 1 1 2.5678215,0 z"
>        transform="matrix(4.6732216,0.0143752,0,5.2229872,-37.789475,-30.65004)"
>        id="path6670"
>        style="fill:#f7d888;fill-opacity:1"
>        inkscape:connector-curvature="0" />
>   </g>
> </svg>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.