Class ColorSpaces
java.lang.Object
com.twelvemonkeys.imageio.color.ColorSpaces
A 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.properties
on 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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static WeakReference<ICC_Profile> private static final Map<ColorSpaces.Key, ICC_ColorSpace> static final intThe Adobe RGB 1998 (or compatible) color space.static final intA best-effort "generic" CMYK color space.(package private) static final booleanprivate static WeakReference<ICC_Profile> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ICC_ColorSpacecreateColorSpace(ICC_Profile profile) Creates an ICC color space from the given ICC color profile.(package private) static ICC_ColorSpacegetCachedCS(byte[] profileHeader) private static ICC_ColorSpacegetCachedCS(ColorSpaces.Key profileKey) private static ICC_ColorSpacegetCachedOrCreateCS(ICC_Profile profile, byte[] profileHeader) static ColorSpacegetColorSpace(int colorSpace) Returns the color space specified by the given color space constant.(package private) static ICC_ColorSpacegetInternalCS(int profileCSType, byte[] profileHeader) static booleanisCS_GRAY(ICC_Profile profile) Deprecated.static booleanisCS_sRGB(ICC_Profile profile) Deprecated.UseColorProfiles.isCS_sRGB(ICC_Profile)instead.(package private) static voidstatic ICC_ProfilevalidateProfile(ICC_Profile profile) Deprecated.UseColorProfiles.validateProfile(ICC_Profile)instead.
-
Field Details
-
DEBUG
static final boolean DEBUG -
CS_ADOBE_RGB_1998
public static final int CS_ADOBE_RGB_1998The Adobe RGB 1998 (or compatible) color space. Either read from disk or built-in.- See Also:
-
CS_GENERIC_CMYK
public static final int CS_GENERIC_CMYKA best-effort "generic" CMYK color space. Either read from disk or built-in.- See Also:
-
adobeRGB1998
-
genericCMYK
-
cache
-
-
Constructor Details
-
ColorSpaces
private ColorSpaces()
-
-
Method Details
-
createColorSpace
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:
IllegalArgumentException- ifprofileisnull.CMMException- ifprofileis invalid.
-
getInternalCS
-
getCachedOrCreateCS
-
getCachedCS
-
getCachedCS
-
validateColorSpace
-
isCS_sRGB
Deprecated.UseColorProfiles.isCS_sRGB(ICC_Profile)instead. -
isCS_GRAY
Deprecated.UseColorProfiles.isCS_GRAY(ICC_Profile)instead. -
validateProfile
Deprecated.UseColorProfiles.validateProfile(ICC_Profile)instead. -
getColorSpace
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:
IllegalArgumentException- ifcolorSpaceis not one of the defined color spaces (CS_*).- See Also:
-
ColorProfiles.isCS_GRAY(ICC_Profile)instead.