omeshwar / svg-android-2

Automatically exported from code.google.com/p/svg-android-2
Apache License 2.0
0 stars 0 forks source link

patch for #colors of length 7 #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
My inkscape-produced SVGs have colors like "#abcdef":

              <path
                 d="m 19.532005,25.955284 0,-5.761719 -11.7187497,0 0,-4.804687 12.4218747,-18.1835939 4.609375,0 0,18.1640629 3.554688,0 0,4.824218 -3.554688,0 0,5.761719 z"
                 id="path3021"
                 style="font-weight:bold;fill:#abcdef" />

I'm able to get the affected paths to appear with this small change:

--- a/src/com/larvalabs/svgandroid/SVGParser.java
+++ b/src/com/larvalabs/svgandroid/SVGParser.java
@@ -802,7 +802,7 @@ public class SVGParser {
             String v = getAttr(name);
             if (v == null) {
                 return null;
-            } else if (v.startsWith("#") && (v.length() == 4 || v.length() == 
9)) {
+            } else if (v.startsWith("#") && (v.length() == 4 || v.length() == 
7 || v.length() == 9)) {
                 try {
                     int result = Integer.parseInt(v.substring(1), 16);
                    return v.length() == 4 ? hex3Tohex6(result) : result;

Original issue reported on code.google.com by johnru...@gmail.com on 3 Nov 2011 at 2:08

GoogleCodeExporter commented 8 years ago
Subsumed by #6

Original comment by suh...@google.com on 13 Dec 2011 at 1:45