diva.canvas.toolbox
Class SVGUtilities

java.lang.Object
  extended by diva.canvas.toolbox.SVGUtilities

public class SVGUtilities
extends java.lang.Object

A collection of utility functions to aid in figures from SVG, the Scalable Vector Graphics language. For a description of SVG see the specification.

Version:
$Id: SVGUtilities.java 47567 2007-12-16 07:31:18Z cxh $
Author:
John Reekie, Steve Neuendorffer

Field Summary
private static java.util.HashMap colors
          A map containing a mapping from color names to color values
 
Constructor Summary
SVGUtilities()
           
 
Method Summary
static java.util.Iterator colorNames()
          Get an iterator over the known color names
static java.awt.Color getColor(java.lang.String name)
          Given a string representing a color, return a color that represents it.
static double[] parseCoordString(java.lang.String s)
          Parse a string of numbers into an array of double.
static java.util.Map parseStyleString(java.lang.String style)
          Given a style string, parse it into a map of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colors

private static final java.util.HashMap colors
A map containing a mapping from color names to color values

Constructor Detail

SVGUtilities

public SVGUtilities()
Method Detail

colorNames

public static java.util.Iterator colorNames()
Get an iterator over the known color names


getColor

public static java.awt.Color getColor(java.lang.String name)
Given a string representing a color, return a color that represents it. The string argument can be a hexadecimal or octal number, or a color name. If a color name, then it is first looked up in the default color table. If not found there, then it is looked up in the System properties. If after all that a color is not found, then return black.


parseStyleString

public static java.util.Map parseStyleString(java.lang.String style)
Given a style string, parse it into a map of elements. Here is what an example string might look like: "font: ariel; stroke: red; stroke-width: 2". See the SVG specification for more.


parseCoordString

public static double[] parseCoordString(java.lang.String s)
Parse a string of numbers into an array of double. The doubles can be delimited by commas and spaces.

FIXME this is not correct