Examples of PDColorState


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

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PDColorState colorInstance = context.getGraphicsState().getStrokingColor();
        PDColorSpace colorSpace = colorInstance.getColorSpace();

        if (colorSpace != null)
        {
            PDSeparation sep = (PDSeparation) colorSpace;
            colorSpace = sep.getAlternateColorSpace();
            COSArray values = sep.calculateColorValues(arguments.get(0));
            colorInstance.setColorSpaceValue(values.toFloatArray());
        }
    }
View Full Code Here

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

    {
        //(PDF 1.1) Set color space for stroking operations
        COSName name = (COSName)arguments.get( 0 );
        PDColorSpace cs = PDColorSpaceFactory.createColorSpace( name, context.getColorSpaces(),
                context.getResources().getPatterns() );
        PDColorState color = context.getGraphicsState().getStrokingColor();
        color.setColorSpace( cs );
        int numComponents = cs.getNumberOfComponents();
        float[] values = EMPTY_FLOAT_ARRAY;
        if( numComponents >= 0 )
        {
            values = new float[numComponents];
            for( int i=0; i<numComponents; i++ )
            {
                values[i] = 0f;
            }
            if( cs instanceof PDDeviceCMYK )
            {
                values[3] = 1f;
            }
        }
        color.setColorSpaceValue( values );
    }
View Full Code Here

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

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        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.PDColorState

   *          the color operator
   * @throws ContentStreamException
   */
  protected void checkColorOperators(String operation)
      throws ContentStreamException {
    PDColorState cs = getColorState(operation);

    if ("rg".equals(operation) || "RG".equals(operation)) {
      if (!validColorSpace(cs, ColorSpaceType.RGB)) {
        throwContentStreamException("The operator \"" + operation
            + "\" can't be used with CMYK Profile",
View Full Code Here

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

  private PDColorState getColorState(String operation) {
    if (getGraphicsState() == null) {
      return null;
    }

    PDColorState colorState;
    if (operation.equals("rg") || operation.equals("g") || operation.equals("k")
        || operation.equals("f") || operation.equals("F") || operation.equals("f*")) {
      // non stroking operator
      colorState = getGraphicsState().getNonStrokingColor();
    } else {
View Full Code Here

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

     *            the color operator
     * @throws ContentStreamException
     */
    protected void checkColorOperators(String operation) throws ContentStreamException
    {
        PDColorState cs = getColorState(operation);

        if ("rg".equals(operation) || "RG".equals(operation))
        {
            if (!validColorSpace(cs, ColorSpaceType.RGB))
            {
View Full Code Here

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

        if (getGraphicsState() == null)
        {
            return null;
        }

        PDColorState colorState;
        if (operation.equals("rg") || operation.equals("g") || operation.equals("k") || operation.equals("f")
                || operation.equals("F") || operation.equals("f*"))
        {
            // non stroking operator
            colorState = getGraphicsState().getNonStrokingColor();
View Full Code Here

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

            colorValues.add( COSInteger.ZERO );
            colorValues.add( COSInteger.ZERO );
            colorValues.add( COSInteger.ZERO );
            dictionary.setItem( "C", colorValues );
        }
        PDColorState instance = new PDColorState( colorValues );
        instance.setColorSpace( PDDeviceRGB.INSTANCE );
        return instance;
    }
View Full Code Here

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

    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        //(PDF 1.1) Set color space for stroking operations
        COSName name = (COSName)arguments.get( 0 );
        PDColorSpace cs = PDColorSpaceFactory.createColorSpace( name, context.getColorSpaces() );
        PDColorState color = context.getGraphicsState().getStrokingColor();
        color.setColorSpace( cs );
        int numComponents = cs.getNumberOfComponents();
        float[] values = EMPTY_FLOAT_ARRAY;
        if( numComponents >= 0 )
        {
            values = new float[numComponents];
            for( int i=0; i<numComponents; i++ )
            {
                values[i] = 0f;
            }
            if( cs instanceof PDDeviceCMYK )
            {
                values[3] = 1f;
            }
        }
        color.setColorSpaceValue( values );
    }
View Full Code Here

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

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor();
        float[] values = new float[3];
        for( int i=0; i<arguments.size(); i++ )
        {
            values[i] = ((COSNumber)arguments.get( i )).floatValue();
        }
        colorInstance.setColorSpaceValue( values );
    }
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.