Examples of PDLineDashPattern


Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

     *
     * @return null or the D value in the dictionary.
     */
    public PDLineDashPattern getLineDashPattern()
    {
        PDLineDashPattern retval = null;
        COSArray dp = (COSArray) dict.getDictionaryObject( COSName.D );
        if( dp != null )
        {
            COSArray array = new COSArray();
            dp.addAll(dp);
            dp.remove(dp.size() - 1);
            int phase = dp.getInt(dp.size() - 1);

            retval = new PDLineDashPattern( array, phase );
        }
        return retval;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

        {
            d = new COSArray();
            d.add( COSInteger.THREE );
            getDictionary().setItem( "D", d );
        }
        return new PDLineDashPattern( d, 0 );
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

     *
     * @return The line dash pattern.
     */
    public PDLineDashPattern getLineDashPattern()
    {
        PDLineDashPattern pattern = null;
        COSArray d = (COSArray)dictionary.getDictionaryObject( "D" );
        if( d == null )
        {
            d = new COSArray();
            d.add( COSInteger.THREE );
            dictionary.setItem( "D", d );
        }
        COSArray lineArray = new COSArray();
        lineArray.add( d );
        //dash phase is not specified and assumed to be zero.
        pattern = new PDLineDashPattern( lineArray, 0 );
        return pattern;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

        if (lineWidth < 0.25)
        {
            lineWidth = 0.25f;
        }

        PDLineDashPattern dashPattern = state.getLineDashPattern();
        int phaseStart = dashPattern.getPhase();
        float[] dashArray = dashPattern.getDashArray();
        if (dashArray != null)
        {
            // apply the CTM
            for (int i = 0; i < dashArray.length; ++i)
            {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

        if (dashPhase < 0)
        {
            LOG.warn("dash phaseStart has negative value " + dashPhase + ", set to 0");
            dashPhase = 0;
        }
        PDLineDashPattern lineDash = new PDLineDashPattern(dashArray, dashPhase);
        context.getGraphicsState().setLineDashPattern(lineDash);
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

        if (dashPhase < 0)
        {
            LOG.warn("dash phaseStart has negative value " + dashPhase + ", set to 0");
            dashPhase = 0;
        }
        PDLineDashPattern lineDash = new PDLineDashPattern(dashArray, dashPhase);
        context.getGraphicsState().setLineDashPattern(lineDash);
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

     *
     * @return The line dash pattern.
     */
    public PDLineDashPattern getLineDashPattern()
    {
        PDLineDashPattern pattern = null;
        COSArray d = (COSArray)dictionary.getDictionaryObject( "D" );
        if( d == null )
        {
            d = new COSArray();
            d.add( COSInteger.THREE );
            dictionary.setItem( "D", d );
        }
        COSArray lineArray = new COSArray();
        lineArray.add( d );
        //dash phase is not specified and assumed to be zero.
        lineArray.add( COSInteger.ZERO );
        pattern = new PDLineDashPattern( lineArray );
        return pattern;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

     * @throws IOException If an error occurs while processing the font.
     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        super.process( operator, arguments );
        PDLineDashPattern lineDashPattern = context.getGraphicsState().getLineDashPattern();
        PageDrawer drawer = (PageDrawer)context;
        BasicStroke stroke = (BasicStroke)drawer.getStroke();
        if (stroke == null)
        {
            if (lineDashPattern.isDashPatternEmpty())
            {
                drawer.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f) );
            }
            else
            {
                drawer.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f,
                        lineDashPattern.getCOSDashPattern().toFloatArray(), lineDashPattern.getPhaseStart()) );
            }
        }
        else
        {
            if (lineDashPattern.isDashPatternEmpty())
            {
                drawer.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(),
                        stroke.getLineJoin(), stroke.getMiterLimit()) );
            }
            else
            {
                drawer.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(),
                        stroke.getMiterLimit(), lineDashPattern.getCOSDashPattern().toFloatArray(),
                        lineDashPattern.getPhaseStart()) );
            }
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

     */
    public void process(PDFOperator operator, List<COSBase> arguments) throws IOException
    {
        COSArray dashArray = (COSArray)arguments.get( 0 );
        int dashPhase = ((COSNumber)arguments.get( 1 )).intValue();
        PDLineDashPattern lineDash = new PDLineDashPattern( dashArray, dashPhase );
        context.getGraphicsState().setLineDashPattern( lineDash );
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.graphics.PDLineDashPattern

        {
            d = new COSArray();
            d.add( COSInteger.THREE );
            getDictionary().setItem( "D", d );
        }
        return new PDLineDashPattern( d, 0 );
    }
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.