Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 576

Previous Page 575   Index   Next Page 577

Function Reference
Page 576 of 750
Zooming into the page is very easy too. Simply set the zoom factor to the a and d coefficients of the
transformation matrix:
img.Matrix.a = m_Zoom;
img.Matrix.b = 0.0;
img.Matrix.c = 0.0;
img.Matrix.d = m_Zoom;
img.Matrix.x = m_x;
img.Matrix.y = m_y;
The zoom factor should take the page format into account and not simply multiply the device
coordinates with a specific factor. The zoom factor must be restricted so that no number overflow
occurs. A suitable limit is around 32 or 64 (6400%).
The OnUpdateWindow Event
When rendering complex PDF pages in a viewer it is strongly recommended to update the window
from time to time with the portion of contents that was already rendered. To achieve this, the
structure TPDFRasterImage supports two variables which specify when the window should be
updated as well as a corresponding callback function that is executed if one of the limits were
Please note that when the TOnUpdateWindow callback function is set, it is not required to draw
the image into the window after RenderPage() was called!
When the callback function is set, RenderPage() fires at least one update event that covers the entire
imageble area. In the best case, the page was already fully rendered at this point. Calling
SetDIBitsToDevice() or similar system functions after RenderPage() is not required and causes just
unnecessary overhead!
The update area
The callback function returns the area that must be updated. It is strongly recommended to update
only this area. This can drastically speed up processing and the application can process more update
events with less overhead. The first call covers the entire imageble area when InitWhite or
DrawFrameRect was set to true. Further calls occur only when the page was not already fully
rendered at this point.
UpdateOnPathCount limit
The member UpdateOnPathCount specifies the number of paths which must be drawn before the
callback function should be executed. The value should not be too small to avoid too many update
events. When the value is too large then too few update events occur and you cannot see how the
page is drawn.
The test containers use a limit of 5000. This is a good compromise between speed and the number of
update events on faster computer systems. DynaPDF counts also the number of vertices which were
already rendered. The update event is fired when either the UpdateOnPathCount limit was reached or

Previous topic: The Transformation Matrix

Next topic: Multi-Threading strategies