almosr / android-svg-code-render

Convert SVG files into Java source and use it in your Android app
Apache License 2.0
24 stars 3 forks source link

SVG parse error: Invalid colour keyword: transparent #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if this is a problem of my svg or the lib, in case of the former I am 
sorry.

com.caverock.androidsvg.SVGParseException: SVG parse error: Invalid colour 
keyword: transparent
            at com.caverock.androidsvg.SVGParser.parse(SVGParser.java:406)
            at com.caverock.androidsvg.SVG.getFromInputStream(SVG.java:144)
            at epaper.android.mineus.de.svgtest.SvgFragment.onCreateView(SvgFragment.java:51)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
            at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478)
            at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:1068)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:914)
            at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1436)
            at android.view.View.measure(View.java:16497)
            at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
            at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
            at android.view.View.measure(View.java:16497)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at android.view.View.measure(View.java:16497)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
            at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
            at android.view.View.measure(View.java:16497)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
            at android.view.View.measure(View.java:16497)
            at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916)
            at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
            at android.view.Choreographer.doCallbacks(Choreographer.java:574)
            at android.view.Choreographer.doFrame(Choreographer.java:544)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: org.xml.sax.SAXException: Invalid colour keyword: transparent
            at com.caverock.androidsvg.SVGParser.parseColourKeyword(SVGParser.java:3066)
            at com.caverock.androidsvg.SVGParser.parseColour(SVGParser.java:3041)
            at com.caverock.androidsvg.SVGParser.parseColourSpecifer(SVGParser.java:2994)
            at com.caverock.androidsvg.SVGParser.parsePaintSpecifier(SVGParser.java:2983)
            at com.caverock.androidsvg.SVGParser.processStyleProperty(SVGParser.java:2410)
            at com.caverock.androidsvg.CSSParser.parseDeclarations(CSSParser.java:736)
            at com.caverock.androidsvg.CSSParser.parseRule(CSSParser.java:667)
            at com.caverock.androidsvg.CSSParser.parseRuleset(CSSParser.java:649)
            at com.caverock.androidsvg.CSSParser.parse(CSSParser.java:293)
            at com.caverock.androidsvg.SVGParser.parseCSSStyleSheet(SVGParser.java:3955)

Original issue reported on code.google.com by mineus....@gmail.com on 17 Jun 2014 at 7:49

GoogleCodeExporter commented 9 years ago
"transparent" is from the CSS3 spec.  AndroidSVG currently only handles colours 
as defined in the SVG spec.  Supporting all the extra CSS3 color variants is on 
my to-do list.

In the meantime you can work around this by finding the element(s) that use 
"transparent" and changing them to use opacity instead.

Eg. change:

   fill="transparent"

to

   fill-opacity="0"

Thanks for the report.

Original comment by paul.leb...@gmail.com on 17 Jun 2014 at 8:04