Coder Social home page Coder Social logo

svg-non-stop's Introduction

SVG non-stop

What is this

Java utility fixes Gradient has no stop info error when importing SVG files as vector assets in Android studio. This error results in corrupt drawable with empty gradient fills.

How to use

  1. Download binary from releases/latest

  2. Pass target SVG file name as parameter:

    ./bin/svg-non-stop my_vector_drawable.svg
    
  3. Result will be saved in my_vector_drawable_nonstop.svg. Use this file to import in IDE.

Optional parameters:

  • -f to force overwrite target _nonstop.svg file,
  • -v to have verbose output.

Technical notes

Utility copies stops definitions into target gradients in SVG file. Then IDE can process file correctly. Utility is not for use in android code.

For build use gradle assemble task and you will get build/distributions/svg-non-stop-x.y.z.zip archive.

svg-non-stop's People

Contributors

14v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

svg-non-stop's Issues

License?

Can you add a license? I'm interested in forking it and making a JAR library so it can be used in a public Gradle plugin.

It doesn't have any effect on the following SVG file

Android Studio reports the following issues when trying to import the file:

ERROR @ line 23: Gradient has no stop info
ERROR @ line 33: Gradient has no stop info
ERROR @ line 83: <image> is not supported
ERROR @ line 130: <image> is not supported
WARNING @ line 123: Scaling of the stroke width is ignored
WARNING @ line 170: Scaling of the stroke width is ignored
WARNING @ line 180: Scaling of the stroke width is ignored
WARNING @ line 187: Scaling of the stroke width is ignored
WARNING @ line 197: Scaling of the stroke width is ignored
WARNING @ line 205: Scaling of the stroke width is ignored
WARNING @ line 217: Scaling of the stroke width is ignored

Obviously there are other issues as well, but first two should be resolved by running the converter. However converted file has the same issues:

ERROR @ line 3: Gradient has no stop info
ERROR @ line 4: Gradient has no stop info
ERROR @ line 18: <image> is not supported
ERROR @ line 34: <image> is not supported
WARNING @ line 31: Scaling of the stroke width is ignored
WARNING @ line 47: Scaling of the stroke width is ignored
WARNING @ line 51: Scaling of the stroke width is ignored
WARNING @ line 52: Scaling of the stroke width is ignored
WARNING @ line 53: Scaling of the stroke width is ignored
WARNING @ line 54: Scaling of the stroke width is ignored
WARNING @ line 56: Scaling of the stroke width is ignored

I am attaching the SVG file.
foreground.zip

Allow radialGradient to be processed

Hi,

it you change the line 135 of NonStop.kt for this:

private fun Node.isGradient(): Boolean = nodeName == "linearGradient" || nodeName == "radialGradient"

It'll allow radialGradient to be included as well in the processing.

Thanks for the lib!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.