API referenceGraphics

psrSetBlendMode

Read/write the blend-mode sub-field of a caller-owned packed

C
TBlendMode __stdcall psrGetBlendMode(uint32_t DrawParms);
void __stdcall psrSetBlendMode(uint32_t* DrawParms, uint32_t Value);
Delphi
function psrGetBlendMode(DrawParms: Cardinal): TBlendMode; stdcall;
procedure psrSetBlendMode(var DrawParms: Cardinal; Value: Cardinal); stdcall;

Purpose. Read/write the blend-mode sub-field of a caller-owned packed DrawParms bitfield word — not a document-level setting; see the chapter-level note above.

Description. DrawParms packs several independent style fields into one Cardinal, verified from the bit-shift constants in the engine : bits 0-7 = blend mode (TBlendMode ordinal, an 8-bit field for a 17-value enum — values above 16 are unreachable through this packing), bits 8-9 = line cap (2 bits for a 3-value TLineCapStyle), bits 12-13 = line join (2 bits for a 3-value TLineJoinStyle), bits 16-19 = rendering intent, bits 20-27 = text draw mode, bit 28 = an invisible-fill/invisible-stroke pair (read via a separate, non-ABI-exposed psrIsInvisible helper, not part of this chapter). psrGetBlendMode masks bits 0-7 (TBlendMode(DrawParms and $FF)); psrSetBlendMode clears those bits and ORs in the new value ((DrawParms and not $FF) or Value) — a true read-modify-write against the caller's own variable (passed var), leaving every other packed field untouched.

Parameters.

ParameterDescription
DrawParms*(Get)* The packed word to read. *(Set)* var — modified in place; only bits 0-7 change.
Value*(Set only)* New blend-mode ordinal (TBlendMode, 0..16); values above $FF would corrupt the adjacent line-cap field — callers must pass a valid TBlendMode ordinal, not an arbitrary Cardinal.

Return value. psrGetBlendMode: the decoded TBlendMode. psrSetBlendMode: none (void/procedure).

Remarks. TBlendMode is (bmNotSet, bmNormal, bmColor, bmColorBurn, bmColorDodge, bmDarken, bmDifference, bmExclusion, bmHardLight, bmHue, bmLighten, bmLuminosity, bmMultiply, bmOverlay, bmSaturation, bmScreen, bmSoftLight) — 17 values, ordinals 0..16, fitting comfortably within the 8-bit field.

See also. psrGetLineCapStyle (same packed word, adjacent bit range).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern void psrSetBlendMode(ref uint DrawParms, uint Value);
Area
Graphics
Category

Misc

Exported names

psrSetBlendMode

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.