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

DynaPDF Manual - Page 77

Previous Page 76   Index   Next Page 78

Transparency
Page 77 of 750
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: Alpha Blending

Next topic: Blend Modes