pdfCreateAxialShading
Register a two-stop axial (linear-gradient) or radial
int32_t __stdcall pdfCreateAxialShading(PPDF IPDF, double sX, double sY, double eX, double eY, double SCenter, uint32_t SColor, uint32_t EColor, int32_t Extend1, int32_t Extend2);
int32_t __stdcall pdfCreateRadialShading(PPDF IPDF, double sX, double sY, double R1, double eX, double eY, double R2, double SCenter, uint32_t SColor, uint32_t EColor, int32_t Extend1, int32_t Extend2);
function pdfCreateAxialShading(const IPDF: PPDF; sX, sY, eX, eY, SCenter: Double; SColor, EColor: Cardinal; Extend1, Extend2: Integer): Integer; stdcall;
function pdfCreateRadialShading(const IPDF: PPDF; sX, sY, R1, eX, eY, R2, SCenter: Double; SColor, EColor: Cardinal; Extend1, Extend2: Integer): Integer; stdcall;
Purpose. Register a two-stop axial (linear-gradient) or radial (circle-to-circle-gradient) PDF shading.
Description. Both register a new shading entry (RegisterShading, kind 2=axial / 3=radial), storing the start/end geometry (axial: two points; radial: two circles, each a center point + radius), the two stop colors, and the Extend1/Extend2 booleans (whether the shading extends beyond its start/end bound rather than stopping abruptly). The SCenter parameter accepted by both ABI functions is never passed through to the underlying CreateAxialShading/CreateRadialShading implementation — it is silently dropped. Its name ("stop center") implies it would let a caller bias the 50%-interpolation point between SColor and EColor (e.g. placing the midpoint color transition at 30% instead of 50% along the gradient), but no such bias is ever applied — the two colors always interpolate linearly across the full 0.0..1.0 domain regardless of what SCenter is set to.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
sX, sY, eX, eY | *(Axial)* Gradient axis start/end points. *(Radial)* sX,sY=inner circle center, eX,eY=outer circle center. |
R1, R2 | *(Radial only)* Inner/outer circle radii. |
SCenter | Accepted but silently dropped — has no effect on the color interpolation midpoint despite its name. |
SColor, EColor | Start/end packed colors. |
Extend1, Extend2 | Whether the shading extends past its start/end bound (non-zero = extend). |
Return value. The new shading handle (always succeeds — no documented validation failure path for either function beyond the standard IPDF null check).
Remarks. Apply a registered shading to the current path/clip via the shading-fill mechanism (ApplyShading, exposed elsewhere in the ABI as the shading-pattern-fill entry point, not part of this chapter).
See also. pdfCreateStdPattern.
C# (P/Invoke)
public static extern int pdfCreateAxialShading(IntPtr IPDF, double sX, double sY, double eX, double eY, double SCenter, uint SColor, uint EColor, int Extend1, int Extend2);
Object Creation
pdfCreateAxialShading
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.