You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2014/03/06 15:58:43 UTC

[jira] [Comment Edited] (PDFBOX-1960) Matrix and AffineTransform have confusing differences

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

Maruan Sahyoun edited comment on PDFBOX-1960 at 3/6/14 2:57 PM:
----------------------------------------------------------------

Although the differences might be confusing Matrix and it’s layout is defined in the PDF spec. So that’s why its behaving as is. Of course there are differences to AffineTransform as it’s dealing with a different definition and layout of a matrix. So conceptually being the same the do differ.

The only way I see that improvement request to being resolved is adding some more documentation - WDYT?

As to removing multiply - why should we do that? The only reason is that you are comparing with AffineTransform and the expectation that it should behave the same, which it can’t because of it’s different definition. A Matrix is defined in the PDF spec, the AffineTransform is not. It’s a Java AWT concept not a PDF one. 

There are already helpers to transpose from/to AffineTransform. Of course we are open to add more helpers which ease the handling of a PDF matrix in AWT/AffineTransform.

Matrix can be used and is used wo AffineTransform and AWT and as such should exist and keep it’s PDF specific behavior.  


was (Author: msahyoun):
Although the differences might be confusing Matrix and it’s layout is defined in the PDF spec. So that’s why its behaving as is. Of course there are differences to AffineTransform as it’s dealing with a different definition and layout of a matrix. So conceptually being the same the do differ.

The only way I see that improvement request to being resolved is adding some more documentation - WDYT? Other ideas? 

> Matrix and AffineTransform have confusing differences
> -----------------------------------------------------
>
>                 Key: PDFBOX-1960
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1960
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: John Hewson
>            Assignee: Maruan Sahyoun
>            Priority: Minor
>
> I've been driven insane recently by trying to get pattern fills to render correctly. Patterns have their own matrix which is concatenated to the CTM and no matter how I applied the transformation, the results were wrong.
> It turns out that org.apache.pdfbox.util.Matrix is not behaving as expected, here's an example from a pattern I'm working on. I performed the same concatenation (i.e. multiplication) using our Matrix and Java's AffineTransform, the results are as follows:
> Java AffineTransform:
> [[2.0, 0.0, 1.251E-12], [0.0, 2.0, 1684.0]] *
> [[0.6, 0.0, 302.6], [0.0, 0.6, 1091.38]] =
> [[1.2, 0.0, 605.2000000000013], [0.0, 1.2, 3866.76]]
> PDFBox Matrix:
> [[2.0,0.0,0.0][0.0,2.0,0.0][1.251E-12,1684.0,1.0]] *
> [[0.6,0.0,0.0][0.0,0.6,0.0][302.6,1091.38,1.0]] =
> [[1.2,0.0,0.0][0.0,1.2,0.0][302.6,2101.78,1.0]]
> I suggest that we remove Matrix and replace it with AffineTransform.



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