THotPDF.RegisterSampledRadialGradient Method
Registers a reusable radial shading between a start circle and an end circle whose colours come from caller-supplied 8-bit DeviceRGB samples, so one sampled function spans the whole projected range of a repeating gradient
Declaration
function RegisterSampledRadialGradient(X0, Y0, R0, X1, Y1, R1, DomainT0, DomainT1: Single; const Samples: TBytes; SampleCount, Cycles: Integer): AnsiString;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
X0, Y0, R0 | Centre and radius of the start circle |
X1, Y1, R1 | Centre and radius of the end circle; this radius may be smaller than R0 |
DomainT0, DomainT1 | Input domain of the sampled function; supply the projected geometry span so the periodised samples already cover every cycle |
Samples | SampleCount x 3 bytes of periodised 8-bit DeviceRGB sample colours |
SampleCount | Number of samples; at least two |
Cycles | Whole-cycle count recorded as the pattern /Cycles entry so independent readers can recover the per-cycle unit scale |
Return value
Returns the generated Pattern resource name for THPDFPage.SetFillPattern or THPDFPage.SetStrokePattern
Behaviour
- Requires PDF 1.3 and follows the document version-lock policy
- Builds one PDF Function Type 0 sampled function with 8-bit DeviceRGB outputs and a zero-to-one per-component range
- Emits a Shading Type 3 dictionary between the two circles and wraps it in a reusable Pattern Type 2 resource with
Extendset on both ends - One sampled function spans the projected sample range, so the shading domain already covers every cycle and
Extendonly clamps outside the fill box - Writes the custom
/Cyclesentry on the pattern; PDF viewers ignore it - Raises an exception when
SampleCountis below two orSamplesdoes not hold exactlySampleCountx 3 bytes - Returns an empty name when the document version is locked below PDF 1.3
Example
SetLength(Samples, 6 * 3);
// ... fill six periodized 8-bit RGB samples covering three cycles
PatternName := Document.RegisterSampledRadialGradient(
300, 400, 0, 300, 400, 250, 0, 3, Samples, 6, 3);
Document.CurrentPage.SetFillPattern(PatternName);