DynaPDF Manual - Page 649

Previous Page 648   Index   Next Page 650

Function Reference
Page 649 of 839
the coordinate space of the image buffer. This makes it very easy to scroll and zoom into the page
since you don't need to consider the coordinate space of the PDF page.
The coordinate space of the rendering engine is top down and not bottom up like the native PDF
coordinate space. So, negative y-coordinates move the PDF image to the top direction of the
window and positive values move it to the opposite direction.
Example:
// This matrix scrolls the PDF image 120 pixels down
img.Matrix.a = 1.0;
img.Matrix.b = 0.0;
img.Matrix.c = 0.0;
img.Matrix.d = 1.0;
img.Matrix.x = 0.0;
img.Matrix.y = -120.0;
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
reached.
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!
 

Previous topic: The Transformation Matrix

Next topic: The update area, UpdateOnPathCount limit, UpdateOnImageCoverage limit, The return value