sschwieb opened a new pull request #127:
URL: https://github.com/apache/pdfbox/pull/127


   Calculating the intersection of two `Area` can take a lot of time. However, 
depending on the `Graphics2D` that is used for rendering, it may not be 
necessary to actually perform this operation. 
   
   For instance, when generating an SVG, the individual clipping paths can be 
serialized individually, and the intersection is then calculated at runtime, 
when the SVG file is rendered.
   
   The idea of this PR is to replace `PDGraphicsState.clippingPath` with a list 
of `GeneralPath`s, which is lazily evaluated, truncated & cached when 
`getCurrentClippingPath()` is called (effectively leaving the current behaviour 
of PdfBox unchanged, and it should also not have any significant impact on the 
performance).
   
   Additionally, a new method `protected void transferClip(PDGraphicsState 
graphicsState, Graphics2D graphics)` is added to `PageDrawer`. By default, this 
method makes use of `getCurrentClippingPath()` to call `graphics.setClip(...)`, 
which again is what PdfBox currently does.
   
   However, classes that extend `PageDrawer` can override this method, and 
directly access the individual clipping paths, without any need to calculate 
their intersection.
   
   In some cases (shading fills & transparency groups), it is still necessary 
to calculate the intersection.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to