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

DynaPDF Manual - Page 573

Previous Page 572   Index   Next Page 574

Function Reference
Page 573 of 750
The image buffer must be initialized with zero or black if the pixel format contains an alpha channel.
It is also possible to set InitWhite to true and to set the flag rfInitBlack so that an image buffer with an
alpha channel can be correctly initialized. The flag rfInitBlack is only considered if the pixel format
contains an alpha channel. If the flag rfInitBlack is absent then the image buffer will be initialized to
white but the alpha channel is set to zero for each pixel.
The internal blend functions consider this initialization so that blend functions produce still correct
results. This kind of initialization can be useful if the image should be copied into the video buffer
with a function that doesn't support alpha blending, e.g. SetDIBitsToDevice(). However, to achieve
correct results the flag rfCompositeWhite must be set too. This flag makes sure that the image will be
composited with a white background after the page was fully rendered. The result is a fully opaque
image. The advantage is that it is not required to clear the background with white before the image
can be drawn. This technique is ued by the page cache and by the viewer examples if the pixel
format is set to pxfBGRA.
An opaque image buffer must be initialized with 255 or fully white. You can also set InitWhite to true
to make sure that the image buffer will be correctly initialized before rendering.
Rendering into an opaque image buffer produces mostly the same result but not always. Differences
can occur when a blend function is used. Since the background is opaque, anti-alisasing artifacts can
occur since anti-aliased pixels are rendered toward white and not to fully transparent as it would be
the case when the image contains an alpha channel.
The difference can be seen in the pictures below. The three circles were drawn with the blend mode
bmExclusion. The RGBA version contains no anti-aliasing artifacts but the RGB version contains an
ugly border where the circles overlap.
RGBA
RGB
Differences can also occur when compositing a transparency group with the background. This occurs
seldom but differences are possible.
Rendering PDF Pages
Most members of the structure TPDFRasterImage are meaningful when pages are rendered in a
viewer application. For other purposes most members can be set to their defaults.
RenderPage() renders a PDF page according to the page's orientation and bounding boxes. When a
crop box is present the page is scaled and clipped into the crop box. When no crop box is present the
media box is used instead. This is the default behaviour in viewer applications.
 

Previous topic: Pixel Formats

Next topic: The Transformation Matrix