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)
CLASS_INPUT
public static final int CLASS_INPUT
ICC Profile classes
icHdrPcs
public static final int icHdrPcs
icHdrSize
public static final int icHdrSize
Header offsets
icPerceptual
public static final int icPerceptual
Rendering intents
icSigAToB0Tag
public static final int icSigAToB0Tag
Tag signatures
icSigHead
public static final int icSigHead
Non-ICC tag 'head' for use in retrieving the header with getData()
icSigInputClass
public static final int icSigInputClass
ICC Profile class signatures
icSigXYZData
public static final int icSigXYZData
Color space signatures
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.
- 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.
tagSignature
- The ICC signature of the requested tag
- 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.
data
- - the profile data
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.
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.
in
- - the input stream to read the profile from.
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.
filename
- - the file name of the profile file.
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.
tagSignature
- - The signature of the tag to setdata
- - 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.
out
- - The outputstream to which the profile data should be written
write
public void write(String filename)
throws IOException
Writes the profile data to an ICC profile file.
filename
- - The name of the file to write
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.