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

John Hewson commented on PDFBOX-1960:
-------------------------------------

Maruan, here's some code which performs the same calculation using Matrix and 
AffineTransform. I'd expect the matrices which are printed at the end to be 
identical (ignoring the ordering differences).

{code}
AffineTransform at1 = new AffineTransform(2.0, -0, 0, 2, 1.251E-12, 1684.0);
System.out.println(at1);

Matrix m1 = new Matrix();
m1.setFromAffineTransform(at1);
System.out.println("  PDFBox Matrix" + m1);
System.out.println("*");

AffineTransform at2 = new AffineTransform(0.6, 0, 0, 0.6, 302.6, 1091.38);
System.out.println(at2);

Matrix m2 = new Matrix();
m2.setFromAffineTransform(at2);
System.out.println("  PDFBox Matrix" + m2);
System.out.println("=");

at1.concatenate(at2);
System.out.println(at1);

Matrix m3 = m1.multiply(m2);
System.out.println("  PDFBox Matrix" + m3);
{code}

But what I get printed is this:

{code}
AffineTransform[[2.0, 0.0, 1.251E-12], [0.0, 2.0, 1684.0]]
  PDFBox Matrix[[2.0,0.0,0.0][0.0,2.0,0.0][1.251E-12,1684.0,1.0]]
*
AffineTransform[[0.6, 0.0, 302.6], [0.0, 0.6, 1091.38]]
  PDFBox Matrix[[0.6,0.0,0.0][0.0,0.6,0.0][302.6,1091.38,1.0]]
=
AffineTransform[[1.2, 0.0, 605.2000000000013], [0.0, 1.2, 3866.76]]
  PDFBox Matrix[[1.2,0.0,0.0][0.0,1.2,0.0][302.6,2101.78,1.0]]
{code}


> Matrix is wrong
> ---------------
>
>                 Key: PDFBOX-1960
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1960
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.4, 2.0.0
>            Reporter: John Hewson
>            Assignee: Maruan Sahyoun
>            Priority: Critical
>
> 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)

Reply via email to