Examples of PDLineDashPattern


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

        {
            d = new COSArray();
            d.add( new COSInteger( 3 ) );
            getDictionary().setItem( "D", d );
        }
        return new PDLineDashPattern( d, 0 );
    }
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 arguments) throws IOException
    {
        super.process( operator, arguments );
        PDLineDashPattern lineDashPattern = context.getGraphicsState().getLineDashPattern();
        Graphics2D graphics = ((PageDrawer)context).getGraphics();
        BasicStroke stroke = (BasicStroke)graphics.getStroke();
        if (stroke == null)
        {
            if (lineDashPattern.isDashPatternEmpty())
            {
                graphics.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f) );
            }
            else
            {
                graphics.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f,
                        lineDashPattern.getCOSDashPattern().toFloatArray(), lineDashPattern.getPhaseStart()) );
            }
        }
        else
        {
            if (lineDashPattern.isDashPatternEmpty())
            {
                graphics.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(),
                        stroke.getLineJoin(), stroke.getMiterLimit()) );
            }
            else
            {
                graphics.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

     *
     * @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( new COSInteger(3) );
            dictionary.setItem( "D", d );
        }
        COSArray lineArray = new COSArray();
        lineArray.add( d );
        //dash phase is not specified and assumed to be zero.
        lineArray.add( new COSInteger( 0 ) );
        pattern = new PDLineDashPattern( lineArray );
        return pattern;
    }
View Full Code Here

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

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

     * @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();
        Graphics2D graphics = ((PageDrawer)context).getGraphics();
        BasicStroke stroke = (BasicStroke)graphics.getStroke();
        if (stroke == null)
        {
            if (lineDashPattern.isDashPatternEmpty())
            {
                graphics.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f) );
            }
            else
            {
                graphics.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f,
                        lineDashPattern.getCOSDashPattern().toFloatArray(), lineDashPattern.getPhaseStart()) );
            }
        }
        else
        {
            if (lineDashPattern.isDashPatternEmpty())
            {
                graphics.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(),
                        stroke.getLineJoin(), stroke.getMiterLimit()) );
            }
            else
            {
                graphics.setStroke( new BasicStroke(stroke.getLineWidth(), stroke.getEndCap(), stroke.getLineJoin(),
                        stroke.getMiterLimit(), lineDashPattern.getCOSDashPattern().toFloatArray(),
                        lineDashPattern.getPhaseStart()) );
            }
        }
    }
View Full Code Here

Examples of org.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( new COSInteger(3) );
            dictionary.setItem( "D", d );
        }
        COSArray lineArray = new COSArray();
        lineArray.add( d );
        //dash phase is not specified and assumed to be zero.
        lineArray.add( new COSInteger( 0 ) );
        pattern = new PDLineDashPattern( lineArray );
        return pattern;
    }
View Full Code Here

Examples of org.pdfbox.pdmodel.graphics.PDLineDashPattern

        {
            d = new COSArray();
            d.add( new COSInteger( 3 ) );
            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.