return getInstance(profileData);
}
public static ICC_Profile getInstance(byte[] data) {
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 */ }
}