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

John Hewson edited comment on PDFBOX-1094 at 12/10/14 11:17 PM:
----------------------------------------------------------------

Yes, the part of the PDF spec which I quoted applies only to matrices with all 
elements being zero, not just a scale of zero. I've updated my original comment 
appropriately. From your last comment I see what you mean about the matrix 
being valid, indeed it is, as the scaling is applied separately from the 
translation and skew. I had forgotten that matrices worked like this! It's even 
mentioned in the textbook as "1st-scale, 2nd-shear, 3rd-rotate.".

As you've spotted the formula from the PDF spec confirms this:

{code}
x′ = (a * x) + (c * y) + e   // a = scale x
y' = (b * x) + (d * y) + f   // b = scale y
{code}

Indeed, as you've found, the matrix for a rotation of 270° is \[0 -1 1 0 0 0\] 
when written as a PDF array. So the scaling factor is indeed zero, but the 
matrix is perfectly valid.

So what's the problem? It's as you said:
{quote}
So if somebody extracts the "scale" elements and uses them as a factor, it will 
go wrong
{quote}

Indeed, extracting the scaling factor doesn't work for matrices which include 
rotation. This is true for any matrix with rotation, not just the special cases 
of 270° and 90° when the scale is 0.

So now we know the problem, but what is the solution?


was (Author: jahewson):
Yes, the part of the PDF spec which I quoted applies only to matrices with all 
elements being zero, not just a scale of zero. I've updated my original comment 
appropriately. From your last comment I see what you mean about the matrix 
being valid, indeed it is, as the scaling is applied separately from the 
translation and skew. I had forgotten that matrices worked like this! It's even 
mentioned in the textbook as "1st-scale, 2nd-shear, 3rd-rotate.".

As you've spotted the formula from the PDF spec confirms this:

{code}
x′ = (a * x) + (c * y) + e   // a = scale x
y' = (b * x) + (d * y) + f   // b = scale y
{code}

Indeed, as you've found, the matrix for a rotation of 270° is \[0 -1 1 0 0 0\] 
when written as a PDF array. So the scaling factor is indeed zero, but the 
matrix is perfectly valid.

So what's the problem? It's, as you said:
{quote}
So if somebody extracts the "scale" elements and uses them as a factor, it will 
go wrong
{quote}

Indeed, extracting the scaling factor doesn't work for matrices which include 
rotation. This is true for any matrix with rotation, not just the special cases 
of 270° and 90° when the scale is 0.

So now we know the problem, but what is the solution?

> Pattern colorspace support
> --------------------------
>
>                 Key: PDFBOX-1094
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1094
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 1.6.0, 2.0.0
>            Reporter: Andreas Lehmkühler
>            Priority: Blocker
>             Fix For: 2.0.0
>
>         Attachments: ColoredTilingPaint.patch, PATTYP1.pdf, PATTYP2.pdf, 
> PDF32000_2008_pg737.pdf, PDFBOX-1094-065514-XStep32767.pdf, 
> PDFBOX-1094-094730.pdf, PDFBOX-1094-096213-p18.pdf, 
> PDFBOX-1094-118358-Step-32767.pdf, PDFBOX-1094-PDFBOX-269.pdf, 
> PDFBOX-1094-tiling_pattern.pdf-1-broken-tiles-with-ceil.png, 
> PDFBOX-1861-tracemonkey13.png, PDFStreamEngine.patch, PageDrawer.patch, 
> _pdfbox-1094-tiling_pattern.pdf-1-blurry.png, bugzilla8677511.jpg, 
> gs-bugzilla688728.pdf, gs-bugzilla691715.pdf, gs-bugzilla692152.pdf, 
> gs-bugzilla692503.ai, gs-bugzilla693653.pdf, gs-bugzilla694385.pdf, 
> jagpdf_doc_patterns.pdf, jagpdf_doc_patterns.pdf-1.png, 
> pdfbox-1094-pdf32000_2008_pg737.pdf-1.png, 
> pdfbox-1094-pdf32000_2008_pg737.pdf-1.png, pdfbox-1094-pdfbox-269.pdf-2.png, 
> pdfbox-1094-tiling_pattern.pdf-1.png, pdfbox-1094-tiling_pattern.pdf-1.png, 
> pdfbox-1094-tiling_pattern.pdf-1.png, pdfbox-1861-tracemonkey.pdf-13.png, 
> pdfbox-1861-tracemonkey.pdf-13.png, tiling_pattern.pdf, 
> v2_tiling_patterns_v2.patch
>
>
> PDFBox doesn't support PDPattern colorspaces



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to