util
Class SVGUtilities
java.lang.Object
util.SVGUtilities
public class SVGUtilities
- extends java.lang.Object
Utility class for SVG parsing.
SVG Color specification
-----------------------
{ color: #f00 } #rgb Not implemened
{ color: #ff0000 } #rrggbb Implemented
{ color: rgb(255,0,0) } integer range 0 - 255 Implemented
{ color: rgb(100%, 0%, 0%) } float range 0.0% - 100.0% Implemented
SVG actually specifies 147 named colors, but this class only supports 16.
Field Summary |
static java.util.HashMap<java.lang.String,java.awt.Color> |
colors
the 16 named colors in SVG |
Method Summary |
static java.awt.Color |
getColor(java.lang.String color)
Returns a java color object for the specified SVG color or null if a
value of "none" is specified. |
static java.lang.String |
getColorString(java.awt.Color color)
Returns the SVG hexadecimal representation of the given color. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
colors
public static java.util.HashMap<java.lang.String,java.awt.Color> colors
- the 16 named colors in SVG
SVGUtilities
public SVGUtilities()
getColor
public static java.awt.Color getColor(java.lang.String color)
- Returns a java color object for the specified SVG color or null if a
value of "none" is specified.
If this class is unable to determine the specified color, then a white
color object is returned.
- Parameters:
color
- - the SVG specified color
- Returns:
- - the java color object representing the color
getColorString
public static java.lang.String getColorString(java.awt.Color color)
- Returns the SVG hexadecimal representation of the given color.
- Parameters:
color
- - the java color
- Returns:
- - the SVG hexadecimal representation of the color