avianey / androidsvgdrawable-plugin

Gradle plugin that generates qualified, density specific PNG drawables from SVG files at build time for your Android projects.
Apache License 2.0
262 stars 29 forks source link

dimensions ratio #1

Closed jeremie-seguin closed 10 years ago

jeremie-seguin commented 10 years ago

The generated file from this SVG don't have the same dimensions ratio

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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"
   version="1.1"
   x="0px"
   y="0px"
   width="512"
   height="512"
   id="svg378">
  <metadata
     id="metadata3014">
    <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></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <defs
     id="defs380">
    <clipPath
       id="clipPath8018">
      <rect
         width="512"
         height="512"
         x="0"
         y="0"
         id="rect8020"
         style="fill-opacity:0.67000002" />
    </clipPath>
  </defs>
  <g
     clip-path="url(#clipPath8018)"
     id="flag"
     style="fill-rule:evenodd">
    <rect
       width="730.16998"
       height="512"
       x="-610.60999"
       y="-511.56"
       transform="scale(-1,-1)"
       id="rect149"
       style="fill:#ffffff" />
    <path
       d="m 495.86,1148 a 163.79,163.79 0 1 1 -327.58,0 163.79,163.79 0 1 1 327.58,0 z"
       transform="matrix(0.6869,0,0,0.6869,-88.735,-532.54)"
       id="path607"
       style="fill:#ffffff" />
    <path
       d="m 733.7,381.73 a 227.74,227.74 0 1 1 -455.48,0 227.74,227.74 0 1 1 455.48,0 z"
       transform="matrix(0.63784,0,0,0.64461,-74.972,16.483)"
       id="path635"
       style="fill:#c70000" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="45.308998"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect636"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="81.527"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect637"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="45.308998"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect638"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="45.308998"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect639"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="118.52"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect640"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="45.308998"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect641"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="-127.97"
       y="45.308998"
       transform="matrix(0.65400174,-0.75649304,0.75649304,0.65400174,0,0)"
       id="rect643"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="320.64999"
       y="-330.34"
       transform="matrix(0.64886,0.7609,-0.7609,0.64886,0,0)"
       id="rect644"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="320.64999"
       y="-257.13"
       transform="matrix(0.64886,0.7609,-0.7609,0.64886,0,0)"
       id="rect645"
       style="stroke-width:1pt" />
    <path
       d="m 417.55,133.19 78.602,-67.814 14.641,16.953 -83.996,75.519 -9.2471,-24.659 z"
       id="path649"
       style="fill:#ffffff" />
    <rect
       width="125.1"
       height="25.643999"
       x="-42.832001"
       y="-633.04999"
       transform="matrix(-0.64282,0.76602,-0.76881,-0.63948,0,0)"
       id="rect646"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="320.64999"
       y="-294.12"
       transform="matrix(0.64886,0.7609,-0.7609,0.64886,0,0)"
       id="rect642"
       style="stroke-width:1pt" />
    <rect
       width="125.1"
       height="25.643999"
       x="-42.832001"
       y="-668.48999"
       transform="matrix(-0.64282,0.76602,-0.76881,-0.63948,0,0)"
       id="rect647"
       style="stroke-width:1pt" />
    <rect
       width="125.1"
       height="25.643999"
       x="-42.832001"
       y="-596.84003"
       transform="matrix(-0.64282,0.76602,-0.76881,-0.63948,0,0)"
       id="rect648"
       style="stroke-width:1pt" />
    <path
       d="m 104.6,236.68 c 4.5919,36.974 11.297,78.175 68.199,82.455 21.328,1.2776 62.817,-5.0735 77.061,-63.19 18.688,-55.829 74.975,-71.88 113.28,-41.613 21.718,14.166 27.727,36.666 29.283,53.557 -1.7386,54.243 -32.874,101.2 -72.823,122.14 -45.93,27.3 -109.56,27.87 -165.3,-13.49 -25.12,-23.57 -60.219,-67.02 -49.7,-139.86 z"
       id="path653"
       style="fill:#3d5897" />
    <path
       d="m 435.91,370.59 78.734,67.661 -14.591,16.997 -87.156,-71.851 23.013,-12.807 z"
       id="path654"
       style="fill:#ffffff" />
    <rect
       width="127.92"
       height="26.201"
       x="270.57001"
       y="233.21001"
       transform="matrix(0.64886,0.7609,-0.7609,0.64886,0,0)"
       id="rect658"
       style="stroke-width:1pt" />
    <path
       d="m -16.188,437.25 78.602,-67.814 14.641,16.953 -83.996,75.519 -9.2471,-24.659 z"
       id="path657"
       style="fill:#ffffff;stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="270.57001"
       y="196.99001"
       transform="matrix(0.64886,0.7609,-0.7609,0.64886,0,0)"
       id="rect655"
       style="stroke-width:1pt" />
    <rect
       width="127.92"
       height="26.201"
       x="270.57001"
       y="270.20001"
       transform="matrix(0.64886,0.7609,-0.7609,0.64886,0,0)"
       id="rect656"
       style="stroke-width:1pt" />
  </g>
</svg>
avianey commented 10 years ago

F#$*ING ClipPath...

avianey commented 10 years ago

The plugin now takes only width and height attributes to compute bounds.
ClipPath, Filters, Masks and Effects outside of those limits are no more modifying the generated PNG width and height. It's also possible (but not recommended) to use dimensions expressed in "cm", "in", "pt" and "mm" in the file.