DynaPDF Manual - Page 633

Previous Page 632   Index   Next Page 634

Function Reference
Page 633 of 818
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

Previous topic: The Transformation Matrix

Next topic: UpdateOnImageCoverage limit, The return value, Multi-Threading strategies

Start Chat