DynaPDF Manual - Page 87

Previous Page 86   Index   Next Page 88

Transparency
Page 87 of 839
Transparency Groups / Soft Masks
To achieve more complex transparency effects PDF supports transparency groups and soft masks. A
transparency group can be created with BeginTransparencyGroup(), it is an extended template that
supports the same contents as regular templates, such as vector graphics, text, shadings, or images
(see BeginTemplate() for further information).
The difference between a normal template and a transparency group is that a transparency group is
composited with the backdrop as hole. This property is very important when working with soft
masks.
A soft mask consists in turn of a transparency group and a corresponding dictionary that describes
the properties of the mask. The rendered result is then used as an alpha channel to mask arbitrary
objects with it. A soft mask can be created with CreateSoftMask().
Once a soft mask was created and activated in the graphics state anything that will be drawn will
now will be masked.
However, a soft mask is designed to mask exactly one object at time since the effect on overlapping
objects would be as if the mask is applied twice. To enable the usage on arbitrary artwork, the
contents can be drawn into a transparency group since a transparency group is composited with the
backdrop as a hole. This makes sure that the soft mask causes no side effects when overlapping
objects must be masked.
Transparency groups can also be used stand alone, that means outside an active soft mask or other
transparency group, but most effects which can be achieved in this way can also be achieved with
regular drawing techniques. When a specific effect can be achieved without a transparency group
then this way is preferred!
Transparency groups are expensive in terms of memory usage and processing time because a viewer
must mostly render the group into an intermediate image buffer so that it can be composited with
backdrop as a hole.
Because transparency groups cause already a considerable overhead, a document should be more
carefully created in regard to efficiency and rendering speed. Especially the usage of useless clipping
paths and JPEG 2000 compressed images should be avoided.
 

Previous topic: PDF Transparency, Alpha Blending

Next topic: Blend Modes