> On 12 Sep 2016, at 06:58, Markus Barbey <[email protected]> wrote:
> 
>> On 2016-09-09 19:49 ( 0200), John Hewson <[email protected]> wrote: 
>> 
>>> On 7 Sep 2016, at 08:02, Markus Barbey <[email protected]> wrote:> 
>>>> 
>>> Hello there,> 
>>>> 
>>> when using> 
>>>> 
>>> PDFRender#renderPageToGraphics(int, Graphics2D)> 
>>>> 
>>> you can set an AffineTransform (e.G. scale and translate) in the Graphics2D 
>>> instance which results in a partially rendered PDF page. Nevertheless each 
>>> resource gets rendered by the renderer - even if it is not visible in the 
>>> resulting BufferedImage. > 
>>>> 
>>> For example: PDF original size 800x600> 
>>>> 
>>> --------------------------------------------> 
>>>> 
>>>        BufferedImage image = new BufferedImage (400, 200, 
>>> BufferedImage.TYPE_INT_RGB);> 
>>>        Graphics2D graphics = image.createGraphics ();> 
>>>> 
>>>        AffineTransform tx = new AffineTransform ();> 
>>>        tx.translate (200,300);> 
>>>        tx.scale (2, 2);> 
>>>        graphics.setTransform (tx);> 
>>>> 
>>>        renderer.renderPageToGraphics (0, graphics);> 
>>>        graphics.dispose ();> 
>>>> 
>>> --------------------------------------------> 
>>>> 
>>> When you have some large images (e.G. high DPI logo and charts) on a single 
>>> PDF page there could be a great performance boost for partial rendering 
>>> (that is mainly required in PDF viewer controls), if images, that are not 
>>> going to be visible in the resulting BufferedImage skipped while drawing. 
>>> Nowadays they are converted to a BufferedImage (which can last remarkable 
>>> time) and drawn to the Graphics2D. Due to size and clipping configuration 
>>> they are not visible in the resulting BufferedImage.> 
>> 
>> I would recommend caching the BufferedImage for an entire rendered page 
>> instead and then having your PDF viewer display a portion of that image.> 
>> 
>> — John> 
>> 
>>>> 
>>>> 
>>> Cu> 
>>> Markus> 
>>>> 
>>> ---------------------------------------------------------------------> 
>>> To unsubscribe, e-mail: [email protected]> 
>>> For additional commands, e-mail: [email protected]> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------> 
>> To unsubscribe, e-mail: [email protected]> 
>> For additional commands, e-mail: [email protected]> 
>> 
>> 
> 
> Hello John,
> 
> caching the whole page as BufferedImage may need a lot of memory (think about 
> high DPI displays combined with a scaled PDF) ;-)

It's a lot, for sure, but not *that* much. If you were after smooth animations 
it could be a deal breaker, but for a static image less so. It does depend a 
lot on your use case though, so YMMV.

> The massive performance loss of partial rendering has been caused by the 
> 2.0.2 implementation. As the 2.0.3 SNAPSHOT provides some impressive 
> performance improvements, this issue isn't almost noticeable in 2.0.3 any 
> longer.

That's great. I'm even happier that we have a general performance speed up in 
2.0.3 which benefits everyone, not just the partial rendering use case. And 
we're seeing that overdraw isn't costing us much time - good!

-- John

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

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

Reply via email to