API referenceGraphics

pdfSetOpacity

Set/get a document-global "current opacity" value intended to

C
double __stdcall pdfGetOpacity(PPDF IPDF);
BOOL32 __stdcall pdfSetOpacity(PPDF IPDF, double Value);
Delphi
function pdfGetOpacity(const IPDF: PPDF): Double; stdcall;
function pdfSetOpacity(const IPDF: PPDF; Value: Double): LongBool; stdcall;

Purpose. Set/get a document-global "current opacity" value intended to apply to subsequently drawn content.

Description. Verified write-only no-op, unlike every line-style setter in this chapter. pdfSetOpacity validates Value is within 0.0..1.0 (silently ignoring, not failing, an out-of-range value — the stored value is simply left unchanged and True is still returned) and stores it into FCurOpacity. FCurOpacity has exactly three references — its field declaration, the 1.0 default at document-open, and this getter/setter pair — and is never read by any content-emission, ExtGState, or transparency-group code path. Setting it has no effect on rendered output; real per-draw-call opacity in this SDK is achieved instead through an ExtGState's FillAlpha/StrokeAlpha applied via pdfSetExtGState (see Extended Graphics State & Color Space Handles).

Parameters.

ParameterDescription
IPDFDocument handle.
ValueIntended opacity 0.0..1.0; out-of-range values are silently discarded (not stored, not an error).

Return value. pdfSetOpacity: True if IPDF is valid (regardless of whether Value was in range and actually stored). pdfGetOpacity: the last successfully-stored value, or 1.0 if never set / IPDF invalid.

Remarks. Use pdfSetExtGState's FillAlpha/StrokeAlpha fields for real transparency — this pair has no rendering effect.

See also. pdfSetExtGState (the real opacity mechanism).

C# (P/Invoke)

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

Setters

Exported names

pdfSetOpacity

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.