public class ICCColorSpace extends ColorSpace
ICC_ColorSpace
and ICC_Profile
, this
class avoids the many issues with the use of those classes in a multi-threaded
environment. It supports ICC v2 and v4 profiles, and provides support for "Named Color"
profiles via the getNamedColors()
method.Modifier and Type | Field and Description |
---|---|
static int |
CLASS_ABSTRACT
Profile class is abstract ("abst").
|
static int |
CLASS_COLORSPACECONVERSION
Profile class is color-space conversion ("spac").
|
static int |
CLASS_DEVICELINK
Profile class is device-link ("link").
|
static int |
CLASS_DISPLAY
Profile class is display ("mntr").
|
static int |
CLASS_INPUT
Profile class is input ("scnr").
|
static int |
CLASS_NAMEDCOLOR
Profile class is named color ("name").
|
static int |
CLASS_OUTPUT
Profile class is output ("prtr").
|
static int |
INTENT_ABSOLUTE
Represents the "Absolute Colorimetric" rendering intent
|
static int |
INTENT_PERCEPTUAL
Represents the "Perceptual" rendering intent
|
static int |
INTENT_RELATIVE
Represents the "Relative Colorimetric" rendering intent
|
static int |
INTENT_SATURATION
Represents the "Saturation" rendering intent
|
CS_CIEXYZ, CS_GRAY, CS_LINEAR_RGB, CS_PYCC, CS_sRGB, TYPE_2CLR, TYPE_3CLR, TYPE_4CLR, TYPE_5CLR, TYPE_6CLR, TYPE_7CLR, TYPE_8CLR, TYPE_9CLR, TYPE_ACLR, TYPE_BCLR, TYPE_CCLR, TYPE_CMY, TYPE_CMYK, TYPE_DCLR, TYPE_ECLR, TYPE_FCLR, TYPE_GRAY, TYPE_HLS, TYPE_HSV, TYPE_Lab, TYPE_Luv, TYPE_RGB, TYPE_XYZ, TYPE_YCbCr, TYPE_Yxy
Constructor and Description |
---|
ICCColorSpace(ICC_Profile profile)
Create a new ICCColorSpace from the supplied
ICC_Profile . |
ICCColorSpace(InputStream input)
Create a new ICCColorSpace from the supplied stream.
|
Modifier and Type | Method and Description |
---|---|
ICC_Profile |
createICC_Profile()
Create an
ICC_Profile from this class |
boolean |
equals(Object o) |
float[] |
fromCIEXYZ(float[] xyz) |
float[] |
fromCIEXYZ(float[] xyz,
int intent)
Convert from XYZ to this ColorSpace.
|
float[] |
fromRGB(float[] rgb)
Transforms a color value assumed to be in the default CS_sRGB color space into this ColorSpace.
|
float[] |
fromRGB(float[] rgb,
int intent)
Transforms a color value assumed to be in the default CS_sRGB color space into this ColorSpace.
|
String |
getDescription()
Return the text from the "desc" tag, or null if not available
|
int |
getMajorVersion()
Return the major version of the profile (2 or 4 at the time of writing)
|
float |
getMaxValue(int component)
Return the maximum normalized value for the specified component, which is always 1
|
Reader |
getMetaData()
Return any XML metadata associated with this object.
|
int |
getMinorVersion()
Return the minor version of the profile
|
float |
getMinValue(int component)
Return the maximum normalized value for the specified component, which is always 0
|
String |
getName(int c)
Return the name for the specified component, which is arbitrary and of the form "Comp-n"
|
Map<String,SpotColorSpace> |
getNamedColors()
If this profile is a
CLASS_NAMEDCOLOR profile class , return a map of
named colors to SpotColorSpaces defined by this profile. |
int |
getNumComponents()
Returns the number of components of this ColorSpace.
|
int |
getPatchVersion()
Return the minor version of the profile
|
int |
getPCSType()
Return the PCS type, one of
ColorSpace.TYPE_XYZ or ColorSpace.TYPE_Lab |
int |
getProfileClass()
Returns the profile class, or -1 if it's unknown
|
InputStream |
getProfileData()
Return a stream containing the original bytes passed into the constructor
|
int |
getType()
Returns the color space type of this ColorSpace (for example
ColorSpace.TYPE_RGB , ColorSpace.TYPE_XYZ , ...). |
int |
hashCode() |
boolean |
isCS_sRGB()
Return true if this profile is sRGB.
|
void |
setMetaData(String metadata)
Set the XML metadata associated with this object.
|
float[] |
toCIEXYZ(float[] components)
Transforms a color value assumed to be in this ColorSpace into the CS_CIEXYZ conversion color space.
|
float[] |
toCIEXYZ(float[] c,
int intent)
Convert to from this colorspace to XYZ.
|
float[] |
toRGB(float[] components)
Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space.
|
float[] |
toRGB(float[] components,
int intent)
Transforms a color value assumed to be in this ColorSpace into a value in the default CS_sRGB color space.
|
int[] |
toRGB(int[] in,
int[] out,
int intent) |
String |
toString()
Return the String version of this object.
|
getInstance
public static final int CLASS_INPUT
ICC_Profile.CLASS_INPUT
public static final int CLASS_DISPLAY
ICC_Profile.CLASS_DISPLAY
public static final int CLASS_OUTPUT
ICC_Profile.CLASS_OUTPUT
public static final int CLASS_DEVICELINK
ICC_Profile.CLASS_DEVICELINK
public static final int CLASS_COLORSPACECONVERSION
ICC_Profile.CLASS_COLORSPACECONVERSION
public static final int CLASS_ABSTRACT
ICC_Profile.CLASS_ABSTRACT
public static final int CLASS_NAMEDCOLOR
ICC_Profile.CLASS_NAMEDCOLOR
.getNamedColors()
,
Constant Field Valuespublic static final int INTENT_PERCEPTUAL
public static final int INTENT_RELATIVE
public static final int INTENT_SATURATION
public static final int INTENT_ABSOLUTE
public ICCColorSpace(ICC_Profile profile) throws IOException
ICC_Profile
.
The bytes from the supplied profile are re-read so the two objects
are completely independent.profile
- the ICC_Profile to loadIOException
- if the profile cannot be readpublic ICCColorSpace(InputStream input) throws IOException
input
- the stream containing the ICC_Profile to loadIOException
- if the profile cannot be readpublic ICC_Profile createICC_Profile()
ICC_Profile
from this classpublic InputStream getProfileData()
public String getDescription()
public int getMajorVersion()
ICC_Profile.getMajorVersion()
public int getMinorVersion()
ICC_Profile.getMinorVersion()
public int getPatchVersion()
ICC_Profile.getMinorVersion()
public int getPCSType()
ColorSpace.TYPE_XYZ
or ColorSpace.TYPE_Lab
ICC_Profile.getPCSType()
public int getProfileClass()
ICC_Profile.getProfileClass()
public boolean isCS_sRGB()
isCS_sRGB
in class ColorSpace
public float[] fromCIEXYZ(float[] xyz)
fromCIEXYZ
in class ColorSpace
public float[] toCIEXYZ(float[] components)
toCIEXYZ
in class ColorSpace
components
- a float array with length of at least getNumComponents()
public float[] fromRGB(float[] rgb)
fromRGB
in class ColorSpace
rgb
- a float array with length of at least 3public float[] fromRGB(float[] rgb, int intent)
rgb
- a float array with length of at least 3intent
- the Rendering Intent, one of INTENT_RELATIVE
, INTENT_PERCEPTUAL
, INTENT_SATURATION
or INTENT_ABSOLUTE
public float[] toRGB(float[] components)
toRGB
in class ColorSpace
components
- a float array with length of at least getNumComponents()
public float[] toRGB(float[] components, int intent)
components
- a float array with length of at least getNumComponents()
intent
- the Rendering Intent, one of INTENT_RELATIVE
, INTENT_PERCEPTUAL
, INTENT_SATURATION
or INTENT_ABSOLUTE
public int getType()
ColorSpace.TYPE_RGB
, ColorSpace.TYPE_XYZ
, ...).
The type defines the number of components of the color space and the interpretation, e.g.
ColorSpace.TYPE_RGB
identifies a color space with three components - red, green, and blue.
It does not define the particular color characteristics of the space, e.g. the chromaticities of
the primaries.getType
in class ColorSpace
public int getNumComponents()
getNumComponents
in class ColorSpace
public float getMaxValue(int component)
getMaxValue
in class ColorSpace
component
- the component index, from 0 to getNumComponents()
-1public float getMinValue(int component)
getMinValue
in class ColorSpace
component
- the component index, from 0 to getNumComponents()
-1public Map<String,SpotColorSpace> getNamedColors()
CLASS_NAMEDCOLOR
profile class
, return a map of
named colors to SpotColorSpaces defined by this profile.
Otherwise return null.public String getName(int c)
getName
in class ColorSpace
c
- the component index, from 0 to getNumComponents()
-1public int[] toRGB(int[] in, int[] out, int intent)
public float[] toCIEXYZ(float[] c, int intent)
toCIEXYZ(float[])
except that you can also specify the rendering intentc
- a float array with length of at least getNumComponents()
intent
- the Rendering Intent, one of INTENT_RELATIVE
, INTENT_PERCEPTUAL
, INTENT_SATURATION
or INTENT_ABSOLUTE
public float[] fromCIEXYZ(float[] xyz, int intent)
fromCIEXYZ(float[])
except that you can also specify the rendering intentxyz
- a float array with length of at least 3intent
- the Rendering Intent, one of INTENT_RELATIVE
, INTENT_PERCEPTUAL
, INTENT_SATURATION
or INTENT_ABSOLUTE
public String toString()
public void setMetaData(String metadata)
PDF.setMetaData
for more information.metadata
- the XML data to embed into the document, or null
to clear any existing metadata. No validation is performed on this input.public Reader getMetaData() throws IOException
Return any XML metadata associated with this object. See the
PDF.getMetaData()
for more information.
Note that JPEG2000 images may have more than one MetaData stream embedded in
them. If this is the case, in order to present only a single root node to the
XML Parser, the XML objects are all wrapped in a single <JPEG2000>
node
Since 2.24.3, the returned type is guaranteed to hava a toString()
method that
will return the Metadata as a String.
Reader
containing the source of the XML or null if no metadata is available.IOException
- if the metadata can't be extractedCopyright © 2001-2021 Big Faceless Organization