API referenceGraphics

pdfSetFillColorEx

Set the fill (resp. stroke) color from a byte array, one byte

C
BOOL32 __stdcall pdfSetFillColorEx(PPDF IPDF, uint8_t* Color, uint32_t NumComponents);
BOOL32 __stdcall pdfSetStrokeColorEx(PPDF IPDF, uint8_t* Color, uint32_t NumComponents);
Delphi
function pdfSetFillColorEx(const IPDF: PPDF; Color: PByte; NumComponents: Cardinal): LongBool; stdcall;
function pdfSetStrokeColorEx(const IPDF: PPDF; Color: PByte; NumComponents: Cardinal): LongBool; stdcall;

Purpose. Set the fill (resp. stroke) color from a byte array, one byte (0-255) per color component.

Description. Reads NumComponents bytes from Color, normalizes each to the 0.0..1.0 range by dividing by 255, and writes the result via EmitColorComps as the appropriate content-stream color operator for the currently active fill/stroke color space (e.g. 1 component → gray, 3 → RGB, 4 → CMYK, or scn/SCN with NumComponents operands for a registered non-device space such as DeviceN). This is the byte-per-channel counterpart of pdfSetFillColorF, which instead takes already-normalized floats — use whichever matches the caller's native color representation.

Parameters.

ParameterDescription
IPDFDocument handle.
ColorPointer to NumComponents bytes, each 0..255.
NumComponentsNumber of color components (must match what the active color space expects).

Return value. True on success; False if there is no current content stream.

Memory & buffers. Color is read-only and copied into an internal array before emission; the caller's buffer is not retained.

See also. pdfSetFillColor, pdfSetFillColorF.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Graphics
Category

Setters

Exported names

pdfSetFillColorEx

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.