You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/01/23 10:57:38 UTC

[jira] [Comment Edited] (PDFBOX-1861) Line is incorrectly dashed

    [ https://issues.apache.org/jira/browse/PDFBOX-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13879498#comment-13879498 ] 

Tilman Hausherr edited comment on PDFBOX-1861 at 1/23/14 9:57 AM:
------------------------------------------------------------------

I had a look at other operators and notice that they do a transformation, but the dash pattern isn't transformed in org.apache.pdfbox.util.operator.pagedrawer.SetLineDashPattern. Inserting this code
{code}
        float[] dashArray = null;
        if (!lineDashPattern.isDashPatternEmpty())
        {
            dashArray = lineDashPattern.getCOSDashPattern().toFloatArray();
            Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix();
            if (ctm != null && ctm.getXScale() > 0)
            {
                for (int i = 0; i < dashArray.length; ++i)
                {
                    dashArray[i] *= ctm.getXScale();
                }
            }
        }
{code}
and using that dashArray result instead of lineDashPattern.getCOSDashPattern().toFloatArray() later down produces the attached image (which includes my change from PDFBOX-615).


was (Author: tilman):
I had a look at other operators and notice that they do a transformation, but the dash pattern isn't transformed in SetLineDashPattern.java. Inserting this code
{code}
        float[] dashArray = null;
        if (!lineDashPattern.isDashPatternEmpty())
        {
            dashArray = lineDashPattern.getCOSDashPattern().toFloatArray();
            Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix();
            if (ctm != null && ctm.getXScale() > 0)
            {
                for (int i = 0; i < dashArray.length; ++i)
                {
                    dashArray[i] *= ctm.getXScale();
                }
            }
        }
{code}
and using that dashArray result instead of lineDashPattern.getCOSDashPattern().toFloatArray() later down produces the attached image (which includes my change from PDFBOX-615).

> Line is incorrectly dashed
> --------------------------
>
>                 Key: PDFBOX-1861
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1861
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>         Environment: W7
>            Reporter: Tilman Hausherr
>            Priority: Minor
>         Attachments: asy-gouraud.pdf, asy-gouraud.pdf-1-good.png, asy-gouraud.pdf-1-trunk.png
>
>
> The line in the attached page should be dashed differently than it is in the rendering.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)