Examples of PDColorState


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

    /**
     * {@inheritDoc}
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PDColorState color = context.getGraphicsState().getStrokingColor();
        float[] values = new float[3];
        for( int i=0; i<arguments.size(); i++ )
        {
            values[i] = ((COSNumber)arguments.get( i )).floatValue();
        }
        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();
        PDColorSpace colorSpace = colorInstance.getColorSpace();

        if (colorSpace != null)
        {
            PDIndexed indexed = (PDIndexed) colorSpace;
            colorSpace = indexed.getBaseColorSpace();
            COSInteger colorValue = (COSInteger)arguments.get(0);
            colorInstance.setColorSpaceValue(indexed.calculateColorValues(colorValue.intValue()));
        }
    }
View Full Code Here

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

     * {@inheritDoc}
     *
     */
    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

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)
        {
            PDIndexed indexed = (PDIndexed) colorSpace;
            colorSpace = indexed.getBaseColorSpace();
            COSInteger colorValue = (COSInteger)arguments.get(0);
            colorInstance.setColorSpaceValue(indexed.calculateColorValues(colorValue.intValue()));
        }
    }
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

     * @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();
        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

     * @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();
        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 colorInstance = context.getGraphicsState().getNonStrokingColor();
        colorInstance.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;
            }
        }
        colorInstance.setColorSpaceValue( values );
    }
View Full Code Here

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

     *
     * @return The structure element of this node.
     */
    public PDColorState getTextColor()
    {
        PDColorState retval = null;
        COSArray csValues = (COSArray)node.getDictionaryObject( COSName.C );
        if( csValues == null )
        {
            csValues = new COSArray();
            csValues.growToSize( 3, new COSFloat( 0 ) );
            node.setItem( COSName.C, csValues );
        }
        retval = new PDColorState(csValues);
        retval.setColorSpace( PDDeviceRGB.INSTANCE );
        return retval;
    }
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.