API referenceGraphics

pdfSetStrokeColor

Set the fill (resp. stroke) color from one packed 32-bit color

C
BOOL32 __stdcall pdfSetFillColor(PPDF IPDF, uint32_t Color);
BOOL32 __stdcall pdfSetStrokeColor(PPDF IPDF, uint32_t Color);
Delphi
function pdfSetFillColor(const IPDF: PPDF; Color: Cardinal): LongBool; stdcall;
function pdfSetStrokeColor(const IPDF: PPDF; Color: Cardinal): LongBool; stdcall;

Purpose. Set the fill (resp. stroke) color from one packed 32-bit color value, interpreted against the currently active fill/stroke color space.

Description. Color is a packed value whose byte layout depends on FFillCS/FStrokeCS at the time of the call — for the RGB/CMYK/Gray device spaces this is the conventional 0x00BBGGRR-style packed color used throughout the SDK's other color-accepting APIs (annotations, backgrounds, etc.), unpacked per-channel and written to the content stream via EmitColorRef as an rg/RG, k/K, or g/G operator (or scn/SCN for a registered non-device space). Requires an open current content stream (page or template); returns False if none is active.

Parameters.

ParameterDescription
IPDFDocument handle.
ColorPacked color value, interpreted against the current fill (resp. stroke) color space.

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

Remarks. Changing Color does not change *which* color space is active — call pdfSetColorSpace/pdfSetFillColorSpace/pdfSetStrokeColorSpace first if a non-default space (ICC, Separation, DeviceN, Indexed) is required. pdfSetColors (below) sets both fill and stroke from one value in a single call.

See also. pdfSetFillColorEx, pdfSetFillColorF, pdfGetFillColor, pdfSetColorSpace, pdfSetColors.

C# (P/Invoke)

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

Setters

Exported names

pdfSetStrokeColor

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.