/** * Indexed color space is authorized only if the BaseColorSpace is a DeviceXXX color space. In all other cases the * given list is updated with a ValidationError (ERROR_GRAPHIC_INVALID_PATTERN_COLOR_SPACE_FORBIDDEN) and returns * false. */ @Override protected void processIndexedColorSpace(PDColorSpace colorSpace) { PDIndexed indexed = (PDIndexed) colorSpace; PDColorSpace baseColorSpace = indexed.getBaseColorSpace(); ColorSpaces colorSpaces = ColorSpaces.valueOf(baseColorSpace.getName()); switch (colorSpaces) { case Indexed: case I: case Pattern: context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_FORBIDDEN, colorSpaces .getLabel() + " ColorSpace is forbidden")); break; default: processAllColorSpace(baseColorSpace); } } }
/** * Method called by the processAllColorSpace if the ColorSpace to check is Indexed. Because this kind of ColorSpace * can have a Base color space, the processAllColorSpace is called to check this base color space. (Indexed and * Pattern can't be a Base color space) * * @param colorSpace * the color space object to check. */ protected void processIndexedColorSpace(PDColorSpace colorSpace) { PDIndexed indexed = (PDIndexed) colorSpace; PDColorSpace based = indexed.getBaseColorSpace(); ColorSpaces cs = ColorSpaces.valueOf(based.getName()); if (cs == ColorSpaces.Indexed || cs == ColorSpaces.I) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED, "Indexed color space can't be used as Base color space")); return; } if (cs == ColorSpaces.Pattern) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED, "Pattern color space can't be used as Base color space")); return; } processAllColorSpace(based); }
if (altCol != null) ColorSpaces acs = ColorSpaces.valueOf(altCol.getName()); switch (acs)
if (altpdcs != null) ColorSpaces altCsId = ColorSpaces.valueOf(altpdcs.getName()); if (altCsId == ColorSpaces.Pattern)
ColorSpaces cs = ColorSpaces.valueOf(colorSpace.getName());
/** * Indexed color space is authorized only if the BaseColorSpace is a DeviceXXX color space. In all other cases the * given list is updated with a ValidationError (ERROR_GRAPHIC_INVALID_PATTERN_COLOR_SPACE_FORBIDDEN) and returns * false. */ @Override protected void processIndexedColorSpace(PDColorSpace colorSpace) { PDIndexed indexed = (PDIndexed) colorSpace; PDColorSpace baseColorSpace = indexed.getBaseColorSpace(); ColorSpaces colorSpaces = ColorSpaces.valueOf(baseColorSpace.getName()); switch (colorSpaces) { case Indexed: case I: case Pattern: context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_FORBIDDEN, colorSpaces .getLabel() + " ColorSpace is forbidden")); break; default: processAllColorSpace(baseColorSpace); } } }
/** * Indexed color space is authorized only if the BaseColorSpace is a DeviceXXX color space. In all other cases the * given list is updated with a ValidationError (ERROR_GRAPHIC_INVALID_PATTERN_COLOR_SPACE_FORBIDDEN) and returns * false. */ @Override protected void processIndexedColorSpace(PDColorSpace colorSpace) { PDIndexed indexed = (PDIndexed) colorSpace; PDColorSpace baseColorSpace = indexed.getBaseColorSpace(); ColorSpaces colorSpaces = ColorSpaces.valueOf(baseColorSpace.getName()); switch (colorSpaces) { case Indexed: case I: case Pattern: context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_FORBIDDEN, colorSpaces .getLabel() + " ColorSpace is forbidden")); break; default: processAllColorSpace(baseColorSpace); } } }
if (altpdcs != null) ColorSpaces altCsId = ColorSpaces.valueOf(altpdcs.getName()); if (altCsId == ColorSpaces.Pattern)
/** * Method called by the processAllColorSpace if the ColorSpace to check is Indexed. Because this kind of ColorSpace * can have a Base color space, the processAllColorSpace is called to check this base color space. (Indexed and * Pattern can't be a Base color space) * * @param colorSpace * the color space object to check. */ protected void processIndexedColorSpace(PDColorSpace colorSpace) { PDIndexed indexed = (PDIndexed) colorSpace; PDColorSpace based = indexed.getBaseColorSpace(); ColorSpaces cs = ColorSpaces.valueOf(based.getName()); if (cs == ColorSpaces.Indexed || cs == ColorSpaces.I) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED, "Indexed color space can't be used as Base color space")); return; } if (cs == ColorSpaces.Pattern) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED, "Pattern color space can't be used as Base color space")); return; } processAllColorSpace(based); }
/** * Method called by the processAllColorSpace if the ColorSpace to check is Indexed. Because this kind of ColorSpace * can have a Base color space, the processAllColorSpace is called to check this base color space. (Indexed and * Pattern can't be a Base color space) * * @param colorSpace * the color space object to check. */ protected void processIndexedColorSpace(PDColorSpace colorSpace) { PDIndexed indexed = (PDIndexed) colorSpace; PDColorSpace based = indexed.getBaseColorSpace(); ColorSpaces cs = ColorSpaces.valueOf(based.getName()); if (cs == ColorSpaces.Indexed || cs == ColorSpaces.I) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED, "Indexed color space can't be used as Base color space")); return; } if (cs == ColorSpaces.Pattern) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED, "Pattern color space can't be used as Base color space")); return; } processAllColorSpace(based); }
if (altpdcs != null) ColorSpaces altCsId = ColorSpaces.valueOf(altpdcs.getName()); if (altCsId == ColorSpaces.Pattern)
if (altCol != null) ColorSpaces acs = ColorSpaces.valueOf(altCol.getName()); switch (acs)
if (altCol != null) ColorSpaces acs = ColorSpaces.valueOf(altCol.getName()); switch (acs)
ColorSpaces cs = ColorSpaces.valueOf(colorSpace.getName());
ColorSpaces cs = ColorSpaces.valueOf(colorSpace.getName());