Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1960

Matrix and AffineTransform have confusing differences

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Later
    • 2.0.0
    • None
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jahewson John Hewson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: