public class ColorConverterFactory extends Object implements ConverterFactory
Supported conversions:
This code was previously part of the SLD utility class, it is being made available as part of the Converters framework to allow for broader use.
Modifier and Type | Field and Description |
---|---|
static Converter |
CONVERT_COLOR_TO_STRING
Converts color to hex representation.
|
static Converter |
CONVERT_CSS_TO_COLOR
Converts CSS Color Module 4 names to colors, with a fallback to the basic
CONVERT_STRING converter if the provided source String is not found in the CSS_COLORS map. |
static Converter |
CONVERT_NUMBER_TO_COLOR
Converts provided integer to color, taking care to allow rgb and rgba support.
|
static Converter |
CONVERT_STRING
Uses
Color.decode(String) to convert String to Color. |
static Map<String,Color> |
CSS_COLORS
A mapping from CSS Color Module 4 names to Color objects.
|
protected static DecimalFormat |
FORMAT |
SAFE_CONVERSION
Constructor and Description |
---|
ColorConverterFactory() |
Modifier and Type | Method and Description |
---|---|
Converter |
createConverter(Class source,
Class target,
Hints hints)
Creates a
Converter instance for converting one type of object to another. |
public static Converter CONVERT_STRING
Color.decode(String)
to convert String to Color.public static Converter CONVERT_NUMBER_TO_COLOR
protected static DecimalFormat FORMAT
public static final Map<String,Color> CSS_COLORS
public static Converter CONVERT_CSS_TO_COLOR
CONVERT_STRING
converter if the provided source String is not found in the CSS_COLORS
map.
This converter is willing to work with:
CSS_COLORS
names such as "aliceblue".
rgb(0,0,255)
rgba(0,0,255,255)
#RRGGBB
and #RRGGBBAA
public static Converter CONVERT_COLOR_TO_STRING
public Converter createConverter(Class source, Class target, Hints hints)
ConverterFactory
Converter
instance for converting one type of object to another.createConverter
in interface ConverterFactory
source
- The type to convert from.target
- The type to convert to.hints
- Hints used to be used while creating a converter.null
if one could not be found.Copyright © 1996–2019 Geotools. All rights reserved.