trello-archive / victor

Use SVGs as resources in Android
Apache License 2.0
1.01k stars 49 forks source link

PNGs are only generated correctly for some DPIs #53

Closed rrbrambley closed 8 years ago

rrbrambley commented 8 years ago

Here's my red_circle_with_shadow.svg file that I've added to main/svg:

<svg width="234px" height="233px" viewBox="64 372 234 233" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 3.8.3 (29802) - http://www.bohemiancoding.com/sketch -->
    <desc>Created with Sketch.</desc>
    <defs>
        <rect id="path-1" x="78" y="374" width="205" height="205" rx="100"></rect>
        <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
            <feOffset dx="0" dy="12" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="7" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.236186594 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
        </filter>
    </defs>
    <g id="Rectangle-123-Copy-8" stroke="none" fill="none">
        <use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
        <use fill="#FE5000" fill-rule="evenodd" xlink:href="#path-1"></use>
    </g>
</svg>

When I build, my drawable folders in build/generated/res/debug/svg each contain a red_circle_with_shadow.png file, but the xhdpi/xhdpi/xxhdpi/xxxhdpi versions are 100% transparent images with no content.

Here's drawable-mdpi/red_circle_with_shadow.png: red_circle_with_shadow

Here's drawable-hdpi/red_circle_with_shadow.png: red_circle_with_shadow

dlew commented 8 years ago

This may be the same problem as #42, in which case it's not something solvable on Victor's end. Could you see if your SVG rasterizes with Batik alone (no Victor)? Binary here: https://xmlgraphics.apache.org/batik/tools/rasterizer.html

rrbrambley commented 8 years ago

Thanks, appears to be the same problem as #42. Hrmph. Closing :/