THotPDF.RegisterMultiStopRadialGradient Method
Registers a reusable native PDF radial shading that interpolates two or more color stops between an inner circle and an outer circle
Declaration
function RegisterMultiStopRadialGradient(X0, Y0, R0, X1, Y1, R1: Single; const StopPositions: array of Single; const StopColors: array of Single; ComponentsPerStop: Integer): AnsiString;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
X0, Y0, R0 | Center and non-negative radius of the inner circle |
X1, Y1, R1 | Center and non-negative radius of the outer circle |
StopPositions | Two or more strictly increasing finite offsets in the inclusive range zero to one |
StopColors | Flat-packed finite color components in the inclusive range zero to one |
ComponentsPerStop | 1 selects DeviceGray, 3 selects DeviceRGB, and 4 selects DeviceCMYK |
Return value
Returns the generated Pattern resource name for THPDFPage.SetFillPattern or THPDFPage.SetStrokePattern
Behavior
- Builds one PDF Function Type 3 stitching function from bounded Function Type 2 segments
- Emits a Shading Type 3 dictionary and wraps it in a reusable Pattern Type 2 resource
- Extends the first and last stop colors beyond the radial domain
- Rejects non-finite coordinates, negative radii, malformed color arrays, duplicate offsets, and offsets or color components outside their valid ranges
- Requires PDF 1.3 and follows the document version-lock policy
Example
PatternName := Document.RegisterMultiStopRadialGradient(
300, 400, 0, 300, 400, 250,
[0.0, 0.5, 1.0],
[1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0], 3);
Document.CurrentPage.SetFillPattern(PatternName);