inloop / svg2android

SVG to Android VectorDrawable XML resource file
http://inloop.github.io/svg2android
Apache License 2.0
1.71k stars 357 forks source link

Bake transforms into path (experimental) messes icon position up #80

Closed vanniktech closed 5 years ago

vanniktech commented 7 years ago

Input Icon

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
    <g fill="none" fill-rule="evenodd" transform="translate(-5 -4)">
        <path d="M5 4h24v24H5z"/>
        <circle cx="17" cy="16" r="5" fill="#FB4754"/>
        <g stroke="#FB4754" stroke-linecap="square" stroke-width="1.5">
            <path d="M6.629 15.765h2.828M24.543 15.765h2.828"/>
            <g>
                <path d="M17 26.371v-2.828M17 8.457V5.63"/>
            </g>
            <g>
                <path d="M9.5 23.167l2-2M22.167 10.5l2-2"/>
                <g>
                    <path d="M24.334 23.333l-2-2M11.667 10.666l-2-2"/>
                </g>
            </g>
        </g>
    </g>
</svg>

Works without Bake transforms into path

When I convert it using those options:

screen shot 2017-05-15 at 12 39 35

The image will be transformed correctly.

screen shot 2017-05-15 at 12 40 13

Does not work with Bake transforms into path

However when I activate Bake transforms into path:

screen shot 2017-05-15 at 12 40 40

The image will not be transformed correctly and is not centered:

screen shot 2017-05-15 at 12 41 03

theBlbDan commented 7 years ago

I ran into a condition where I had some <rect />'s with a transform that included translate and rotation. I found in the VectorDrawable docs that some transforms exists in the group tag. It might be worth fixing up svg2android for these.

vanniktech commented 6 years ago

Gentle bump on this.

vanniktech commented 6 years ago

@yuraj11 is this project still being maintained? Otherwise I'd use the tools from the android folks instead.

theBlbDan commented 6 years ago

What tools does Google have?

yuraj11 commented 6 years ago

It is not deprecated but also not active because I do not have that much free time to fix all the issues. SVG format is too complex and some bug fixes could introduce another bugs. Have you tried the official Android Studio svg import dialog https://developer.android.com/studio/write/vector-asset-studio.html ?

vanniktech commented 6 years ago

That's also the one I meant with Google tools.

yuraj11 commented 5 years ago

As this tool is deprecated and behind the official AS solution in term of conversion - you can check https://developer.android.com/studio/write/vector-asset-studio#svg - I have tried converting this SVG and It renders correctly using AS Vector Asset Studio.