Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSFloat


        super(function);

        if (getDictionary().getDictionaryObject(COSName.C0) == null)
        {
            c0 = new COSArray();
            c0.add(new COSFloat(0));
        }
        else
        {
            c0 = (COSArray) getDictionary().getDictionaryObject(COSName.C0);
        }

        if (getDictionary().getDictionaryObject(COSName.C1) == null)
        {
            c1 = new COSArray();
            c1.add(new COSFloat(1));
        }
        else
        {
            c1 = (COSArray) getDictionary().getDictionaryObject(COSName.C1);
        }
View Full Code Here


    @Test
    public void testIsFloat()
    {
        try
        {
            COSObject co = new COSObject(new COSFloat(10.0f));
            co.setGenerationNumber(COSInteger.ZERO);
            co.setObjectNumber(COSInteger.get(10));

            assertFalse(COSUtils.isFloat(co, new IOCOSDocument()));
View Full Code Here

    {
        //move text position and set leading
        COSNumber y = (COSNumber)arguments.get(1);

        ArrayList<COSBase> args = new ArrayList<COSBase>();
        args.add(new COSFloat(-1 * y.floatValue()));
        context.processOperator("TL", args);
        context.processOperator("Td", arguments);
    }
View Full Code Here

    @Override
    public void process(Operator operator, List<COSBase> arguments) throws IOException
    {
        //move to start of next text line
        ArrayList<COSBase> args = new ArrayList<COSBase>();
        args.add(new COSFloat(0f));
        // this must be -leading instead of just leading as written in the
        // specification (p.369) the acrobat reader seems to implement it the same way
        args.add(new COSFloat(-1 * context.getGraphicsState().getTextState().getLeading()));
        // use Td instead of repeating code
        context.processOperator("Td", args);
    }
View Full Code Here

        PDColor 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 PDColor(csValues.toFloatArray(), PDDeviceRGB.INSTANCE);
        return retval;
    }
View Full Code Here

     * @param textColor The text color for this node.
     */
    public void setTextColor( Color textColor )
    {
        COSArray array = new COSArray();
        array.add( new COSFloat( textColor.getRed()/255f));
        array.add( new COSFloat( textColor.getGreen()/255f));
        array.add( new COSFloat( textColor.getBlue()/255f));
        node.setItem( COSName.C, array );
    }
View Full Code Here

    protected void setArrayOfNumber(String name, float[] values)
    {
        COSArray array = new COSArray();
        for (int i = 0; i < values.length; i++)
        {
            array.add(new COSFloat(values[i]));
        }
        COSBase oldBase = this.getCOSDictionary().getDictionaryObject(name);
        this.getCOSDictionary().setItem(name, array);
        COSBase newBase = this.getCOSDictionary().getDictionaryObject(name);
        this.potentiallyNotifyChanged(oldBase, newBase);
View Full Code Here

            stream.getStream().setItem(COSName.RANGE, rangeArray);
        }
        // extend range array with default values if needed
        while (rangeArray.size() < (n + 1) * 2)
        {
            rangeArray.add(new COSFloat(0));
            rangeArray.add(new COSFloat(1));
        }
        rangeArray.set(n*2, new COSFloat(range.getMin()));
        rangeArray.set(n*2+1, new COSFloat(range.getMax()));
    }
View Full Code Here

    {
        COSArray wp = (COSArray)dictionary.getDictionaryObject(COSName.WHITE_POINT);
        if(wp == null)
        {
            wp = new COSArray();
            wp.add(new COSFloat(1.0f));
            wp.add(new COSFloat(1.0f));
            wp.add(new COSFloat(1.0f));
            dictionary.setItem(COSName.WHITE_POINT, wp);
        }
        return new PDTristimulus(wp);
    }
View Full Code Here

    {
        COSArray bp = (COSArray)dictionary.getDictionaryObject(COSName.BLACK_POINT);
        if(bp == null)
        {
            bp = new COSArray();
            bp.add(new COSFloat(0.0f));
            bp.add(new COSFloat(0.0f));
            bp.add(new COSFloat(0.0f));
            dictionary.setItem(COSName.BLACK_POINT, bp);
        }
        return new PDTristimulus(bp);
    }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.cos.COSFloat

Copyright © 2018 www.massapicom. 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.