fop 0.95

org.apache.fop.util
Class ColorUtil

java.lang.Object
  extended by org.apache.fop.util.ColorUtil

public final class ColorUtil
extends java.lang.Object

Generic Color helper class.

This class supports parsing string values into color values and creating color values for strings. It provides a list of standard color names.


Field Summary
protected static org.apache.commons.logging.Log log
          Logger instance
 
Method Summary
static java.lang.String colorToString(java.awt.Color color)
          Creates a re-parsable string representation of the given color.
static java.awt.Color parseColorString(FOUserAgent foUserAgent, java.lang.String value)
          Creates a color from a given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Logger instance

Method Detail

parseColorString

public static java.awt.Color parseColorString(FOUserAgent foUserAgent,
                                              java.lang.String value)
                                       throws PropertyException
Creates a color from a given string.

This function supports a wide variety of inputs.

Parameters:
foUserAgent - FOUserAgent object
value - the string to parse.
Returns:
a Color representing the string if possible
Throws:
PropertyException - if the string is not parsable or does not follow any of the given formats.

colorToString

public static java.lang.String colorToString(java.awt.Color color)
Creates a re-parsable string representation of the given color.

First, the color will be converted into the sRGB colorspace. It will then be printed as #rrggbb, or as #rrrggbbaa if an alpha value is present.

Parameters:
color - the color to represent.
Returns:
a re-parsable string representadion.

fop 0.95

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.