How to apply imagemask and transparency to general purpose path fills, strokes, and text?

Q: Can I apply imagemask and transparency to general purpose path
fills, strokes, and text?
----
A:
Yes, this is possible. You can use
element.GetGSate().SetSoftMask(smask_dict) to set the soft mask that
will affect subsequent elements on the page (please see "Soft-Mask
Dictionaries" on page 520 in PDF Reference for more information).

The following pseudocode creates a 'Soft-Mask Dictionary':

Obj* smask_dict = doc.CreateDictIndirect();
//smask_dict->Put("S", new Name("Luminosity"));
smask_dict->Put("S", new Name("Alpha"));

... Use ElementBuilder to create a transparency group ...
element_builder.Begin();
....
Obj* transp_grp = element_builder.End();

smask_dict->Put("G", transp_grp);

...
// Later on when creating page content...
element->GetGSate()->SetSoftMask(smask_dict);