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

DynaPDF Manual - Page 581

Previous Page 580   Index   Next Page 582

Function Reference
Page 581 of 750
RenderPageEx (Rendering Engine)
Syntax:
LBOOL pdfRenderPageEx(
const PPDF* IPDF,
// PDF Instance pointer
const void* DC,
// Handle of a device context (HDC)
SI32* DestX,
// Destination x-coordinate to blend the image
SI32* DestY,
// Destination y-coordinate to blend the image
IPGE* PagePtr,
// Page pointer
IRAS* RasPtr,
// Pointer oft he rasterizer
TPDFRasterImage* Img) // see RenderPage()
The function renders a PDF page into an image buffer in the same way as RenderPage(), but instead
of using a callback function to update the destination window, the function blends the image directly
into a device context. This function is mainly provided for programming languages in which the
usage of callback functions is too complicated or too slow, e.g. C#, VB .Net, VB 6, FoxPro and so on.
The function calls internally the system function SetDIBitsToDevice() to copy the image buffer into
the device context. This function depends on the correct creation of the image buffer. Therefore, the
rendering engine provides additional helper functions to allocate and resize the image buffer if
necessary as well as to redraw the bitmap arbitrary often:
CreateRasterizerEx() creates the rasterizer and a corresponding DIB Section that is compatible
to the device context. The function supports the pixel formats pxf1Bit, pxfGray, pxfBGR, and
pxfBGRA. The default pixel format on Windows is pxfBGR. The rasterizer is the owner of the
image buffer; it will be released when the rasterizer will be deleted.
ResizeBitmap() can be used to change the size of the pixel buffer that was created with
CreateRasterizerEx(). This function is normally called in the OnResize() event of the form or
component into which the image is drawn.
Redraw() can be used to redraw the image on an arbitrary position. This function is required
to achieve flicker free scrolling when CreateRasterizerEx() was used to create the image
buffer.
It is of course also possible to allocate the image manually and to attach it to a rasterizer that was
created with CreateRasterizer(). However, the image buffer should be created with the system
function CreateDIBSection() because SetDIBitsToDevice() fails sometimes when the buffer was
allocated with malloc or new.
The parameters DestX and DestY are passed to SetDIBitsToDevice() when the window is updated.
The coordinates can be changed at runtime when RenderPageEx() is executed in a separate thread.
This makes it possible to move the image aroud while it is rendered. Each time the position was
changed the function updates the entire window to avoid artifacts on screen. The destination
coordinates can be set to NULL if not required. The destination coordinate are assumed to be 0, 0 in
this case.
 

Previous topic: How to save the image on disk?

Next topic: RenderPageToImage (Rendering Engine)