Fields Summary |
---|
private static final long | serialVersionUIDThe Constant serialVersionUID. |
public static final int | CLASS_INPUTThe Constant CLASS_INPUT indicates that profile class is input. |
public static final int | CLASS_DISPLAYThe Constant CLASS_DISPLAY indicates that profile class is display. |
public static final int | CLASS_OUTPUTThe Constant CLASS_OUTPUT indicates that profile class is output. |
public static final int | CLASS_DEVICELINKThe Constant CLASS_DEVICELINK indicates that profile class is device
link. |
public static final int | CLASS_COLORSPACECONVERSIONThe Constant CLASS_COLORSPACECONVERSION indicates that profile class is
color space conversion. |
public static final int | CLASS_ABSTRACTThe Constant CLASS_ABSTRACT indicates that profile class is abstract. |
public static final int | CLASS_NAMEDCOLORThe Constant CLASS_NAMEDCOLOR indicates that profile class is named
color. |
public static final int | icSigXYZDataThe Constant icSigXYZData - ICC Profile Color Space Type Signature. |
public static final int | icSigLabDataThe Constant icSigLabData - ICC Profile Color Space Type Signature. |
public static final int | icSigLuvDataThe Constant icSigLuvData - ICC Profile Color Space Type Signature. |
public static final int | icSigYCbCrDataThe Constant icSigYCbCrData - ICC Profile Color Space Type Signature. |
public static final int | icSigYxyDataThe Constant icSigYxyData - ICC Profile Color Space Type Signature. |
public static final int | icSigRgbDataThe Constant icSigRgbData - ICC Profile Color Space Type Signature. |
public static final int | icSigGrayDataThe Constant icSigGrayData - ICC Profile Color Space Type Signature. |
public static final int | icSigHsvDataThe Constant icSigHsvData - ICC Profile Color Space Type Signature. |
public static final int | icSigHlsDataThe Constant icSigHlsData - ICC Profile Color Space Type Signature. |
public static final int | icSigCmykDataThe Constant icSigCmykData - ICC Profile Color Space Type Signature. |
public static final int | icSigCmyDataThe Constant icSigCmyData - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace2CLRThe Constant icSigSpace2CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace3CLRThe Constant icSigSpace3CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace4CLRThe Constant icSigSpace4CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace5CLRThe Constant icSigSpace5CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace6CLRThe Constant icSigSpace6CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace7CLRThe Constant icSigSpace7CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace8CLRThe Constant icSigSpace8CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpace9CLRThe Constant icSigSpace9CLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpaceACLRThe Constant icSigSpaceACLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpaceBCLRThe Constant icSigSpaceBCLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpaceCCLRThe Constant icSigSpaceCCLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpaceDCLRThe Constant icSigSpaceDCLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpaceECLRThe Constant icSigSpaceECLR - ICC Profile Color Space Type Signature. |
public static final int | icSigSpaceFCLRThe Constant icSigSpaceFCLR - ICC Profile Color Space Type Signature. |
public static final int | icSigInputClassThe Constant icSigInputClass - ICC Profile Class Signature. |
public static final int | icSigDisplayClassThe Constant icSigDisplayClass - ICC Profile Class Signature. |
public static final int | icSigOutputClassThe Constant icSigOutputClass - ICC Profile Class Signature. |
public static final int | icSigLinkClassThe Constant icSigLinkClass - ICC Profile Class Signature. |
public static final int | icSigAbstractClassThe Constant icSigAbstractClass - ICC Profile Class Signature. |
public static final int | icSigColorantOrderTagThe Constant icSigColorantOrderTag - ICC Profile Tag Signature. |
public static final int | icSigColorantTableTagThe Constant icSigColorantTableTag - ICC Profile Tag Signature. |
public static final int | icSigColorSpaceClassThe Constant icSigColorSpaceClass - ICC Profile Tag Signature. |
public static final int | icSigNamedColorClassThe Constant icSigNamedColorClass - ICC Profile Tag Signature. |
public static final int | icPerceptualThe Constant icPerceptual - ICC Profile Rendering Intent. |
public static final int | icRelativeColorimetricThe Constant icRelativeColorimetric - ICC Profile Rendering Intent. |
public static final int | icSaturationThe Constant icSaturation - ICC Profile Rendering Intent. |
public static final int | icAbsoluteColorimetricThe Constant icAbsoluteColorimetric - ICC Profile Rendering Intent. |
public static final int | icSigHeadThe Constant icSigHead - ICC Profile Tag Signature. |
public static final int | icSigAToB0TagThe Constant icSigAToB0Tag - ICC Profile Tag Signature. |
public static final int | icSigAToB1TagThe Constant icSigAToB1Tag - ICC Profile Tag Signature. |
public static final int | icSigAToB2TagThe Constant icSigAToB2Tag - ICC Profile Tag Signature. |
public static final int | icSigBlueColorantTagThe Constant icSigBlueColorantTag - ICC Profile Tag Signature. |
public static final int | icSigBlueMatrixColumnTagThe Constant icSigBlueMatrixColumnTag - ICC Profile Tag Signature. |
public static final int | icSigBlueTRCTagThe Constant icSigBlueTRCTag - ICC Profile Tag Signature. |
public static final int | icSigBToA0TagThe Constant icSigBToA0Tag - ICC Profile Tag Signature. |
public static final int | icSigBToA1TagThe Constant icSigBToA1Tag - ICC Profile Tag Signature. |
public static final int | icSigBToA2TagThe Constant icSigBToA2Tag - ICC Profile Tag Signature. |
public static final int | icSigCalibrationDateTimeTagThe Constant icSigCalibrationDateTimeTag - ICC Profile Tag Signature. |
public static final int | icSigCharTargetTagThe Constant icSigCharTargetTag - ICC Profile Tag Signature. |
public static final int | icSigCopyrightTagThe Constant icSigCopyrightTag - ICC Profile Tag Signature. |
public static final int | icSigCrdInfoTagThe Constant icSigCrdInfoTag - ICC Profile Tag Signature. |
public static final int | icSigDeviceMfgDescTagThe Constant icSigDeviceMfgDescTag - ICC Profile Tag Signature. |
public static final int | icSigDeviceModelDescTagThe Constant icSigDeviceModelDescTag - ICC Profile Tag Signature. |
public static final int | icSigDeviceSettingsTagThe Constant icSigDeviceSettingsTag - ICC Profile Tag Signature. |
public static final int | icSigGamutTagThe Constant icSigGamutTag - ICC Profile Tag Signature. |
public static final int | icSigGrayTRCTagThe Constant icSigGrayTRCTag - ICC Profile Tag Signature. |
public static final int | icSigGreenColorantTagThe Constant icSigGreenColorantTag - ICC Profile Tag Signature. |
public static final int | icSigGreenMatrixColumnTagThe Constant icSigGreenMatrixColumnTag - ICC Profile Tag Signature. |
public static final int | icSigGreenTRCTagThe Constant icSigGreenTRCTag - ICC Profile Tag Signature. |
public static final int | icSigLuminanceTagThe Constant icSigLuminanceTag - ICC Profile Tag Signature. |
public static final int | icSigMeasurementTagThe Constant icSigMeasurementTag - ICC Profile Tag Signature. |
public static final int | icSigMediaBlackPointTagThe Constant icSigMediaBlackPointTag - ICC Profile Tag Signature. |
public static final int | icSigMediaWhitePointTagThe Constant icSigMediaWhitePointTag - ICC Profile Tag Signature. |
public static final int | icSigNamedColor2TagThe Constant icSigNamedColor2Tag - ICC Profile Tag Signature. |
public static final int | icSigOutputResponseTagThe Constant icSigOutputResponseTag - ICC Profile Tag Signature. |
public static final int | icSigPreview0TagThe Constant icSigPreview0Tag - ICC Profile Tag Signature. |
public static final int | icSigPreview1TagThe Constant icSigPreview1Tag - ICC Profile Tag Signature. |
public static final int | icSigPreview2TagThe Constant icSigPreview2Tag - ICC Profile Tag Signature. |
public static final int | icSigProfileDescriptionTagThe Constant icSigProfileDescriptionTag - ICC Profile Tag Signature. |
public static final int | icSigProfileSequenceDescTagThe Constant icSigProfileSequenceDescTag - ICC Profile Tag Signature. |
public static final int | icSigPs2CRD0TagThe Constant icSigPs2CRD0Tag - ICC Profile Tag Signature. |
public static final int | icSigPs2CRD1TagThe Constant icSigPs2CRD1Tag - ICC Profile Tag Signature. |
public static final int | icSigPs2CRD2TagThe Constant icSigPs2CRD2Tag - ICC Profile Tag Signature. |
public static final int | icSigPs2CRD3TagThe Constant icSigPs2CRD3Tag - ICC Profile Tag Signature. |
public static final int | icSigPs2CSATagThe Constant icSigPs2CSATag - ICC Profile Tag Signature. |
public static final int | icSigPs2RenderingIntentTagThe Constant icSigPs2RenderingIntentTag - ICC Profile Tag Signature. |
public static final int | icSigRedColorantTagThe Constant icSigRedColorantTag - ICC Profile Tag Signature. |
public static final int | icSigRedMatrixColumnTagThe Constant icSigRedMatrixColumnTag - ICC Profile Tag Signature. |
public static final int | icSigRedTRCTagThe Constant icSigRedTRCTag - ICC Profile Tag Signature. |
public static final int | icSigScreeningDescTagThe Constant icSigScreeningDescTag - ICC Profile Tag Signature. |
public static final int | icSigScreeningTagThe Constant icSigScreeningTag - ICC Profile Tag Signature. |
public static final int | icSigTechnologyTagThe Constant icSigTechnologyTag - ICC Profile Tag Signature. |
public static final int | icSigUcrBgTagThe Constant icSigUcrBgTag - ICC Profile Tag Signature. |
public static final int | icSigViewingCondDescTagThe Constant icSigViewingCondDescTag - ICC Profile Tag Signature. |
public static final int | icSigViewingConditionsTagThe Constant icSigViewingConditionsTag - ICC Profile Tag Signature. |
public static final int | icSigChromaticAdaptationTagThe Constant icSigChromaticAdaptationTag - ICC Profile Tag Signature. |
public static final int | icSigChromaticityTagThe Constant icSigChromaticityTag - ICC Profile Tag Signature. |
public static final int | icHdrSizeThe Constant icHdrSize - ICC Profile Header Location. |
public static final int | icHdrCmmIdThe Constant icHdrCmmId - ICC Profile Header Location. |
public static final int | icHdrVersionThe Constant icHdrVersion - ICC Profile Header Location. |
public static final int | icHdrDeviceClassThe Constant icHdrDeviceClass - ICC Profile Header Location. |
public static final int | icHdrColorSpaceThe Constant icHdrColorSpace - ICC Profile Header Location. |
public static final int | icHdrPcsThe Constant icHdrPcs - ICC Profile Header Location. |
public static final int | icHdrDateThe Constant icHdrDate - ICC Profile Header Location. |
public static final int | icHdrMagicThe Constant icHdrMagic - ICC Profile Header Location. |
public static final int | icHdrPlatformThe Constant icHdrPlatform - ICC Profile Header Location. |
public static final int | icHdrProfileIDThe Constant icHdrProfileID - ICC Profile Header Location. |
public static final int | icHdrFlagsThe Constant icHdrFlags - ICC Profile Header Location. |
public static final int | icHdrManufacturerThe Constant icHdrManufacturer - ICC Profile Header Location. |
public static final int | icHdrModelThe Constant icHdrModel - ICC Profile Header Location. |
public static final int | icHdrAttributesThe Constant icHdrAttributes - ICC Profile Header Location. |
public static final int | icHdrRenderingIntentThe Constant icHdrRenderingIntent - ICC Profile Header Location. |
public static final int | icHdrIlluminantThe Constant icHdrIlluminant - ICC Profile Header Location. |
public static final int | icHdrCreatorThe Constant icHdrCreator - ICC Profile Header Location. |
public static final int | icICCAbsoluteColorimetricThe Constant icICCAbsoluteColorimetric - ICC Profile Rendering Intent. |
public static final int | icMediaRelativeColorimetricThe Constant icMediaRelativeColorimetric - ICC Profile Rendering Intent. |
public static final int | icTagTypeThe Constant icTagType - ICC Profile Constant. |
public static final int | icTagReservedThe Constant icTagReserved - ICC Profile Constant. |
public static final int | icCurveCountThe Constant icCurveCount - ICC Profile Constant. |
public static final int | icCurveDataThe Constant icCurveData - ICC Profile Constant. |
public static final int | icXYZNumberXThe Constant icXYZNumberX - ICC Profile Constant. |
private static final int | headerSizeSize of a profile header. |
private static final int | headerMagicNumberheader magic number. |
private static ICC_Profile | sRGBProfileThe s rgb profile. |
private static ICC_Profile | xyzProfileThe xyz profile. |
private static ICC_Profile | grayProfileThe gray profile. |
private static ICC_Profile | pyccProfileThe pycc profile. |
private static ICC_Profile | linearRGBProfileThe linear rgb profile. |
private transient long | profileHandleHandle to the current profile. |
private transient boolean | handleStolenIf handle is used by another class this object is not responsible for
closing profile. |
private transient byte[] | headerDataCached header data. |
private transient ICC_Profile | openedProfileObjectSerialization support. |
Methods Summary |
---|
private int | csFromSignature(int signature)Converts ICC color space signature to the java predefined color space
type.
switch (signature) {
case icSigRgbData:
return ColorSpace.TYPE_RGB;
case icSigXYZData:
return ColorSpace.TYPE_XYZ;
case icSigCmykData:
return ColorSpace.TYPE_CMYK;
case icSigLabData:
return ColorSpace.TYPE_Lab;
case icSigGrayData:
return ColorSpace.TYPE_GRAY;
case icSigHlsData:
return ColorSpace.TYPE_HLS;
case icSigLuvData:
return ColorSpace.TYPE_Luv;
case icSigYCbCrData:
return ColorSpace.TYPE_YCbCr;
case icSigYxyData:
return ColorSpace.TYPE_Yxy;
case icSigHsvData:
return ColorSpace.TYPE_HSV;
case icSigCmyData:
return ColorSpace.TYPE_CMY;
case icSigSpace2CLR:
return ColorSpace.TYPE_2CLR;
case icSigSpace3CLR:
return ColorSpace.TYPE_3CLR;
case icSigSpace4CLR:
return ColorSpace.TYPE_4CLR;
case icSigSpace5CLR:
return ColorSpace.TYPE_5CLR;
case icSigSpace6CLR:
return ColorSpace.TYPE_6CLR;
case icSigSpace7CLR:
return ColorSpace.TYPE_7CLR;
case icSigSpace8CLR:
return ColorSpace.TYPE_8CLR;
case icSigSpace9CLR:
return ColorSpace.TYPE_9CLR;
case icSigSpaceACLR:
return ColorSpace.TYPE_ACLR;
case icSigSpaceBCLR:
return ColorSpace.TYPE_BCLR;
case icSigSpaceCCLR:
return ColorSpace.TYPE_CCLR;
case icSigSpaceDCLR:
return ColorSpace.TYPE_DCLR;
case icSigSpaceECLR:
return ColorSpace.TYPE_ECLR;
case icSigSpaceFCLR:
return ColorSpace.TYPE_FCLR;
default:
}
// awt.165=Color space doesn't comply with ICC specification
throw new IllegalArgumentException(Messages.getString("awt.165")); //$NON-NLS-1$
|
protected void | finalize()Frees the resources associated with an ICC_Profile object.
if (profileHandle != 0 && !handleStolen) {
NativeCMM.cmmCloseProfile(profileHandle);
}
// Always remove because key no more exist
// when object is destroyed
NativeCMM.removeHandle(this);
|
private byte | getByteFromHeader(int idx)Reads byte from the profile header at the specified position.
if (headerData == null) {
headerData = getData(icSigHead);
}
return headerData[idx];
|
public int | getColorSpaceType()Gets the color space type of this ICC_Profile.
return csFromSignature(getIntFromHeader(icHdrColorSpace));
|
public byte[] | getData(int tagSignature)Gets a tagged data element from the profile as a byte array. Elements are
identified by tag signatures as defined in the ICC specification.
int tagSize = 0;
try {
tagSize = NativeCMM.cmmGetProfileElementSize(profileHandle, tagSignature);
} catch (CMMException e) {
// We'll get this exception if there's no element with
// the specified tag signature
return null;
}
byte[] data = new byte[tagSize];
NativeCMM.cmmGetProfileElement(profileHandle, tagSignature, data);
return data;
|
public byte[] | getData()Gets a data byte array of this ICC_Profile.
int profileSize = NativeCMM.cmmGetProfileSize(profileHandle);
byte[] data = new byte[profileSize];
NativeCMM.cmmGetProfile(profileHandle, data);
return data;
|
private int | getDataSize(int tagSignature)Gets the data size.
return NativeCMM.cmmGetProfileElementSize(profileHandle, tagSignature);
|
float | getGamma(int tagSignature)Gets the gamma.
short[] dataTRC = null;
float gamma = getGammaOrTRC(tagSignature, dataTRC);
if (dataTRC == null) {
return gamma;
}
// awt.166=TRC is not a simple gamma value.
throw new ProfileDataException(Messages.getString("awt.166")); //$NON-NLS-1$
|
private float | getGammaOrTRC(int tagSignature, short[] dataTRC)If TRC is not a table returns gamma via return value and sets dataTRC to
null. If TRC is a table returns 0 and fills dataTRC with values.
byte[] data = getData(tagSignature);
int trcSize = ICC_ProfileHelper.getIntFromByteArray(data, icCurveCount);
dataTRC = null;
if (trcSize == 0) {
return 1.0f;
}
if (trcSize == 1) {
// Cast from ICC u8Fixed8Number to float
return ICC_ProfileHelper.getShortFromByteArray(data, icCurveData) / 256.f;
}
// TRC is a table
dataTRC = new short[trcSize];
for (int i = 0, pos = icCurveData; i < trcSize; i++, pos += 2) {
dataTRC[i] = ICC_ProfileHelper.getShortFromByteArray(data, pos);
}
return 0;
|
public static java.awt.color.ICC_Profile | getInstance(java.lang.String fileName)Gets the single instance of ICC_Profile from data in the specified file.
final String fName = fileName; // to use in the privileged block
FileInputStream fiStream = (FileInputStream)AccessController
.doPrivileged(new PrivilegedAction<FileInputStream>() {
public FileInputStream run() {
FileInputStream fiStream = null;
// Open absolute path
try {
fiStream = new FileInputStream(fName);
if (fiStream != null) {
return fiStream;
}
} catch (FileNotFoundException e) {
}
// Check java.iccprofile.path entries
fiStream = tryPath(System.getProperty("java.iccprofile.path"), fName); //$NON-NLS-1$
if (fiStream != null) {
return fiStream;
}
// Check java.class.path entries
fiStream = tryPath(System.getProperty("java.class.path"), fName); //$NON-NLS-1$
if (fiStream != null) {
return fiStream;
}
// Check directory with java sample profiles
String home = System.getProperty("java.home"); //$NON-NLS-1$
if (home != null) {
fiStream = tryPath(home + File.separatorChar
+ "lib" + File.separatorChar + "cmm", fName //$NON-NLS-1$ //$NON-NLS-2$
);
}
return fiStream;
}
});
if (fiStream == null) {
// awt.161=Unable to open file {0}
throw new IOException(Messages.getString("awt.161", fileName)); //$NON-NLS-1$
}
ICC_Profile pf = getInstance(fiStream);
fiStream.close();
return pf;
|
public static java.awt.color.ICC_Profile | getInstance(java.io.InputStream s)Gets the single instance of ICC_Profile with data in the specified
InputStream.
byte[] header = new byte[headerSize];
// awt.162=Invalid ICC Profile Data
String invalidDataMessage = Messages.getString("awt.162"); //$NON-NLS-1$
// Get header from the input stream
if (s.read(header) != headerSize) {
throw new IllegalArgumentException(invalidDataMessage);
}
// Check the profile data for consistency
if (ICC_ProfileHelper.getBigEndianFromByteArray(header, icHdrMagic) != headerMagicNumber) {
throw new IllegalArgumentException(invalidDataMessage);
}
// Get profile size from header, create an array for profile data
int profileSize = ICC_ProfileHelper.getBigEndianFromByteArray(header, icHdrSize);
byte[] profileData = new byte[profileSize];
// Copy header into it
System.arraycopy(header, 0, profileData, 0, headerSize);
// Read the profile itself
if (s.read(profileData, headerSize, profileSize - headerSize) != profileSize - headerSize) {
throw new IllegalArgumentException(invalidDataMessage);
}
return getInstance(profileData);
|
public static java.awt.color.ICC_Profile | getInstance(byte[] data)Gets the single instance of ICC_Profile from the specified data in a byte
array.
ICC_Profile res = null;
try {
res = new ICC_Profile(data);
} catch (CMMException e) {
// awt.162=Invalid ICC Profile Data
throw new IllegalArgumentException(Messages.getString("awt.162")); //$NON-NLS-1$
}
if (System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
try {
if (res.getColorSpaceType() == ColorSpace.TYPE_RGB
&& res.getDataSize(icSigMediaWhitePointTag) > 0
&& res.getDataSize(icSigRedColorantTag) > 0
&& res.getDataSize(icSigGreenColorantTag) > 0
&& res.getDataSize(icSigBlueColorantTag) > 0
&& res.getDataSize(icSigRedTRCTag) > 0
&& res.getDataSize(icSigGreenTRCTag) > 0
&& res.getDataSize(icSigBlueTRCTag) > 0) {
res = new ICC_ProfileRGB(res.getProfileHandle());
} else if (res.getColorSpaceType() == ColorSpace.TYPE_GRAY
&& res.getDataSize(icSigMediaWhitePointTag) > 0
&& res.getDataSize(icSigGrayTRCTag) > 0) {
res = new ICC_ProfileGray(res.getProfileHandle());
}
} catch (CMMException e) { /* return res in this case */
}
}
return res;
|
public static java.awt.color.ICC_Profile | getInstance(int cspace)Gets the single instance of ICC_Profile with the specific color space
defined by the ColorSpace class: CS_sRGB, CS_LINEAR_RGB, CS_CIEXYZ,
CS_PYCC, CS_GRAY.
try {
switch (cspace) {
case ColorSpace.CS_sRGB:
if (sRGBProfile == null) {
sRGBProfile = getInstance("sRGB.pf"); //$NON-NLS-1$
}
return sRGBProfile;
case ColorSpace.CS_CIEXYZ:
if (xyzProfile == null) {
xyzProfile = getInstance("CIEXYZ.pf"); //$NON-NLS-1$
}
return xyzProfile;
case ColorSpace.CS_GRAY:
if (grayProfile == null) {
grayProfile = getInstance("GRAY.pf"); //$NON-NLS-1$
}
return grayProfile;
case ColorSpace.CS_PYCC:
if (pyccProfile == null) {
pyccProfile = getInstance("PYCC.pf"); //$NON-NLS-1$
}
return pyccProfile;
case ColorSpace.CS_LINEAR_RGB:
if (linearRGBProfile == null) {
linearRGBProfile = getInstance("LINEAR_RGB.pf"); //$NON-NLS-1$
}
return linearRGBProfile;
}
} catch (IOException e) {
// awt.163=Can't open color profile
throw new IllegalArgumentException(Messages.getString("Can't open color profile")); //$NON-NLS-1$
}
// awt.164=Not a predefined color space
throw new IllegalArgumentException(Messages.getString("Not a predefined color space")); //$NON-NLS-1$
|
private int | getIntFromHeader(int idx)Reads an integer from the profile header at the specified position.
if (headerData == null) {
headerData = getData(icSigHead);
}
return ((headerData[idx] & 0xFF) << 24) | ((headerData[idx + 1] & 0xFF) << 16)
| ((headerData[idx + 2] & 0xFF) << 8) | ((headerData[idx + 3] & 0xFF));
|
public int | getMajorVersion()Gets the major version of this ICC profile.
return getByteFromHeader(icHdrVersion);
|
float[] | getMediaWhitePoint()Gets the media white point.
return getXYZValue(icSigMediaWhitePointTag);
|
public int | getMinorVersion()Gets the minor version of this ICC profile.
return getByteFromHeader(icHdrVersion + 1);
|
public int | getNumComponents()Gets the number of components of this ICC Profile.
switch (getIntFromHeader(icHdrColorSpace)) {
// The most common cases go first to increase speed
case icSigRgbData:
case icSigXYZData:
case icSigLabData:
return 3;
case icSigCmykData:
return 4;
// Then all other
case icSigGrayData:
return 1;
case icSigSpace2CLR:
return 2;
case icSigYCbCrData:
case icSigLuvData:
case icSigYxyData:
case icSigHlsData:
case icSigHsvData:
case icSigCmyData:
case icSigSpace3CLR:
return 3;
case icSigSpace4CLR:
return 4;
case icSigSpace5CLR:
return 5;
case icSigSpace6CLR:
return 6;
case icSigSpace7CLR:
return 7;
case icSigSpace8CLR:
return 8;
case icSigSpace9CLR:
return 9;
case icSigSpaceACLR:
return 10;
case icSigSpaceBCLR:
return 11;
case icSigSpaceCCLR:
return 12;
case icSigSpaceDCLR:
return 13;
case icSigSpaceECLR:
return 14;
case icSigSpaceFCLR:
return 15;
default:
}
// awt.160=Color space doesn't comply with ICC specification
throw new ProfileDataException(Messages.getString("awt.160") //$NON-NLS-1$
);
|
public int | getPCSType()Gets the color space type of the Profile Connection Space (PCS).
return csFromSignature(getIntFromHeader(icHdrPcs));
|
public int | getProfileClass()Gets the profile class.
int deviceClassSignature = getIntFromHeader(icHdrDeviceClass);
switch (deviceClassSignature) {
case icSigColorSpaceClass:
return CLASS_COLORSPACECONVERSION;
case icSigDisplayClass:
return CLASS_DISPLAY;
case icSigOutputClass:
return CLASS_OUTPUT;
case icSigInputClass:
return CLASS_INPUT;
case icSigLinkClass:
return CLASS_DEVICELINK;
case icSigAbstractClass:
return CLASS_ABSTRACT;
case icSigNamedColorClass:
return CLASS_NAMEDCOLOR;
default:
}
// Not an ICC profile class
// awt.15F=Profile class does not comply with ICC specification
throw new IllegalArgumentException(Messages.getString("awt.15F")); //$NON-NLS-1$
|
private long | getProfileHandle()Gets the profile handle.
handleStolen = true;
return profileHandle;
|
short[] | getTRC(int tagSignature)Gets the TRC.
short[] dataTRC = null;
getGammaOrTRC(tagSignature, dataTRC);
if (dataTRC == null) {
// awt.167=TRC is a gamma value, not a table.
throw new ProfileDataException(Messages.getString("awt.167")); //$NON-NLS-1$
}
return dataTRC;
|
float[] | getXYZValue(int tagSignature)Reads XYZ value from the tag data.
float[] res = new float[3];
byte[] data = getData(tagSignature);
// Convert from ICC s15Fixed16Number type
// 1 (float) = 0x10000 (s15Fixed16Number),
// hence dividing by 0x10000
res[0] = ICC_ProfileHelper.getIntFromByteArray(data, 0) / 65536.f;
res[1] = ICC_ProfileHelper.getIntFromByteArray(data, 4) / 65536.f;
res[2] = ICC_ProfileHelper.getIntFromByteArray(data, 8) / 65536.f;
return res;
|
private void | readObject(java.io.ObjectInputStream s)Serializable implementation.
s.defaultReadObject();
String colorSpaceStr = (String)s.readObject();
byte[] data = (byte[])s.readObject();
if (colorSpaceStr != null) {
if (colorSpaceStr.equals("CS_sRGB")) { //$NON-NLS-1$
openedProfileObject = getInstance(ColorSpace.CS_sRGB);
} else if (colorSpaceStr.equals("CS_GRAY")) { //$NON-NLS-1$
openedProfileObject = getInstance(ColorSpace.CS_GRAY);
} else if (colorSpaceStr.equals("CS_LINEAR_RGB")) { //$NON-NLS-1$
openedProfileObject = getInstance(ColorSpace.CS_LINEAR_RGB);
} else if (colorSpaceStr.equals("CS_CIEXYZ")) { //$NON-NLS-1$
openedProfileObject = getInstance(ColorSpace.CS_CIEXYZ);
} else if (colorSpaceStr.equals("CS_PYCC")) { //$NON-NLS-1$
openedProfileObject = getInstance(ColorSpace.CS_PYCC);
} else {
openedProfileObject = ICC_Profile.getInstance(data);
}
} else {
openedProfileObject = ICC_Profile.getInstance(data);
}
|
protected java.lang.Object | readResolve()Resolves instances being deserialized into instances registered with CMM.
return openedProfileObject;
|
public void | setData(int tagSignature, byte[] tagData)Sets a tagged data element in the profile from a byte array.
NativeCMM.cmmSetProfileElement(profileHandle, tagSignature, tagData);
// Remove cached header data if header is modified
if (tagSignature == icSigHead) {
headerData = null;
}
|
private static java.io.FileInputStream | tryPath(java.lang.String path, java.lang.String fileName)Tries to open the file at the specified path. Path entries can be divided
by a separator character.
FileInputStream fiStream = null;
if (path == null) {
return null;
}
StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
while (st.hasMoreTokens()) {
String pathEntry = st.nextToken();
try {
fiStream = new FileInputStream(pathEntry + File.separatorChar + fileName);
if (fiStream != null) {
return fiStream;
}
} catch (FileNotFoundException e) {
}
}
return fiStream;
|
public void | write(java.lang.String fileName)Writes the ICC_Profile to a file with the specified name.
FileOutputStream oStream = new FileOutputStream(fileName);
oStream.write(getData());
oStream.close();
|
public void | write(java.io.OutputStream s)Writes the ICC_Profile to an OutputStream.
s.write(getData());
|
private void | writeObject(java.io.ObjectOutputStream s)Serializable implementation.
s.defaultWriteObject();
s.writeObject(null);
s.writeObject(getData());
|