/** {@inheritDoc} */
public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
// Map color profile NCNAME to src from declarations/color-profile element
String colorProfileName = args[3].getString();
Declarations decls = (pInfo.getFO() != null
? pInfo.getFO().getRoot().getDeclarations()
: null);
ColorProfile cp = null;
if (decls == null) {
//function used in a color-specification
//on a FO occurring:
//a) before the fo:declarations,
//b) or in a document without fo:declarations?
//=> return the sRGB fallback
if (!ColorUtil.isPseudoProfile(colorProfileName)) {
Property[] rgbArgs = new Property[3];
System.arraycopy(args, 0, rgbArgs, 0, 3);
return new RGBColorFunction().eval(rgbArgs, pInfo);
}
} else {
cp = decls.getColorProfile(colorProfileName);
if (cp == null) {
if (!ColorUtil.isPseudoProfile(colorProfileName)) {
PropertyException pe = new PropertyException("The " + colorProfileName
+ " color profile was not declared");
pe.setPropertyInfo(pInfo);