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/03/09 11:02:43 UTC

[jira] [Commented] (PDFBOX-1970) 1.8 shadings are sometimes flipped

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

Tilman Hausherr commented on PDFBOX-1970:
-----------------------------------------

I did some research:
- Its only a flip
- Its not always for type 1
- Its always for type 4+5
- Its almost never for type 2+3 (which may be because these handle the transforms in a different way that can't be used for the other types).

I don't have an overview over the complete project, so I can't tell why the AffineTransform is like it is in 1.8 (and whether 1.8 or 2.0 have the wrong one). Instead, I tested this code for types 1,4 and 5 which flips the AffineTransform:

{code}
        xform.scale(1,-1);
        xform.translate(0, -pageHeight);
{code}

Now all the images come out correctly, including those that were not flipped before.

I'll wait a bit, but if there isn't a better solution, I would commit the change above (with a //TODO notice at that code explaining why) because
- had I started the shading implementation at the time there was no "2.0 trunk", I would have flipped it anyway
- per my interpretation of TDD ideology, code is correct if the tests pass, and all the images are rendered correctly with the code change :-)


> 1.8 shadings are sometimes flipped
> ----------------------------------
>
>                 Key: PDFBOX-1970
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1970
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.4
>            Reporter: Tilman Hausherr
>              Labels: shading, shadingpattern
>         Attachments: _asy-gouraud.pdf-1.png, asy-gouraud.pdf
>
>
> Some of my shading test images are sometimes flipped when done with the 1.8 branch, not with the trunk. I have observed this with shadingtype 1, 4 and 5.
> The shadingContext is created with an AffineTransform (the CTM is identical and its just a translation) of 
> [1.0, 0.0, 399.0]
> [0.0, 1.0, 49.0]
> for the 1.8 branch (bad)
> and with
> [1.0, 0.0, 399.0]
> [0.0, -1.0, 149.0]
> for the trunk (good).



--
This message was sent by Atlassian JIRA
(v6.2#6252)