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

DynaPDF Manual - Page 270

Previous Page 269   Index   Next Page 271

Function Reference
Page 270 of 750
overlapping objects is as if the mask would be applied twice. If multiple objects must be drawn then
these objects are usually placed into a transparency group since a transparency group is rendered as
a hole and hence avoids issues with overlapping objects.
How to activate a soft mask?
Once the soft mask was created it can be activated and deactivated with an extended graphics state:
Example:
// Create the transpareny group
SI32 grp = pdfBeginTransparancyGroup(pdf, ...);
pdfEndTemplate(pdf);
// A soft mask can only be activated with an extended graphics state.
TPDFExtGState gs;
pdfInitExtGState(&gs);
// Create the soft mask from the group and set it in the graphics state
// object. You can change more settings of the graphics state if
// necessary...
gs.SoftMask = pdfCreateSoftMask(pdf, grp, smtLuminosity, 0);
// Create the extended graphics state now
SI32 extGState = pdfCreateExtGState(pdf, &gs);
// And activate it...
pdfSetExtGState(pdf, extGState);
// The soft mask is now active, draw something on the page
pdfInsertImage(pdf, ...);
// The only way to deactivate a soft mask is to set a second extended
// graphics state that disables the soft mask.
gs.SoftMask
= NULL;
gs.SoftMaskNone = true;
SI32 restoreSoftMask = pdfCreateExtGState(pdf, &gs);
pdfSetExtGState(pdf, restoreSoftMask);
Return values:
If the function succeeds the return value is a pointer to the soft mask object. This pointer is required
to create an extended graphics state so that the mask can be activated. If the function fails the return
value is NULL.
 

Previous topic: Possible rendering issues

Next topic: CreateStdPattern