java.awt.color

Class ICC_Profile

Implemented Interfaces:
Serializable
Known Direct Subclasses:
ICC_ProfileGray, ICC_ProfileRGB

public class ICC_Profile
extends Object
implements Serializable

ICC Profile - represents an ICC Color profile. The ICC profile format is a standard file format which maps the transform from a device color space to a standard Profile Color Space (PCS), which can either be CIE L*a*b or CIE XYZ. (With the exception of device link profiles which map from one device space to another) ICC profiles calibrated to specific input/output devices are used when color fidelity is of importance. An instance of ICC_Profile can be created using the getInstance() methods, either using one of the predefined color spaces enumerated in ColorSpace, or from an ICC profile file, or from an input stream. An ICC_ColorSpace object can then be created to transform color values through the profile. The ICC_Profile class implements the version 2 format specified by International Color Consortium Specification ICC.1:1998-09, and its addendum ICC.1A:1999-04, April 1999 (available at www.color.org)
Since:
1.2
See Also:
Serialized Form

Field Summary

static int
CLASS_ABSTRACT
static int
CLASS_COLORSPACECONVERSION
static int
CLASS_DEVICELINK
static int
CLASS_DISPLAY
static int
CLASS_INPUT
ICC Profile classes
static int
CLASS_NAMEDCOLOR
static int
CLASS_OUTPUT
static int
icAbsoluteColorimetric
static int
icCurveCount
static int
icCurveData
static int
icHdrAttributes
static int
icHdrCmmId
static int
icHdrColorSpace
static int
icHdrCreator
static int
icHdrDate
static int
icHdrDeviceClass
static int
icHdrFlags
static int
icHdrIlluminant
static int
icHdrMagic
static int
icHdrManufacturer
static int
icHdrModel
static int
icHdrPcs
static int
icHdrPlatform
static int
icHdrRenderingIntent
static int
icHdrSize
Header offsets
static int
icHdrVersion
static int
icPerceptual
Rendering intents
static int
icRelativeColorimetric
static int
icSaturation
static int
icSigAToB0Tag
Tag signatures
static int
icSigAToB1Tag
static int
icSigAToB2Tag
static int
icSigAbstractClass
static int
icSigBToA0Tag
static int
icSigBToA1Tag
static int
icSigBToA2Tag
static int
icSigBlueColorantTag
static int
icSigBlueTRCTag
static int
icSigCalibrationDateTimeTag
static int
icSigCharTargetTag
static int
icSigChromaticityTag
static int
icSigCmyData
static int
icSigCmykData
static int
icSigColorSpaceClass
static int
icSigCopyrightTag
static int
icSigCrdInfoTag
static int
icSigDeviceMfgDescTag
static int
icSigDeviceModelDescTag
static int
icSigDeviceSettingsTag
static int
icSigDisplayClass
static int
icSigGamutTag
static int
icSigGrayData
static int
icSigGrayTRCTag
static int
icSigGreenColorantTag
static int
icSigGreenTRCTag
static int
icSigHead
Non-ICC tag 'head' for use in retrieving the header with getData()
static int
icSigHlsData
static int
icSigHsvData
static int
icSigInputClass
ICC Profile class signatures
static int
icSigLabData
static int
icSigLinkClass
static int
icSigLuminanceTag
static int
icSigLuvData
static int
icSigMeasurementTag
static int
icSigMediaBlackPointTag
static int
icSigMediaWhitePointTag
static int
icSigNamedColor2Tag
static int
icSigNamedColorClass
static int
icSigOutputClass
static int
icSigOutputResponseTag
static int
icSigPreview0Tag
static int
icSigPreview1Tag
static int
icSigPreview2Tag
static int
icSigProfileDescriptionTag
static int
icSigProfileSequenceDescTag
static int
icSigPs2CRD0Tag
static int
icSigPs2CRD1Tag
static int
icSigPs2CRD2Tag
static int
icSigPs2CRD3Tag
static int
icSigPs2CSATag
static int
icSigPs2RenderingIntentTag
static int
icSigRedColorantTag
static int
icSigRedTRCTag
static int
icSigRgbData
static int
icSigScreeningDescTag
static int
icSigScreeningTag
static int
icSigSpace2CLR
static int
icSigSpace3CLR
static int
icSigSpace4CLR
static int
icSigSpace5CLR
static int
icSigSpace6CLR
static int
icSigSpace7CLR
static int
icSigSpace8CLR
static int
icSigSpace9CLR
static int
icSigSpaceACLR
static int
icSigSpaceBCLR
static int
icSigSpaceCCLR
static int
icSigSpaceDCLR
static int
icSigSpaceECLR
static int
icSigSpaceFCLR
static int
icSigTechnologyTag
static int
icSigUcrBgTag
static int
icSigViewingCondDescTag
static int
icSigViewingConditionsTag
static int
icSigXYZData
Color space signatures
static int
icSigYCbCrData
static int
icSigYxyData
static int
icTagReserved
static int
icTagType
static int
icXYZNumberX

Method Summary

protected void
finalize()
Free up the used memory.
int
getColorSpaceType()
Returns the color space of this profile, in terms of the color space constants defined in ColorSpace.
byte[]
getData()
Returns the data corresponding to this ICC_Profile as a byte array.
byte[]
getData(int tagSignature)
Returns the ICC profile tag data The non ICC-tag icSigHead is also permitted to request the header data.
static ICC_Profile
getInstance(byte[] data)
Returns an ICC_Profile instance from a byte array of profile data.
static ICC_Profile
getInstance(int cspace)
Returns an predefined ICC_Profile instance.
static ICC_Profile
getInstance(InputStream in)
Returns an ICC_Profile instance from an InputStream.
static ICC_Profile
getInstance(String filename)
Returns an ICC_Profile instance from an ICC Profile file.
int
getMajorVersion()
Returns the major version number
int
getMinorVersion()
Returns the minor version number.
int
getNumComponents()
Get the number of components in the profile's device color space.
int
getPCSType()
Returns the color space of this profile's Profile Connection Space (OCS) In terms of the color space constants defined in ColorSpace.
int
getProfileClass()
Returns the device class of this profile, (E.g.
protected Object
readResolve()
After deserializing we must determine if the class we want is really one of the more specialized ICC_ProfileRGB or ICC_ProfileGray classes.
void
setData(int tagSignature, byte[] data)
Sets the ICC profile tag data.
void
write(OutputStream out)
Writes the profile data in ICC profile file-format to a stream.
void
write(String filename)
Writes the profile data to an ICC profile file.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

CLASS_ABSTRACT

public static final int CLASS_ABSTRACT
Field Value:
5

CLASS_COLORSPACECONVERSION

public static final int CLASS_COLORSPACECONVERSION
Field Value:
4

CLASS_DEVICELINK

public static final int CLASS_DEVICELINK
Field Value:
3

CLASS_DISPLAY

public static final int CLASS_DISPLAY
Field Value:
1

CLASS_INPUT

public static final int CLASS_INPUT
ICC Profile classes
Field Value:
0

CLASS_NAMEDCOLOR

public static final int CLASS_NAMEDCOLOR
Field Value:
6

CLASS_OUTPUT

public static final int CLASS_OUTPUT
Field Value:
2

icAbsoluteColorimetric

public static final int icAbsoluteColorimetric
Field Value:
3

icCurveCount

public static final int icCurveCount
Field Value:
8

icCurveData

public static final int icCurveData
Field Value:
12

icHdrAttributes

public static final int icHdrAttributes
Field Value:
56

icHdrCmmId

public static final int icHdrCmmId
Field Value:
4

icHdrColorSpace

public static final int icHdrColorSpace
Field Value:
16

icHdrCreator

public static final int icHdrCreator
Field Value:
80

icHdrDate

public static final int icHdrDate
Field Value:
24

icHdrDeviceClass

public static final int icHdrDeviceClass
Field Value:
12

icHdrFlags

public static final int icHdrFlags
Field Value:
44

icHdrIlluminant

public static final int icHdrIlluminant
Field Value:
68

icHdrMagic

public static final int icHdrMagic
Field Value:
36

icHdrManufacturer

public static final int icHdrManufacturer
Field Value:
48

icHdrModel

public static final int icHdrModel
Field Value:
52

icHdrPcs

public static final int icHdrPcs
Field Value:
20

icHdrPlatform

public static final int icHdrPlatform
Field Value:
40

icHdrRenderingIntent

public static final int icHdrRenderingIntent
Field Value:
64

icHdrSize

public static final int icHdrSize
Header offsets
Field Value:
0

icHdrVersion

public static final int icHdrVersion
Field Value:
8

icPerceptual

public static final int icPerceptual
Rendering intents
Field Value:
0

icRelativeColorimetric

public static final int icRelativeColorimetric
Field Value:
1

icSaturation

public static final int icSaturation
Field Value:
2

icSigAToB0Tag

public static final int icSigAToB0Tag
Tag signatures
Field Value:
1093812784

icSigAToB1Tag

public static final int icSigAToB1Tag
Field Value:
1093812785

icSigAToB2Tag

public static final int icSigAToB2Tag
Field Value:
1093812786

icSigAbstractClass

public static final int icSigAbstractClass
Field Value:
1633842036

icSigBToA0Tag

public static final int icSigBToA0Tag
Field Value:
1110589744

icSigBToA1Tag

public static final int icSigBToA1Tag
Field Value:
1110589745

icSigBToA2Tag

public static final int icSigBToA2Tag
Field Value:
1110589746

icSigBlueColorantTag

public static final int icSigBlueColorantTag
Field Value:
1649957210

icSigBlueTRCTag

public static final int icSigBlueTRCTag
Field Value:
1649693251

icSigCalibrationDateTimeTag

public static final int icSigCalibrationDateTimeTag
Field Value:
1667329140

icSigCharTargetTag

public static final int icSigCharTargetTag
Field Value:
1952543335

icSigChromaticityTag

public static final int icSigChromaticityTag
Field Value:
1667789421

icSigCmyData

public static final int icSigCmyData
Field Value:
1129142560

icSigCmykData

public static final int icSigCmykData
Field Value:
1129142603

icSigColorSpaceClass

public static final int icSigColorSpaceClass
Field Value:
1936744803

icSigCopyrightTag

public static final int icSigCopyrightTag
Field Value:
1668313716

icSigCrdInfoTag

public static final int icSigCrdInfoTag
Field Value:
1668441193

icSigDeviceMfgDescTag

public static final int icSigDeviceMfgDescTag
Field Value:
1684893284

icSigDeviceModelDescTag

public static final int icSigDeviceModelDescTag
Field Value:
1684890724

icSigDeviceSettingsTag

public static final int icSigDeviceSettingsTag
Field Value:
1684371059

icSigDisplayClass

public static final int icSigDisplayClass
Field Value:
1835955314

icSigGamutTag

public static final int icSigGamutTag
Field Value:
1734438260

icSigGrayData

public static final int icSigGrayData
Field Value:
1196573017

icSigGrayTRCTag

public static final int icSigGrayTRCTag
Field Value:
1800688195

icSigGreenColorantTag

public static final int icSigGreenColorantTag
Field Value:
1733843290

icSigGreenTRCTag

public static final int icSigGreenTRCTag
Field Value:
1733579331

icSigHead

public static final int icSigHead
Non-ICC tag 'head' for use in retrieving the header with getData()
Field Value:
1751474532

icSigHlsData

public static final int icSigHlsData
Field Value:
1212961568

icSigHsvData

public static final int icSigHsvData
Field Value:
1213421088

icSigInputClass

public static final int icSigInputClass
ICC Profile class signatures
Field Value:
1935896178

icSigLabData

public static final int icSigLabData
Field Value:
1281450528

icSigLinkClass

public static final int icSigLinkClass
Field Value:
1818848875

icSigLuminanceTag

public static final int icSigLuminanceTag
Field Value:
1819635049

icSigLuvData

public static final int icSigLuvData
Field Value:
1282766368

icSigMeasurementTag

public static final int icSigMeasurementTag
Field Value:
1835360627

icSigMediaBlackPointTag

public static final int icSigMediaBlackPointTag
Field Value:
1651208308

icSigMediaWhitePointTag

public static final int icSigMediaWhitePointTag
Field Value:
2004119668

icSigNamedColor2Tag

public static final int icSigNamedColor2Tag
Field Value:
1852009522

icSigNamedColorClass

public static final int icSigNamedColorClass
Field Value:
1852662636

icSigOutputClass

public static final int icSigOutputClass
Field Value:
1886549106

icSigOutputResponseTag

public static final int icSigOutputResponseTag
Field Value:
1919251312

icSigPreview0Tag

public static final int icSigPreview0Tag
Field Value:
1886545200

icSigPreview1Tag

public static final int icSigPreview1Tag
Field Value:
1886545201

icSigPreview2Tag

public static final int icSigPreview2Tag
Field Value:
1886545202

icSigProfileDescriptionTag

public static final int icSigProfileDescriptionTag
Field Value:
1684370275

icSigProfileSequenceDescTag

public static final int icSigProfileSequenceDescTag
Field Value:
1886610801

icSigPs2CRD0Tag

public static final int icSigPs2CRD0Tag
Field Value:
1886610480

icSigPs2CRD1Tag

public static final int icSigPs2CRD1Tag
Field Value:
1886610481

icSigPs2CRD2Tag

public static final int icSigPs2CRD2Tag
Field Value:
1886610482

icSigPs2CRD3Tag

public static final int icSigPs2CRD3Tag
Field Value:
1886610483

icSigPs2CSATag

public static final int icSigPs2CSATag
Field Value:
1886597747

icSigPs2RenderingIntentTag

public static final int icSigPs2RenderingIntentTag
Field Value:
1886597737

icSigRedColorantTag

public static final int icSigRedColorantTag
Field Value:
1918392666

icSigRedTRCTag

public static final int icSigRedTRCTag
Field Value:
1918128707

icSigRgbData

public static final int icSigRgbData
Field Value:
1380401696

icSigScreeningDescTag

public static final int icSigScreeningDescTag
Field Value:
1935897188

icSigScreeningTag

public static final int icSigScreeningTag
Field Value:
1935897198

icSigSpace2CLR

public static final int icSigSpace2CLR
Field Value:
843271250

icSigSpace3CLR

public static final int icSigSpace3CLR
Field Value:
860048466

icSigSpace4CLR

public static final int icSigSpace4CLR
Field Value:
876825682

icSigSpace5CLR

public static final int icSigSpace5CLR
Field Value:
893602898

icSigSpace6CLR

public static final int icSigSpace6CLR
Field Value:
910380114

icSigSpace7CLR

public static final int icSigSpace7CLR
Field Value:
927157330

icSigSpace8CLR

public static final int icSigSpace8CLR
Field Value:
943934546

icSigSpace9CLR

public static final int icSigSpace9CLR
Field Value:
960711762

icSigSpaceACLR

public static final int icSigSpaceACLR
Field Value:
1094929490

icSigSpaceBCLR

public static final int icSigSpaceBCLR
Field Value:
1111706706

icSigSpaceCCLR

public static final int icSigSpaceCCLR
Field Value:
1128483922

icSigSpaceDCLR

public static final int icSigSpaceDCLR
Field Value:
1145261138

icSigSpaceECLR

public static final int icSigSpaceECLR
Field Value:
1162038354

icSigSpaceFCLR

public static final int icSigSpaceFCLR
Field Value:
1178815570

icSigTechnologyTag

public static final int icSigTechnologyTag
Field Value:
1952801640

icSigUcrBgTag

public static final int icSigUcrBgTag
Field Value:
1650877472

icSigViewingCondDescTag

public static final int icSigViewingCondDescTag
Field Value:
1987405156

icSigViewingConditionsTag

public static final int icSigViewingConditionsTag
Field Value:
1986618743

icSigXYZData

public static final int icSigXYZData
Color space signatures
Field Value:
1482250784

icSigYCbCrData

public static final int icSigYCbCrData
Field Value:
1497588338

icSigYxyData

public static final int icSigYxyData
Field Value:
1501067552

icTagReserved

public static final int icTagReserved
Field Value:
4

icTagType

public static final int icTagType
Field Value:
0

icXYZNumberX

public static final int icXYZNumberX
Field Value:
8

Method Details

finalize

protected void finalize()
Free up the used memory.
Overrides:
finalize in interface Object

getColorSpaceType

public int getColorSpaceType()
Returns the color space of this profile, in terms of the color space constants defined in ColorSpace. (For example, it may be a ColorSpace.TYPE_RGB)

getData

public byte[] getData()
Returns the data corresponding to this ICC_Profile as a byte array.
Returns:
The data in a byte array, where the first element corresponds to first byte of the profile file.

getData

public byte[] getData(int tagSignature)
Returns the ICC profile tag data The non ICC-tag icSigHead is also permitted to request the header data.
Parameters:
tagSignature - The ICC signature of the requested tag
Returns:
A byte array containing the tag data

getInstance

public static ICC_Profile getInstance(byte[] data)
Returns an ICC_Profile instance from a byte array of profile data. An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.
Parameters:
data - - the profile data
Returns:
An ICC_Profile object
Throws:
IllegalArgumentException - if the profile data is an invalid v2 profile.

getInstance

public static ICC_Profile getInstance(int cspace)
Returns an predefined ICC_Profile instance. This will construct an ICC_Profile instance from one of the predefined color spaces in the ColorSpace class. (e.g. CS_sRGB, CS_GRAY, etc) An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.
Returns:
An ICC_Profile object

getInstance

public static ICC_Profile getInstance(InputStream in)
            throws IOException
Returns an ICC_Profile instance from an InputStream. This method can be used for reading ICC profiles embedded in files which support this. (JPEG and SVG for instance). The stream is treated in the following way: The profile header (128 bytes) is read first, and the header is validated. If the profile header is valid, it will then attempt to read the rest of the profile from the stream. The stream is not closed after reading. An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.
Parameters:
in - - the input stream to read the profile from.
Returns:
An ICC_Profile object
Throws:
IllegalArgumentException - if the profile data is an invalid v2 profile.
IOException - if the stream could not be read.

getInstance

public static ICC_Profile getInstance(String filename)
            throws IOException
Returns an ICC_Profile instance from an ICC Profile file. An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray may be returned if appropriate.
Parameters:
filename - - the file name of the profile file.
Returns:
An ICC_Profile object
Throws:
IllegalArgumentException - if the profile data is an invalid v2 profile.
IOException - if the file could not be read.

getMajorVersion

public int getMajorVersion()
Returns the major version number

getMinorVersion

public int getMinorVersion()
Returns the minor version number. Only the least-significant byte contains data, in BCD form: the least-significant nibble is the BCD bug fix revision, the most-significant nibble is the BCD minor revision number. (E.g. For a v2.1.0 profile this will return 0x10)

getNumComponents

public int getNumComponents()
Get the number of components in the profile's device color space.

getPCSType

public int getPCSType()
Returns the color space of this profile's Profile Connection Space (OCS) In terms of the color space constants defined in ColorSpace. This may be TYPE_XYZ or TYPE_Lab

getProfileClass

public int getProfileClass()
Returns the device class of this profile, (E.g. CLASS_INPUT for a scanner profile, CLASS_OUTPUT for a printer)

readResolve

protected Object readResolve()
            throws ObjectStreamException
After deserializing we must determine if the class we want is really one of the more specialized ICC_ProfileRGB or ICC_ProfileGray classes.

setData

public void setData(int tagSignature,
                    byte[] data)
Sets the ICC profile tag data. Note that an ICC profile can only contain one tag of each type, if a tag already exists with the given signature, it is replaced.
Parameters:
tagSignature - - The signature of the tag to set
data - - A byte array containing the tag data

write

public void write(OutputStream out)
            throws IOException
Writes the profile data in ICC profile file-format to a stream. This is useful for embedding ICC profiles in file formats which support this (such as JPEG and SVG). The stream is not closed after writing.
Parameters:
out - - The outputstream to which the profile data should be written
Throws:
IOException - if the write failed.

write

public void write(String filename)
            throws IOException
Writes the profile data to an ICC profile file.
Parameters:
filename - - The name of the file to write
Throws:
IOException - if the write failed.

ICC_Profile.java -- color space profiling Copyright (C) 2000, 2002, 2004 Free Software Foundation This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.