pdfCreateCIEColorSpace
Register a new CIE-based color space — CalGray, CalRGB, or Lab
int32_t __stdcall pdfCreateCIEColorSpace(PPDF IPDF, TExtColorSpace Base, float* WhitePoint, float* BlackPoint, float* Gamma, float* Matrix);
function pdfCreateCIEColorSpace(const IPDF: PPDF; Base: TExtColorSpace; WhitePoint, BlackPoint, Gamma, Matrix: PSingle): Integer; stdcall;
Purpose. Register a new CIE-based color space — CalGray, CalRGB, or Lab — chosen by Base.
Description. Base selects the kind by its TExtColorSpace ordinal: 3 → CalGray, 4 → CalRGB, 5 → Lab; any other value fails outright. Reads 3 floats from WhitePoint (required — always read, even if the pointer is null, in which case zeros are substituted rather than failing) and, conditionally on BlackPoint <> nil, 3 floats from BlackPoint. The remaining reads depend on the kind: CalGray reads 1 float from Gamma; CalRGB reads 3 floats from Gamma and 9 floats from Matrix (a 3×3 linear transform); Lab reads 4 floats from Matrix — **for Lab, the Matrix parameter is repurposed to carry the a\*/b\* range, not a matrix**, despite the shared parameter name across all three kinds. Delegates to CreateCIEColorSpace, which further requires WhitePoint to have supplied at least 3 values (redundant with the caller's own zero-fill) and defaults missing gamma values to 1.0 and a missing Lab range to [-100,100,-100,100].
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Base | 3=CalGray, 4=CalRGB, 5=Lab; any other value fails. |
WhitePoint | 3 floats (XYZ), read unconditionally (null → treated as zeros). |
BlackPoint | 3 floats (XYZ), read only if non-null; omitted otherwise. |
Gamma | CalGray: 1 float. CalRGB: 3 floats. Unused for Lab. |
Matrix | CalRGB: 9 floats (3×3 XYZ transform). **Lab: repurposed as 4 floats, the a\*/b\* range** — not a matrix despite the name. Unused for CalGray. |
Return value. The new color-space handle on success; -1 if Base is not 3/4/5 or WhitePoint resolves to fewer than 3 values.
See also. pdfCreateICCBasedColorSpace.
C# (P/Invoke)
public static extern int pdfCreateCIEColorSpace(IntPtr IPDF, TExtColorSpace @Base, float[] WhitePoint, float[] BlackPoint, float[] Gamma, float[] Matrix);
Object Creation
pdfCreateCIEColorSpace
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.