Package com.twelvemonkeys.imageio.color
Class ColorSpaces
- java.lang.Object
-
- com.twelvemonkeys.imageio.color.ColorSpaces
-
public final class ColorSpaces extends java.lang.ObjectA helper class for working with ICC color profiles and color spaces.Standard ICC color profiles are read from system-specific locations for known operating systems.
Color profiles may be configured by placing a property-file
com/twelvemonkeys/imageio/color/icc_profiles.propertieson the classpath, specifying the full path to the profiles. ICC color profiles are probably already present on your system, or can be downloaded from ICC, Adobe or other places. *Example property file:
# icc_profiles.properties ADOBE_RGB_1998=/path/to/Adobe RGB 1998.icc GENERIC_CMYK=/path/to/Generic CMYK.icc
- Version:
- $Id: ColorSpaces.java,v 1.0 24.01.11 17.51 haraldk Exp$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classColorSpaces.Key
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ref.WeakReference<java.awt.color.ICC_Profile>adobeRGB1998private static java.util.Map<ColorSpaces.Key,java.awt.color.ICC_ColorSpace>cachestatic intCS_ADOBE_RGB_1998The Adobe RGB 1998 (or compatible) color space.static intCS_GENERIC_CMYKA best-effort "generic" CMYK color space.(package private) static booleanDEBUGprivate static java.lang.ref.WeakReference<java.awt.color.ICC_Profile>genericCMYK
-
Constructor Summary
Constructors Modifier Constructor Description privateColorSpaces()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.awt.color.ICC_ColorSpacecreateColorSpace(java.awt.color.ICC_Profile profile)Creates an ICC color space from the given ICC color profile.(package private) static java.awt.color.ICC_ColorSpacegetCachedCS(byte[] profileHeader)private static java.awt.color.ICC_ColorSpacegetCachedCS(ColorSpaces.Key profileKey)private static java.awt.color.ICC_ColorSpacegetCachedOrCreateCS(java.awt.color.ICC_Profile profile, byte[] profileHeader)static java.awt.color.ColorSpacegetColorSpace(int colorSpace)Returns the color space specified by the given color space constant.(package private) static java.awt.color.ICC_ColorSpacegetInternalCS(int profileCSType, byte[] profileHeader)static booleanisCS_GRAY(java.awt.color.ICC_Profile profile)Deprecated.UseColorProfiles.isCS_GRAY(ICC_Profile)instead.static booleanisCS_sRGB(java.awt.color.ICC_Profile profile)Deprecated.UseColorProfiles.isCS_sRGB(ICC_Profile)instead.(package private) static voidvalidateColorSpace(java.awt.color.ICC_ColorSpace cs)static java.awt.color.ICC_ProfilevalidateProfile(java.awt.color.ICC_Profile profile)Deprecated.UseColorProfiles.validateProfile(ICC_Profile)instead.
-
-
-
Field Detail
-
DEBUG
static final boolean DEBUG
-
CS_ADOBE_RGB_1998
public static final int CS_ADOBE_RGB_1998
The Adobe RGB 1998 (or compatible) color space. Either read from disk or built-in.- See Also:
- Constant Field Values
-
CS_GENERIC_CMYK
public static final int CS_GENERIC_CMYK
A best-effort "generic" CMYK color space. Either read from disk or built-in.- See Also:
- Constant Field Values
-
adobeRGB1998
private static java.lang.ref.WeakReference<java.awt.color.ICC_Profile> adobeRGB1998
-
genericCMYK
private static java.lang.ref.WeakReference<java.awt.color.ICC_Profile> genericCMYK
-
cache
private static final java.util.Map<ColorSpaces.Key,java.awt.color.ICC_ColorSpace> cache
-
-
Method Detail
-
createColorSpace
public static java.awt.color.ICC_ColorSpace createColorSpace(java.awt.color.ICC_Profile profile)
Creates an ICC color space from the given ICC color profile.For standard Java color spaces, the built-in instance is returned. Otherwise, color spaces are looked up from cache and created on demand.
- Parameters:
profile- the ICC color profile. May not benull.- Returns:
- an ICC color space
- Throws:
java.lang.IllegalArgumentException- ifprofileisnull.java.awt.color.CMMException- ifprofileis invalid.
-
getInternalCS
static java.awt.color.ICC_ColorSpace getInternalCS(int profileCSType, byte[] profileHeader)
-
getCachedOrCreateCS
private static java.awt.color.ICC_ColorSpace getCachedOrCreateCS(java.awt.color.ICC_Profile profile, byte[] profileHeader)
-
getCachedCS
private static java.awt.color.ICC_ColorSpace getCachedCS(ColorSpaces.Key profileKey)
-
getCachedCS
static java.awt.color.ICC_ColorSpace getCachedCS(byte[] profileHeader)
-
validateColorSpace
static void validateColorSpace(java.awt.color.ICC_ColorSpace cs)
-
isCS_sRGB
@Deprecated public static boolean isCS_sRGB(java.awt.color.ICC_Profile profile)
Deprecated.UseColorProfiles.isCS_sRGB(ICC_Profile)instead.
-
isCS_GRAY
@Deprecated public static boolean isCS_GRAY(java.awt.color.ICC_Profile profile)
Deprecated.UseColorProfiles.isCS_GRAY(ICC_Profile)instead.
-
validateProfile
@Deprecated public static java.awt.color.ICC_Profile validateProfile(java.awt.color.ICC_Profile profile)
Deprecated.UseColorProfiles.validateProfile(ICC_Profile)instead.
-
getColorSpace
public static java.awt.color.ColorSpace getColorSpace(int colorSpace)
Returns the color space specified by the given color space constant.For standard Java color spaces, the built-in instance is returned. Otherwise, color spaces are looked up from cache and created on demand.
- Parameters:
colorSpace- the color space constant.- Returns:
- the
ColorSpacespecified by the color space constant. - Throws:
java.lang.IllegalArgumentException- ifcolorSpaceis not one of the defined color spaces (CS_*).- See Also:
ColorSpace,CS_ADOBE_RGB_1998,CS_GENERIC_CMYK
-
-