This function must be called to prepare the image before it is used as a mask for another image. The mask image must be a grayscale image, and be either 1-bit or 8-bit. Depending on your needs you may want to call ReverseImage which will reverse the effects of the mask. A soft-mask is just a normal image, so if you have an image setup as a stencil mask and no longer want it to be a mask just change it to a soft mask image (MaskType = 2).
function TDebenuPDFLibrary1511.SetImageAsMask(MaskType: Integer): Integer;
Function DebenuPDFLibrary1511.PDFLibrary::SetImageAsMask(MaskType As Long) As Long
int DPLSetImageAsMask(int InstanceID, int MaskType)
The type of mask to set this image as:
1 = Stencil mask (only 1-bit images)
2 = Soft mask (1-bit and 8-bit images)