DynaPDF Manual - Page 305

Previous Page 304   Index   Next Page 306

Function Reference
Page 305 of 839
CreateSoftMask
Syntax:
void* pdfCreateSoftMask(
const PPDF* IPDF,
// Instance pointer
UI32 TranspGroup,
// Handle of the transparency group (required)
TSoftMaskType Type, // Soft mask type, see description
UI32 BackColor)
// Background color if the type is smtLuminosity
typedef enum
{
smtAlpha,
smtLuminosity
}TSoftMaskType;
The function creates a soft mask from a transparency group, see BeginTransparencyGroup() for
further information. A soft mask represents an alpha channel that can be applied on vector graphics,
texts, and images.
The creation of a soft mask begins with the creation of a transparency group. The rendered result of
the transparency group represents finally the soft mask or alpha channel.
The color space of the transparency group should be device gray or a gray ICC based color space. It
is also possible to define the group in RGB or CMYK but this is not really meaningful since the
result must always be converted to gray.
Soft mask types
The parameter Type specifies the type of the soft mask. If the type is smtAlpha the mask is computed
from the group's alpha channel, disregarding any color in the group. This type of soft mask works
like a clipping path. Any pixel that is drawn in the group makes the mask transparent, uncovered
areas remain invisible. There are not many cases for which this kind of masking can be useful. It is
mostly used for images if the source image format did not support an alpha channel or if the mask
was stored in a separate image file.
If the type is smtLuminosity the group is composited with a fully opaque backdrop as specified by
the parameter BackColor (the background color must be specified in the group's color space). The
mask is finally computed from the luminosity of the resulting color at each point in the group. This
enables the definition of the mask with arbitrary vector graphics, text, shadings, and images. The
underlying transparency group must be isolated since a non-isolated group would be initialized
with the current backdrop and this conflicts with the properties of the soft mask.
This is the most common type of a soft maks since it works like a real alpha channel with the
advantage that it can be created with vector graphics and especially shadings.
 

Previous topic: CreateSigFieldAP

Next topic: Possible rendering issues, How to activate a soft mask?