Examples of PDDeviceN


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

     * @param pdcs
     *            the color space object to check.
     */
    protected void processDeviceNColorSpace(PDColorSpace pdcs)
    {
        PDDeviceN deviceN = (PDDeviceN) pdcs;
        try
        {
            if (iccpw == null)
            {
                context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING,
                        "DestOutputProfile is missing"));
                return;
            }

            COSBase cosAlt = ((COSArray)pdcs.getCOSObject()).getObject(2);
            PDColorSpace altColor = PDColorSpace.create(cosAlt);
            if (altColor != null)
            {
                processAllColorSpace(altColor);
            }

            int numberOfColorants = 0;
            PDDeviceNAttributes attr = deviceN.getAttributes();
            if (attr != null)
            {
                Map colorants = attr.getColorants();
                if (colorants != null)
                {
                    numberOfColorants = colorants.size();
                    for (Object col : colorants.values())
                    {
                        if (col != null)
                        {
                            processAllColorSpace((PDColorSpace) col);
                        }
                    }
                }
            }
            int numberOfComponents = deviceN.getNumberOfComponents();
            if (numberOfColorants > MAX_DEVICE_N_LIMIT || numberOfComponents > MAX_DEVICE_N_LIMIT)
            {
                context.addValidationError(new ValidationError(
                        ERROR_GRAPHIC_INVALID_COLOR_SPACE_TOO_MANY_COMPONENTS_DEVICEN,
                        "DeviceN has too many tint components or colorants"));
View Full Code Here

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

     * @param pdcs
     *            the color space object to check.
     */
    protected void processDeviceNColorSpace(PDColorSpace pdcs)
    {
        PDDeviceN deviceN = (PDDeviceN) pdcs;
        try
        {
            if (iccpw == null)
            {
                context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING,
                        "DestOutputProfile is missing"));
                return;
            }

            PDColorSpace altColor = deviceN.getAlternateColorSpace();
            if (altColor != null)
            {
                processAllColorSpace(altColor);
            }

            int numberOfColorants = 0;
            PDDeviceNAttributes attr = deviceN.getAttributes();
            if (attr != null)
            {
                Map colorants = attr.getColorants();
                if (colorants != null)
                {
                    numberOfColorants = colorants.size();
                    for (Object col : colorants.values())
                    {
                        if (col != null)
                        {
                            processAllColorSpace((PDColorSpace) col);
                        }
                    }
                }
            }
            int numberOfComponents = deviceN.getNumberOfComponents();
            if (numberOfColorants > MAX_DEVICE_N_LIMIT || numberOfComponents > MAX_DEVICE_N_LIMIT)
            {
                context.addValidationError(new ValidationError(
                        ERROR_GRAPHIC_INVALID_COLOR_SPACE_TOO_MANY_COMPONENTS_DEVICEN,
                        "DeviceN has too many tint components or colorants"));
View Full Code Here

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

        PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor();
        PDColorSpace colorSpace = colorInstance.getColorSpace();
       
        if (colorSpace != null)
        {
            PDDeviceN sep = (PDDeviceN) colorSpace;
            colorSpace = sep.getAlternateColorSpace();
            COSArray colorValues = sep.calculateColorValues(arguments);
            colorInstance.setColorSpaceValue(colorValues.toFloatArray());
        }
    }
View Full Code Here

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

        PDColorState colorInstance = context.getGraphicsState().getStrokingColor();
        PDColorSpace colorSpace = colorInstance.getColorSpace();

        if (colorSpace != null)
        {
            PDDeviceN sep = (PDDeviceN) colorSpace;
            colorSpace = sep.getAlternateColorSpace();
            COSArray colorValues = sep.calculateColorValues(arguments);
            colorInstance.setColorSpaceValue(colorValues.toFloatArray());
        }
    }
View Full Code Here

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

   *          the list of error to update if the validation fails.
   * @return true if the color space is valid, false otherwise.
   */
  protected boolean processDeviceNColorSpace(PDColorSpace pdcs,
      List<ValidationError> result) {
    PDDeviceN deviceN = (PDDeviceN) pdcs;
    try {
      if (iccpw == null) {
        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);
      }

      int numberOfColorants = 0;
      PDDeviceNAttributes attr = deviceN.getAttributes();
      if (attr != null) {
        Map colorants = attr.getColorants();
        if (colorants != null) {
          numberOfColorants = colorants.size();
          for (Object col : colorants.values()) {
            if (col != null) {
              res = res && processAllColorSpace((PDColorSpace) col, result);
            }
          }
        }
      }
      int numberOfComponents = deviceN.getNumberOfComponents();
      if (numberOfColorants > MAX_DEVICE_N_LIMIT || numberOfComponents > MAX_DEVICE_N_LIMIT ) {
        result.add(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_TOO_MANY_COMPONENTS_DEVICEN, "DeviceN has too many tint components or colorants"))
        res = false;
      }
      return res;
View Full Code Here

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

     * @param pdcs
     *            the color space object to check.
     */
    protected void processDeviceNColorSpace(PDColorSpace pdcs)
    {
        PDDeviceN deviceN = (PDDeviceN) pdcs;
        try
        {
            if (iccpw == null)
            {
                context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING,
                        "DestOutputProfile is missing"));
                return;
            }

            PDColorSpace altColor = deviceN.getAlternateColorSpace();
            if (altColor != null)
            {
                processAllColorSpace(altColor);
            }

            int numberOfColorants = 0;
            PDDeviceNAttributes attr = deviceN.getAttributes();
            if (attr != null)
            {
                Map colorants = attr.getColorants();
                if (colorants != null)
                {
                    numberOfColorants = colorants.size();
                    for (Object col : colorants.values())
                    {
                        if (col != null)
                        {
                            processAllColorSpace((PDColorSpace) col);
                        }
                    }
                }
            }
            int numberOfComponents = deviceN.getNumberOfComponents();
            if (numberOfColorants > MAX_DEVICE_N_LIMIT || numberOfComponents > MAX_DEVICE_N_LIMIT)
            {
                context.addValidationError(new ValidationError(
                        ERROR_GRAPHIC_INVALID_COLOR_SPACE_TOO_MANY_COMPONENTS_DEVICEN,
                        "DeviceN has too many tint components or colorants"));
View Full Code Here

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

            OperatorProcessor newOperator = null;
            List<COSBase> argList = arguments;

            if (colorSpace instanceof PDDeviceN)
            {
                PDDeviceN sep = (PDDeviceN) colorSpace;
                colorSpace = sep.getAlternateColorSpace();
                argList = sep.calculateColorValues(arguments).toList();
            }

            if (colorSpace instanceof PDDeviceGray)
            {
                newOperator = new SetStrokingGrayColor();
View Full Code Here

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

        {
            List<COSBase> argList = arguments;
            OperatorProcessor newOperator = null;

            if (colorSpace instanceof PDDeviceN) {
                PDDeviceN sep = (PDDeviceN) colorSpace;
                colorSpace = sep.getAlternateColorSpace();
                argList = sep.calculateColorValues(arguments).toList();
            }

            if (colorSpace instanceof PDDeviceGray)
            {
                newOperator = new SetNonStrokingGrayColor();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.