API referenceGraphics

pdfCreateCIEColorSpace

Register a new CIE-based color space — CalGray, CalRGB, or Lab

C
int32_t __stdcall pdfCreateCIEColorSpace(PPDF IPDF, TExtColorSpace Base, float* WhitePoint, float* BlackPoint, float* Gamma, float* Matrix);
Delphi
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.

ParameterDescription
IPDFDocument handle.
Base3=CalGray, 4=CalRGB, 5=Lab; any other value fails.
WhitePoint3 floats (XYZ), read unconditionally (null → treated as zeros).
BlackPoint3 floats (XYZ), read only if non-null; omitted otherwise.
GammaCalGray: 1 float. CalRGB: 3 floats. Unused for Lab.
MatrixCalRGB: 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)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfCreateCIEColorSpace(IntPtr IPDF, TExtColorSpace @Base, float[] WhitePoint, float[] BlackPoint, float[] Gamma, float[] Matrix);
Area
Graphics
Category

Object Creation

Exported names

pdfCreateCIEColorSpace

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.