icc
Class ICCProfile

java.lang.Object
  |
  +--icc.ICCProfile
Direct Known Subclasses:
ICCMatrixBasedInputProfile, ICCMonochromeInputProfile

public abstract class ICCProfile
extends java.lang.Object

This class models the ICCProfile file. This file is a binary file which is divided into two parts, an ICCProfileHeader followed by an ICCTagTable. The header is a straightforward list of descriptive parameters such as profile size, version, date and various more esoteric parameters. The tag table is a structured list of more complexly aggragated data describing things such as ICC curves, copyright information, descriptive text blocks, etc. Classes exist to model the header and tag table and their various constituent parts the developer is refered to these for further information on the structure and contents of the header and tag table.

See Also:
jj2000.j2k.icc.types.ICCProfileHeader, jj2000.j2k.icc.tags.ICCTagTable

Nested Class Summary
private static class ICCProfile.BoxType
           
 
Field Summary
static int BITS_PER_BYTE
           
static int BITS_PER_INT
           
static int BITS_PER_LONG
           
static int BITS_PER_SHORT
           
static int BLUE
          RGB index.
static int boolean_size
          Size of native type
static int byte_size
          Size of native type
static int BYTES_PER_INT
           
static int BYTES_PER_LONG
           
static int BYTES_PER_SHORT
           
static int char_size
          Size of native type
private  byte[] data
           
static int double_size
          Size of native type
private static java.lang.String eol
           
static int float_size
          Size of native type
static int GRAY
          Gray index.
static int GREEN
          RGB index.
private  ICCProfileHeader header
           
static int int_size
          Size of native type
static int kdwBlueColorantTag
          tag signature
static int kdwBlueTRCTag
          tag signature
static int kdwCopyrightTag
          tag signature
static int kdwDisplayProfile
          tag type
static int kdwGrayData
          tag type
static int kdwGrayTRCTag
          tag signature
static int kdwGreenColorantTag
          tag signature
static int kdwGreenTRCTag
          tag signature
static int kdwInputProfile
          profile type
static int kdwMediaWhiteTag
          tag signature
static int kdwProfileDescTag
          tag signature
static int kdwProfileSignature
          signature
static int kdwProfileSigReverse
          signature
static int kdwRedColorantTag
          tag signature
static int kdwRedTRCTag
          tag signature
static int kdwRGBData
          tag type
static int kdwXYZData
          tag type
static int kMonochromeInput
          input type
static int kThreeCompInput
          input type
static int long_size
          Size of native type
private  ParameterList pl
           
private  byte[] profile
           
static int RED
          RGB index.
static int short_size
          Size of native type
private  ICCTagTable tags
           
 
Constructor Summary
private ICCProfile()
           
protected ICCProfile(ColorSpace csm)
          ParameterList constructor
 
Method Summary
private  int getCMMFlags()
           
private  int getCMMTypeSignature()
           
private  int getColorSpaceType()
           
private  int getCreatorSig()
           
private  int getDeviceAttributes1()
           
private  int getDeviceAttributesReserved()
           
private  int getDeviceManufacturer()
           
private  int getDeviceModel()
           
 ICCProfileHeader getHeader()
          Access the profile header
static ICCDateTime getICCDateTime(byte[] data, int offset)
          Create an ICCDateTime from byte [] input
static ICCProfileVersion getICCProfileVersion(byte[] data, int offset)
          Create an ICCProfileVersion from byte [] input
static int getInt(byte[] bfr, int off)
          Create an int from a byte [4].
static int getInt(byte[] bfr, int off, boolean swap)
          Create an int from a byte [4], with optional byte swapping.
static int getIntFromString(java.lang.String fourChar)
          Creates an int from a 4 character String
static long getLong(byte[] bfr, int off)
          Create an long from a byte [8].
private  int getPCSType()
           
private  int getPlatformSignature()
           
private  int getProfileClass()
           
private  int getProfileSignature()
           
private  int getProfileSize()
           
private  ICCProfileVersion getProfileVersion()
           
private  int getRenderingIntent()
           
static short getShort(byte[] bfr, int off)
          Create a short from a two byte [].
static short getShort(byte[] bfr, int off, boolean swap)
          Create a short from a two byte [], with optional byte swapping.
static java.lang.String getString(byte[] bfr, int offset, int length, boolean swap)
          Create a String from a byte [].
 ICCTagTable getTagTable()
          Access the profile tag table
static XYZNumber getXYZNumber(byte[] data, int offset)
          Create an XYZNumber from byte [] input
private  void initProfile(byte[] data)
          Read the header and tags into memory and verify that the correct type of profile is being used.
 RestrictedICCProfile parse()
          Parse this ICCProfile into a RestrictedICCProfile which is appropriate to the data in this profile.
private  void setCMMFlags(int cmmflags)
           
private  void setCMMTypeSignature(int cmmsig)
           
private  void setColorSpaceType(int colorspace)
           
private  void setCreatorSig(int creatorsig)
           
private  void setDateTime(ICCDateTime datetime)
           
private  void setDeviceAttributes1(int attr1)
           
private  void setDeviceAttributesReserved(int attrreserved)
           
private  void setDeviceManufacturer(int manufacturer)
           
private  void setDeviceModel(int model)
           
static byte[] setInt(int d)
          Separate bytes in an int into a byte array lsb to msb order.
static byte[] setInt(int d, byte[] b)
          Separate bytes in an int into a byte array lsb to msb order.
static byte[] setLong(long d)
          Separate bytes in a long into a byte array lsb to msb order.
static byte[] setLong(long d, byte[] b)
          Separate bytes in a long into a byte array lsb to msb order.
private  void setPCSIlluminant(XYZNumber xyz)
           
private  void setPCSType(int PCStype)
           
private  void setPlatformSignature(int platformsig)
           
private  void setProfileClass(int pclass)
           
private  void setProfileSignature(int profilesig)
           
private  void setProfileSize(int size)
           
private  void setProfileVersion(ICCProfileVersion version)
           
private  void setRenderingIntent(int rendering)
           
static java.lang.String toHexString(byte i)
          Create a two character hex representation of a byte
static java.lang.String toHexString(int i)
          Create a 8 character hex representation of a int
static java.lang.String toHexString(short i)
          Create a 4 character hex representation of a short
 java.lang.String toString()
          Provide a suitable string representation for the class
static java.lang.String toString(byte[] data)
           
 void write(java.io.RandomAccessFile os)
          Output this ICCProfile to a RandomAccessFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eol

private static final java.lang.String eol

GRAY

public static final int GRAY
Gray index.

See Also:
Constant Field Values

RED

public static final int RED
RGB index.

See Also:
Constant Field Values

GREEN

public static final int GREEN
RGB index.

See Also:
Constant Field Values

BLUE

public static final int BLUE
RGB index.

See Also:
Constant Field Values

boolean_size

public static final int boolean_size
Size of native type

See Also:
Constant Field Values

byte_size

public static final int byte_size
Size of native type

See Also:
Constant Field Values

char_size

public static final int char_size
Size of native type

See Also:
Constant Field Values

short_size

public static final int short_size
Size of native type

See Also:
Constant Field Values

int_size

public static final int int_size
Size of native type

See Also:
Constant Field Values

float_size

public static final int float_size
Size of native type

See Also:
Constant Field Values

long_size

public static final int long_size
Size of native type

See Also:
Constant Field Values

double_size

public static final int double_size
Size of native type

See Also:
Constant Field Values

BITS_PER_BYTE

public static final int BITS_PER_BYTE
See Also:
Constant Field Values

BITS_PER_SHORT

public static final int BITS_PER_SHORT
See Also:
Constant Field Values

BITS_PER_INT

public static final int BITS_PER_INT
See Also:
Constant Field Values

BITS_PER_LONG

public static final int BITS_PER_LONG
See Also:
Constant Field Values

BYTES_PER_SHORT

public static final int BYTES_PER_SHORT
See Also:
Constant Field Values

BYTES_PER_INT

public static final int BYTES_PER_INT
See Also:
Constant Field Values

BYTES_PER_LONG

public static final int BYTES_PER_LONG
See Also:
Constant Field Values

kdwProfileSignature

public static final int kdwProfileSignature
signature


kdwProfileSigReverse

public static final int kdwProfileSigReverse
signature


kdwInputProfile

public static final int kdwInputProfile
profile type


kdwDisplayProfile

public static final int kdwDisplayProfile
tag type


kdwRGBData

public static final int kdwRGBData
tag type


kdwGrayData

public static final int kdwGrayData
tag type


kdwXYZData

public static final int kdwXYZData
tag type


kMonochromeInput

public static final int kMonochromeInput
input type

See Also:
Constant Field Values

kThreeCompInput

public static final int kThreeCompInput
input type

See Also:
Constant Field Values

kdwGrayTRCTag

public static final int kdwGrayTRCTag
tag signature


kdwRedColorantTag

public static final int kdwRedColorantTag
tag signature


kdwGreenColorantTag

public static final int kdwGreenColorantTag
tag signature


kdwBlueColorantTag

public static final int kdwBlueColorantTag
tag signature


kdwRedTRCTag

public static final int kdwRedTRCTag
tag signature


kdwGreenTRCTag

public static final int kdwGreenTRCTag
tag signature


kdwBlueTRCTag

public static final int kdwBlueTRCTag
tag signature


kdwCopyrightTag

public static final int kdwCopyrightTag
tag signature


kdwMediaWhiteTag

public static final int kdwMediaWhiteTag
tag signature


kdwProfileDescTag

public static final int kdwProfileDescTag
tag signature


header

private ICCProfileHeader header

tags

private ICCTagTable tags

profile

private byte[] profile

data

private byte[] data

pl

private ParameterList pl
Constructor Detail

ICCProfile

private ICCProfile()
            throws ICCProfileException

ICCProfile

protected ICCProfile(ColorSpace csm)
              throws ColorSpaceException,
                     ICCProfileInvalidException
ParameterList constructor

Method Detail

getIntFromString

public static int getIntFromString(java.lang.String fourChar)
Creates an int from a 4 character String

Parameters:
fourChar - string representation of an integer
Returns:
the integer which is denoted by the input String.

getXYZNumber

public static XYZNumber getXYZNumber(byte[] data,
                                     int offset)
Create an XYZNumber from byte [] input

Parameters:
data - array containing the XYZNumber representation
offset - start of the rep in the array
Returns:
the created XYZNumber

getICCProfileVersion

public static ICCProfileVersion getICCProfileVersion(byte[] data,
                                                     int offset)
Create an ICCProfileVersion from byte [] input

Parameters:
data - array containing the ICCProfileVersion representation
offset - start of the rep in the array
Returns:
the created ICCProfileVersion

getICCDateTime

public static ICCDateTime getICCDateTime(byte[] data,
                                         int offset)
Create an ICCDateTime from byte [] input

Parameters:
data - array containing the ICCProfileVersion representation
offset - start of the rep in the array
Returns:
the created ICCProfileVersion

getString

public static java.lang.String getString(byte[] bfr,
                                         int offset,
                                         int length,
                                         boolean swap)
Create a String from a byte []. Optionally swap adjacent byte pairs. Intended to be used to create integer String representations allowing for endian translations.

Parameters:
bfr - data array
offset - start of data in array
length - length of data in array
swap - swap adjacent bytes?
Returns:
String rep of data

getShort

public static short getShort(byte[] bfr,
                             int off,
                             boolean swap)
Create a short from a two byte [], with optional byte swapping.

Parameters:
bfr - data array
off - start of data in array
swap - swap bytes?
Returns:
native type from representation.

getShort

public static short getShort(byte[] bfr,
                             int off)
Create a short from a two byte [].

Parameters:
bfr - data array
off - start of data in array
Returns:
native type from representation.

setInt

public static byte[] setInt(int d)
Separate bytes in an int into a byte array lsb to msb order.

Parameters:
d - integer to separate
Returns:
byte [] containing separated int.

setInt

public static byte[] setInt(int d,
                            byte[] b)
Separate bytes in an int into a byte array lsb to msb order. Return the result in the provided array

Parameters:
d - integer to separate
b - return output here.
Returns:
reference to output.

setLong

public static byte[] setLong(long d)
Separate bytes in a long into a byte array lsb to msb order.

Parameters:
d - long to separate
Returns:
byte [] containing separated int.

setLong

public static byte[] setLong(long d,
                             byte[] b)
Separate bytes in a long into a byte array lsb to msb order. Return the result in the provided array

Parameters:
d - long to separate
b - return output here.
Returns:
reference to output.

getInt

public static int getInt(byte[] bfr,
                         int off,
                         boolean swap)
Create an int from a byte [4], with optional byte swapping.

Parameters:
bfr - data array
off - start of data in array
swap - swap bytes?
Returns:
native type from representation.

getInt

public static int getInt(byte[] bfr,
                         int off)
Create an int from a byte [4].

Parameters:
bfr - data array
off - start of data in array
Returns:
native type from representation.

getLong

public static long getLong(byte[] bfr,
                           int off)
Create an long from a byte [8].

Parameters:
bfr - data array
off - start of data in array
Returns:
native type from representation.

getProfileSize

private int getProfileSize()

getCMMTypeSignature

private int getCMMTypeSignature()

getProfileClass

private int getProfileClass()

getColorSpaceType

private int getColorSpaceType()

getPCSType

private int getPCSType()

getProfileSignature

private int getProfileSignature()

getPlatformSignature

private int getPlatformSignature()

getCMMFlags

private int getCMMFlags()

getDeviceManufacturer

private int getDeviceManufacturer()

getDeviceModel

private int getDeviceModel()

getDeviceAttributes1

private int getDeviceAttributes1()

getDeviceAttributesReserved

private int getDeviceAttributesReserved()

getRenderingIntent

private int getRenderingIntent()

getCreatorSig

private int getCreatorSig()

getProfileVersion

private ICCProfileVersion getProfileVersion()

setProfileSignature

private void setProfileSignature(int profilesig)

setProfileSize

private void setProfileSize(int size)

setCMMTypeSignature

private void setCMMTypeSignature(int cmmsig)

setProfileClass

private void setProfileClass(int pclass)

setColorSpaceType

private void setColorSpaceType(int colorspace)

setPCSIlluminant

private void setPCSIlluminant(XYZNumber xyz)

setPCSType

private void setPCSType(int PCStype)

setPlatformSignature

private void setPlatformSignature(int platformsig)

setCMMFlags

private void setCMMFlags(int cmmflags)

setDeviceManufacturer

private void setDeviceManufacturer(int manufacturer)

setDeviceModel

private void setDeviceModel(int model)

setDeviceAttributes1

private void setDeviceAttributes1(int attr1)

setDeviceAttributesReserved

private void setDeviceAttributesReserved(int attrreserved)

setRenderingIntent

private void setRenderingIntent(int rendering)

setCreatorSig

private void setCreatorSig(int creatorsig)

setProfileVersion

private void setProfileVersion(ICCProfileVersion version)

setDateTime

private void setDateTime(ICCDateTime datetime)

initProfile

private void initProfile(byte[] data)
                  throws ICCProfileInvalidException
Read the header and tags into memory and verify that the correct type of profile is being used. for encoding.

Parameters:
data - ICCProfile
Throws:
ICCProfileInvalidException - for bad signature and class and bad type

toString

public java.lang.String toString()
Provide a suitable string representation for the class

Overrides:
toString in class java.lang.Object

toHexString

public static java.lang.String toHexString(byte i)
Create a two character hex representation of a byte

Parameters:
i - byte to represent
Returns:
representation

toHexString

public static java.lang.String toHexString(short i)
Create a 4 character hex representation of a short

Parameters:
i - short to represent
Returns:
representation

toHexString

public static java.lang.String toHexString(int i)
Create a 8 character hex representation of a int

Parameters:
i - int to represent
Returns:
representation

toString

public static java.lang.String toString(byte[] data)

getHeader

public ICCProfileHeader getHeader()
Access the profile header

Returns:
ICCProfileHeader

getTagTable

public ICCTagTable getTagTable()
Access the profile tag table

Returns:
ICCTagTable

parse

public RestrictedICCProfile parse()
                           throws ICCProfileInvalidException
Parse this ICCProfile into a RestrictedICCProfile which is appropriate to the data in this profile. Either a MonochromeInputRestrictedProfile or MatrixBasedRestrictedProfile is returned

Returns:
RestrictedICCProfile
Throws:
ICCProfileInvalidException - no curve data

write

public void write(java.io.RandomAccessFile os)
           throws java.io.IOException
Output this ICCProfile to a RandomAccessFile

Parameters:
os - output file
java.io.IOException