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 color = context.getGraphicsState().getStrokingColor();
        PDColorSpace colorSpace = color.getColorSpace();

        if (colorSpace != null)
        {
            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();
            }
            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

     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        PDColorSpace cs = new PDDeviceGray();
        PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor();
        colorInstance.setColorSpace( cs );
        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");
        }
        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().getNonStrokingColor();
        PDColorSpace colorSpace = colorInstance.getColorSpace();
       
        if (colorSpace != null)
        {
            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();
            }
            else if (colorSpace instanceof PDDeviceRGB)
            {
                newOperator = new SetNonStrokingRGBColor();
            }
            else if (colorSpace instanceof PDDeviceCMYK)
            {
                newOperator = new SetNonStrokingCMYKColor();
            }
            else if (colorSpace instanceof PDICCBased)
            {
                newOperator = new SetNonStrokingICCBasedColor();
            }
            else if (colorSpace instanceof PDCalRGB)
            {
                newOperator = new SetNonStrokingCalRGBColor();
            }
   
            if (newOperator != null)
            {
                colorInstance.setColorSpace(colorSpace);
                newOperator.setContext(getContext());
                newOperator.process(operator, argList);
            }
            else
            {
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 = PDDeviceRGB.INSTANCE;
        PDColorState colorInstance = context.getGraphicsState().getNonStrokingColor();
        colorInstance.setColorSpace( cs );
        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 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

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

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

            if (colorSpace instanceof PDDeviceGray)
            {
                newOperator = new SetNonStrokingGrayColor();
            }
            else if (colorSpace instanceof PDDeviceRGB)
            {
                newOperator = new SetNonStrokingRGBColor();
            }
            else if (colorSpace instanceof PDDeviceCMYK)
            {
                newOperator = new SetNonStrokingCMYKColor();
            }
            else if (colorSpace instanceof PDICCBased)
            {
                newOperator = new SetNonStrokingICCBasedColor();
            }
            else if (colorSpace instanceof PDCalRGB)
            {
                newOperator = new SetNonStrokingCalRGBColor();
            }
   
            if (newOperator != null)
            {
                colorInstance.setColorSpace(colorSpace);
                newOperator.setContext(getContext());
                newOperator.process(operator, argList);
            }
            else
            {
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 cs = colorInstance.getColorSpace();
        int numberOfComponents = cs.getNumberOfComponents();
        float[] values = new float[numberOfComponents];
        for( int i=0; i<numberOfComponents; 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();
        color.setColorSpace( PDDeviceCMYK.INSTANCE );
        float[] values = new float[4];
        for( int i=0; i<arguments.size(); i++ )
        {
            values[i] = ((COSNumber)arguments.get( i )).floatValue();
        }
        color.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.