Package org.apache.pdfbox.pdmodel.graphics.color

Examples of org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace


     *
     * @throws IOException If the color space name is unknown.
     */
    public static PDColorSpace createColorSpace( COSBase colorSpace, Map<String, PDColorSpace> colorSpaces ) throws IOException
    {
        PDColorSpace retval = null;
        if( colorSpace instanceof COSName )
        {
            retval = createColorSpace( ((COSName)colorSpace).getName(), colorSpaces );
        }
        else if( colorSpace instanceof COSArray )
View Full Code Here


     *
     * @throws IOException If the color space name is unknown.
     */
    public static PDColorSpace createColorSpace( String colorSpaceName, Map<String, PDColorSpace> colorSpaces ) throws IOException
    {
        PDColorSpace cs = null;
        if( colorSpaceName.equals( PDDeviceCMYK.NAME ) ||
                 colorSpaceName.equals( PDDeviceCMYK.ABBREVIATED_NAME ) )
        {
            cs = PDDeviceCMYK.INSTANCE;
        }
View Full Code Here

     *
     * @throws IOException If the color space name is unknown.
     */
    public static PDColorSpace createColorSpace( PDDocument doc, ColorSpace cs ) throws IOException
    {
        PDColorSpace retval = null;
        if( cs.isCS_sRGB() )
        {
            retval = PDDeviceRGB.INSTANCE;
        }
        else if( cs instanceof ICC_ColorSpace )
View Full Code Here

        result.add(new ValidationError(
            ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING, "DestOutputProfile is missing"));
        return false;
      }

      PDColorSpace altColor = deviceN.getAlternateColorSpace();
      boolean res = true;
      if (altColor != null) {
        res = processAllColorSpace(altColor, result);
      }
View Full Code Here

   */
  protected boolean processIndexedColorSpace(PDColorSpace pdcs,
      List<ValidationError> result) {
    PDIndexed indexed = (PDIndexed) pdcs;
    try {
      PDColorSpace based = indexed.getBaseColorSpace();
      ColorSpaces cs = ColorSpaces.valueOf(based.getName());
      if (cs == ColorSpaces.Indexed || cs == ColorSpaces.Indexed_SHORT) {
        result.add(new ValidationError(
            ERROR_GRAPHIC_INVALID_COLOR_SPACE_INDEXED,"Indexed color space can't be used as Base color space"));
        return false;
      }
View Full Code Here

  protected boolean processSeparationColorSpace(PDColorSpace pdcs,
      List<ValidationError> result) {
    PDSeparation separation = (PDSeparation) pdcs;
    try {

      PDColorSpace altCol = separation.getAlternateColorSpace();
      if (altCol != null) {
        ColorSpaces acs = ColorSpaces.valueOf(altCol.getName());
        switch (acs) {
        case Separation:
        case DeviceN:
        case Pattern:
        case Indexed:
View Full Code Here

          cs = ColorSpaces.valueOf(colorSpace);
        } catch (IllegalArgumentException e) {
          // ---- The color space is unknown.
          // ---- Try to access the resources dictionary, the color space can be
          // a reference.
          PDColorSpace pdCS = (PDColorSpace) this.getColorSpaces().get(
              colorSpace);
          if (pdCS != null) {
            cs = ColorSpaces.valueOf(pdCS.getName());
            csHelper = ColorSpaceHelperFactory.getColorSpaceHelper(pdCS,
                documentHandler, ColorSpaceRestriction.ONLY_DEVICE);
          }
        }
View Full Code Here

  private boolean validColorSpace(PDColorState colorState, ColorSpaceType expectedType) {
    boolean result = true;
    if (colorState == null) {
      result = validColorSpaceDestOutputProfile(expectedType);
    } else {
      PDColorSpace cs = colorState.getColorSpace();
      if (isDeviceIndependent(cs, expectedType)) {
        result = true;
      } else {
        result = validColorSpaceDestOutputProfile(expectedType);
      }
View Full Code Here

   */
  protected boolean processIndexedColorSpace(PDColorSpace pdcs,
      List<ValidationError> result) {
    PDIndexed indexed = (PDIndexed) pdcs;
    try {
      PDColorSpace based = indexed.getBaseColorSpace();
      ColorSpaces cs = ColorSpaces.valueOf(based.getName());
      switch (cs) {     
      case Indexed:
      case Indexed_SHORT:
      case Pattern:
        result.add(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_FORBIDDEN, cs.getLabel() + " ColorSpace is forbidden"));
View Full Code Here

      cs = ColorSpaces.valueOf(colorSpaceName);
    } catch (IllegalArgumentException e) {
      // ---- The color space is unknown.
      // ---- Try to access the resources dictionary, the color space can be a
      // reference.
      PDColorSpace pdCS = (PDColorSpace) this.getColorSpaces().get(
          colorSpaceName);
      if (pdCS != null) {
        cs = ColorSpaces.valueOf(pdCS.getName());
        csHelper = ColorSpaceHelperFactory.getColorSpaceHelper(pdCS,
            documentHandler, ColorSpaceRestriction.NO_RESTRICTION);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.