[
https://issues.apache.org/jira/browse/PDFBOX-1876?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13909266#comment-13909266
]
John Hewson commented on PDFBOX-1876:
-------------------------------------
I have what I think is a viable fix for this issue, I've added it to trunk in
revision 1570794. The color values in DeviceN were incorrect before the
refactoring and remain incorrect after, which led me to suspect some other code
was the issues. Your new example PDF file rules out shadings, so I was able to
trace the issue to this line in PDDeviceN:
{code}
float[] altValue = tintTransform.eval(value);
{code}
The call to the tint transform function causes the order of the color values to
be flipped. This is because in PDType4Function the order of the arguments is
reversed before they are pushed to the PostScript stack, which is incorrect! In
PostScript the order is the other way around, the arguments should be pushed to
the stack in order, it is the act of popping them from the stack later which
causes their order to be reversed.
I've modified PDType4Function to push the arguments in order.
> Incorrect color for DeviceN type 4 shading object
> -------------------------------------------------
>
> Key: PDFBOX-1876
> URL: https://issues.apache.org/jira/browse/PDFBOX-1876
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Fix For: 2.0.0
>
> Attachments: PDFBOX-1876-duotone.pdf, PDFBOX-1876-duotone.ps,
> ch14-01.png, ch14-13.png, ch14-15.png, ch14-20.png, ch14.pdf,
> pdfbox-1876-duotone.pdf-1.png
>
>
> Thanks to the fix in pdfbox-1442, I was able to get the ch14.pdf file
> rendered. However the colors are incorrect. On page 13, the colors black and
> red in the triangle are switched. (The same error is on page 1, 15 and 20 but
> these take forever to render). I suspect a bug in the
> shadingTinttransform.eval() function.
> I don't think its a bug in the shading interpolation code, because then there
> would have been lots of visible triangles in the spheres and donuts on the
> other pages where its not just a single triangle.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)