BOOL32 __stdcall pdfSetColorMask(PPDF IPDF, uint32_t ImageHandle, int32_t* Mask, uint32_t Count);
function pdfSetColorMask(const IPDF: PPDF; ImageHandle: Cardinal; Mask: PInteger; Count: Cardinal): LongBool; stdcall;
Purpose. Set a /Mask color-key range ([min1 max1 min2 max2 ...]) on an already-inserted image, making pixels whose component values fall inside the given per-component ranges transparent.
Description. Locates the image by ImageHandle in the document's image list; requires Count to be exactly 2 * NumComps for that image (two values — a min and a max — per color component; e.g. 6 values for an RGB image), rejecting an empty or mismatched-length array outright with no partial application. On success, copies the Count integers verbatim into the image entry's ColorMask field, which is consulted at image-serialization time to emit the PDF /Mask color-key array on that image's XObject dictionary.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
ImageHandle | Handle of a previously-inserted image. |
Mask | Count integers: [Comp1Min, Comp1Max, Comp2Min, Comp2Max, ...]. |
Count | Must equal exactly 2 * (the image's component count); any other length fails. |
Return value. True if ImageHandle was found and Count matched 2 * NumComps; False otherwise.
See also. pdfSetTransparentColor (a different, document-global transparency mechanism — not per-image).
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetColorMask
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.