[ 
https://issues.apache.org/jira/browse/PDFBOX-1991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson updated PDFBOX-1991:
--------------------------------

    Description: 
I'd like to remove the page height parameter from PDPattern as soon as possible 
because of doubts over its safety (i.e. the current stream being processed may 
be a pattern or a form, not a page). Before I do that we need to remove its 
only use, which is...

The page height is passed to all shading PaintContext subclasses but it is only 
used in GouraudShadingContext. However, all other drawing in PDFBox is done 
using the native PDF y-axis which is flipped via a call to Graphics2D#scale(0, 
-1) but the following code in GouraudShadingContext flips the y-axis:

v.point = new Point.Double(v.point.getX(), pageHeight + xform.getTranslateY() - 
v.point.getY());

So it seems like this could be removed and the y-axis inversion done elsewhere 
with either a Matrix, AffineTransform or Grpahics2D#scale.

  was:
I'd like to remove the page height parameter from PDPattern as soon as possible 
because of doubts over its safety (i.e. the current stream being processed may 
be a pattern or a form, not a page). Before I do that we need to remove its 
only use, which is...

The page height is passed to all shading PaintContext subclasses but it is only 
used in GouraudShadingContext. However, all other drawing in PDFBox is done 
using the native PDF y-axis which is flipped via a call to Graphics2D#scale(0, 
-1) but the following code in GouraudShadingContext flips the y-axis:

{code}
v.point = new Point.Double(v.point.getX(), pageHeight + xform.getTranslateY() - 
v.point.getY());
{code}

So it seems like this could be removed and the y-axis inversion done elsewhere 
with either a Matrix, AffineTransform or Grpahics2D#scale.


> Shading PaintContexts should not depend on the page height
> ----------------------------------------------------------
>
>                 Key: PDFBOX-1991
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1991
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: John Hewson
>            Priority: Minor
>
> I'd like to remove the page height parameter from PDPattern as soon as 
> possible because of doubts over its safety (i.e. the current stream being 
> processed may be a pattern or a form, not a page). Before I do that we need 
> to remove its only use, which is...
> The page height is passed to all shading PaintContext subclasses but it is 
> only used in GouraudShadingContext. However, all other drawing in PDFBox is 
> done using the native PDF y-axis which is flipped via a call to 
> Graphics2D#scale(0, -1) but the following code in GouraudShadingContext flips 
> the y-axis:
> v.point = new Point.Double(v.point.getX(), pageHeight + xform.getTranslateY() 
> - v.point.getY());
> So it seems like this could be removed and the y-axis inversion done 
> elsewhere with either a Matrix, AffineTransform or Grpahics2D#scale.



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

Reply via email to