DynaPDF Manual - Page 646

Previous Page 645   Index   Next Page 647

Function Reference
Page 646 of 839
pixel format contains an alpha channel then DynaPDF produces an image with pre-multiplied alpha
since this is what most operating systems expect.
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.
Differences can also occur when compositing a transparency group with the background. This
occurs seldom but differences are possible.
Blending Color Spaces
Pages and isolated transparency groups can specify the blending color space in which the group
must be rendered to achieve correct results. This is important because blend modes produce
completely different results for additive and subtractive color spaces.

Previous topic: Basics, Pixel Formats

Next topic: Rendering PDF Pages