From http://www.w3.org/TR/SVG/types.html#DataTypeColor: "The format of an RGB
value in hexadecimal notation is a "#" immediately followed by either three or
six hexadecimal characters. The three-digit RGB notation (#rgb) is converted
into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For
example, #fb0 expands to #ffbb00."
This is the fixed getColorValue, starting at line 801 of SVGParser.java
public Integer getColorValue(String name) {
String v = getAttr(name);
if (v == null) {
return null;
} else if (v.startsWith("#")) {
try {
String hc = v.substring(1);
if (hc.length() == 3) {
hc = new String(new char[] {
hc.charAt(0), hc.charAt(0),
hc.charAt(1), hc.charAt(1),
hc.charAt(2), hc.charAt(2),
});
}
return Integer.parseInt(hc, 16);
} catch (NumberFormatException nfe) {
// todo - parse word-based color here
return null;
}
} else {
return SVGColors.mapColor(v);
}
}
Original issue reported on code.google.com by neclep...@gmail.com on 21 Oct 2011 at 6:38
Original issue reported on code.google.com by
neclep...@gmail.com
on 21 Oct 2011 at 6:38