pdfSetColorSpace
Select the current color space for both fill and stroke in
BOOL32 __stdcall pdfSetColorSpace(PPDF IPDF, int32_t ColorSpace);
function pdfSetColorSpace(const IPDF: PPDF; ColorSpace: Integer): LongBool; stdcall;
Purpose. Select the current color space for both fill and stroke in one call, with validation.
Description. Validates ColorSpace before accepting it: rejects negative values outright; if ColorSpace >= CS_HANDLE_BASE (3), it must resolve to a live registered color space via FindCSByHandle (an unknown or already-deleted handle fails); if ColorSpace is in the reserved range below CS_HANDLE_BASE it must be one of the three device ordinals (0=RGB, 1=CMYK, 2=Gray) — ColorSpace = 3.. bypassing the handle check would otherwise be accepted as garbage. On success, sets FFillCS := ColorSpace and FStrokeCS := ColorSpace atomically.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
ColorSpace | A device ordinal (0/1/2) or a registered color-space handle (>= CS_HANDLE_BASE). |
Return value. True if ColorSpace was valid and applied to both fill and stroke; False on validation failure (invalid ordinal or unknown/dead handle) — in that case neither FFillCS nor FStrokeCS is modified.
Remarks. This is the *validated* entry point. Compare with pdfSetFillColorSpace/pdfSetStrokeColorSpace below, which set only one side each and perform no validation at all.
See also. pdfSetFillColorSpace, pdfGetColorSpace.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetColorSpace
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.