org.icepdf.core.util
Class ColorUtil

java.lang.Object
  extended by org.icepdf.core.util.ColorUtil

public class ColorUtil
extends java.lang.Object

ColorUtil is a utra effecient named color parser. The class has a list of all html named colours and their matching hex values.

Since:
2.7.1

Constructor Summary
ColorUtil()
           
 
Method Summary
static int convertColor(java.lang.String name)
          Converts the colour to an integer value.
static java.lang.String convertColorNameToRGB(java.lang.String name)
          Converts a named colour to hex rgb notation.
static int convertNamedColor(java.lang.String name)
          Converts the named colour to an integer value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorUtil

public ColorUtil()
Method Detail

convertColorNameToRGB

public static final java.lang.String convertColorNameToRGB(java.lang.String name)
Converts a named colour to hex rgb notation. For example black is converted to #000000 and white to #FFFFFF.

Parameters:
name - know colour name to be converted
Returns:
name of converted string, the same name is returned if their was a conversion failure.

convertColor

public static int convertColor(java.lang.String name)
Converts the colour to an integer value.

Parameters:
name - colour value in either hex or string format.
Returns:
valid int colour value or -1 if no colour could be resolved

convertNamedColor

public static final int convertNamedColor(java.lang.String name)
Converts the named colour to an integer value. This integer value can then be used to generate a valid java.awt.Color object.

Parameters:
name - name of colour to convert.
Returns:
integer >= 0 if named colour was converted successfully, -1 otherwise.