/* Get and verify ICC profile name */
String iccProfileName = args[3].trim();
if (iccProfileName == null || "".equals(iccProfileName)) {
throw new PropertyException("ICC profile name missing");
}
ICC_ColorSpace colorSpace = null;
String iccProfileSrc;
if (isPseudoProfile(iccProfileName)) {
throw new IllegalArgumentException(
"Pseudo-profiles are not allowed with fop-rgb-named-color()");
} else {
/* Get and verify ICC profile source */
iccProfileSrc = args[4].trim();
if (iccProfileSrc == null || "".equals(iccProfileSrc)) {
throw new PropertyException("ICC profile source missing");
}
iccProfileSrc = unescapeString(iccProfileSrc);
}
// color name
String colorName = unescapeString(args[5].trim());
/* Ask FOP factory to get ColorSpace for the specified ICC profile source */
if (foUserAgent != null && iccProfileSrc != null) {
RenderingIntent renderingIntent = RenderingIntent.AUTO;
//TODO connect to fo:color-profile/@rendering-intent
colorSpace = (ICC_ColorSpace)foUserAgent.getFactory().getColorSpaceCache().get(
iccProfileName,
foUserAgent.getBaseURL(), iccProfileSrc,
renderingIntent);
}
if (colorSpace != null) {
ICC_Profile profile = colorSpace.getProfile();
if (NamedColorProfileParser.isNamedColorProfile(profile)) {
NamedColorProfileParser parser = new NamedColorProfileParser();
NamedColorProfile ncp = parser.parseProfile(profile,
iccProfileName, iccProfileSrc);
NamedColorSpace ncs = ncp.getNamedColor(colorName);