Examples of PDColorState


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 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

     * @param arguments List
     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PDColorState color = context.getGraphicsState().getStrokingColor();
        color.setColorSpace( new PDDeviceGray() );
        float[] values = new float[1];
        if( arguments.size() >= 1 )
        {
            values[0] = ((COSNumber)arguments.get( 0 )).floatValue();
        }
        else
        {
            throw new IOException( "Error: Expected at least one argument when setting non stroking gray color");
        }
        color.setColorSpaceValue( values );
    }
View Full Code Here

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

     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PDColorSpace cs = PDDeviceCMYK.INSTANCE;
        PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor();
        colorInstance.setColorSpace( cs );
        float[] values = new float[4];
        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 color = context.getGraphicsState().getStrokingColor();
        PDColorSpace cs = color.getColorSpace();
        int numberOfComponents = cs.getNumberOfComponents();
        float[] values = new float[numberOfComponents];
        for( int i=0; i<numberOfComponents; 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 color = context.getGraphicsState().getStrokingColor();
        PDColorSpace colorSpace = color.getColorSpace();

        if (colorSpace != null)
        {
            OperatorProcessor newOperator = null;
            List<COSBase> argList = arguments;

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

            if (colorSpace instanceof PDDeviceGray)
            {
                newOperator = new SetStrokingGrayColor();
            }
            else if (colorSpace instanceof PDDeviceRGB)
            {
                newOperator = new SetStrokingRGBColor();
            }
            else if (colorSpace instanceof PDDeviceCMYK)
            {
                newOperator = new SetStrokingCMYKColor();
            }
            else if (colorSpace instanceof PDICCBased)
            {
                newOperator = new SetStrokingICCBasedColor();
            }
            else if (colorSpace instanceof PDCalRGB)
            {
                newOperator = new SetStrokingCalRGBColor();
            }

            if (newOperator != null)
            {
                color.setColorSpace(colorSpace);
                newOperator.setContext(getContext());
                newOperator.process(operator, argList);
            }
            else
            {
View Full Code Here

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

    public void process(PDFOperator operator, List 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 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 );

        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(false);
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 arguments) throws IOException
    {
        PDColorState color = context.getGraphicsState().getStrokingColor();
        color.setColorSpace( new PDDeviceGray() );
        float[] values = new float[1];
        if( arguments.size() >= 1 )
        {
            values[0] = ((COSNumber)arguments.get( 0 )).floatValue();
        }
        else
        {
            throw new IOException( "Error: Expected at least one argument when setting non stroking gray color");
        }
        color.setColorSpaceValue( values );
        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(true);
        }
View Full Code Here

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

     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List arguments) throws IOException
    {
        PDColorSpace cs = PDDeviceCMYK.INSTANCE;
        PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor();
        colorInstance.setColorSpace( cs );
        float[] values = new float[4];
        for( int i=0; i<arguments.size(); i++ )
        {
            values[i] = ((COSNumber)arguments.get( i )).floatValue();
        }
        colorInstance.setColorSpaceValue( values );

        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(false);
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 arguments) throws IOException
    {
        PDColorState color = context.getGraphicsState().getStrokingColor();
        PDColorSpace cs = color.getColorSpace();
        int numberOfComponents = cs.getNumberOfComponents();
        float[] values = new float[numberOfComponents];
        for( int i=0; i<numberOfComponents; i++ )
        {
            values[i] = ((COSNumber)arguments.get( i )).floatValue();
        }
        color.setColorSpaceValue( values );
       
        if (context instanceof PageDrawer)
        {
            PageDrawer drawer = (PageDrawer)context;
            drawer.colorChanged(true);
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 arguments) throws IOException
    {
        PDColorState color = context.getGraphicsState().getStrokingColor();
        PDColorSpace colorSpace = color.getColorSpace();
        log.info("handling color space " + colorSpace.toString());
        if (colorSpace instanceof PDSeparation)
        {
            PDSeparation sep = (PDSeparation) colorSpace;
            colorSpace = sep.getAlternateColorSpace();
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.