Xojo Conferences

DynaPDF Manual - Page 264

Previous Page 263   Index   Next Page 265

Function Reference
Page 264 of 770
CreateRasterizer (Rendering Engine)
IRAS* rasCreateRasterizer(
const PPDF* IPDF,
// PDF Instance pointer
BYTE** Rows,
// Pointer to a row buffer or alternatively
BYTE* Buffer,
// Pointer to an image buffer that was allocated
// as one large buffer.
UI32 Width,
// Width in Pixel
UI32 Height,
// Height in Pixel
SI32 ScanlineLen,
// Scanline length in bytes
TPDFPixFormat PixFmt) // Pixel format in which the buffer is defined
typedef enum
pxf1Bit, // Defined for future use, not supported yet.
pxfGray, // 8 Bit gray
// RGB
// BGR -> Pixel format for Windows Bitmaps
pxfRGBA, // RGBA
pxfBGRA, // BGRA -> Pixel format for Windows Bitmaps
pxfARGB, // ARGB
pxfCMYK, // CMYK
The function creates a new instance of a rasterizer. The caller is responsible to release the rasterizer
when finish with DeleteRasterizer().
The rasterizer renders objects, e.g. a PDF page (see RenderPage()), into the supplied image buffer.
Once the object was rendered, the result can be displayed on screen or saved on disk in an
appropriate image format.
The image buffer can be changed if necessary with AttachImageBuffer(). This can be useful when the
size of the image must be changed, e.g. when the user changes the window size. The overhead to
attach a larger or smaller image buffer is minimal, and hence, very fast. So, it is mostly not required
to allocate the image in the largest size that a user can request, e.g. in a viewer application. The
image can be reallocated in the required size and attached to the rasterizer whenever necessary.
The pixel format is directly connected with the rasterizer and cannot be changed at runtime. When
the pixel format must be changed then delete the rasterizer and create a new one in that pixel format.
The image buffer can be either defined as one large memory block or as an array of scanlines. When
it was allocated as one large block then set the parameter Rows to NULL and pass the buffer to the
parameter Buffer. If the scanlines were allocated separately or in blocks then use the parameter Rows
instead. One of these parameters must be set but never both. The function checks first whether the
parameter Rows is present.
The rasterizer requires no special alignment of the scanlines, the scanlines can be byte aligned.

Previous topic: CreateRadioButton

Next topic: CreateRasterizerEx (Rendering Engine)