public final class ColorUtil
extends java.lang.Object
This class supports parsing string values into color values and creating color values for strings. It provides a list of standard color names.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CMYK_PSEUDO_PROFILE
The name for the uncalibrated CMYK pseudo-profile
|
protected static org.apache.commons.logging.Log |
log
Logger instance
|
static java.lang.String |
SEPARATION_PSEUDO_PROFILE
The name for the Separation pseudo-profile used for spot colors
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
colorToString(java.awt.Color color)
Creates a re-parsable string representation of the given color.
|
static boolean |
isGray(java.awt.Color col)
Indicates whether the color is a gray value.
|
static boolean |
isPseudoProfile(java.lang.String colorProfileName)
Indicates whether the given color profile name is one of the pseudo-profiles supported
by FOP (ex.
|
static java.awt.Color |
lightenColor(java.awt.Color col,
float factor)
Lightens up a color for groove, ridge, inset and outset border effects.
|
static java.awt.Color |
parseColorString(FOUserAgent foUserAgent,
java.lang.String value)
Creates a color from a given string.
|
static java.awt.Color |
toCMYKGrayColor(float black)
Creates an uncalibrated CMYK color with the given gray value.
|
public static final java.lang.String CMYK_PSEUDO_PROFILE
public static final java.lang.String SEPARATION_PSEUDO_PROFILE
protected static final org.apache.commons.logging.Log log
public static java.awt.Color parseColorString(FOUserAgent foUserAgent, java.lang.String value) throws PropertyException
This function supports a wide variety of inputs.
foUserAgent
- FOUserAgent objectvalue
- the string to parse.PropertyException
- if the string is not parsable or does not follow any of the
given formats.public static java.lang.String colorToString(java.awt.Color 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.
color
- the color to represent.public static java.awt.Color lightenColor(java.awt.Color col, float factor)
col
- the color to lighten upfactor
- factor by which to lighten up (negative values darken the color)public static boolean isPseudoProfile(java.lang.String colorProfileName)
colorProfileName
- the color profile name to checkpublic static boolean isGray(java.awt.Color col)
col
- the colorpublic static java.awt.Color toCMYKGrayColor(float black)
black
- the gray component (0 - 1)Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.