Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.CreateRadialShading

Creates radial sharing.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 10.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.CreateRadialShading"; PDF; sX; sY; R1; eX; eY; R2; SCenter; SColor; EColor { ; Extend1; Extend2 } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
sX X-Coordinate of the inner circle
sY Y-Coordinate of the inner circle
R1 Radius of the inner circle
eX X-Coordinate of the outer circle
eY Y-Coordinate of the outer circle
R2 Radius of the outer circle
SCenter Shading center
SColor Start color MBS("DynaPDF.RGB"; 120; 120; 220)
EColor End color MBS("DynaPDF.RGB"; 255; 255; 255) /* white */
Extend1 Extend the shading beyond the start point.
Pass 1 to extend or 0 if not. Default is 0.
0 Optional
Extend2 Extend the shading beyond the end point.
Pass 1 to extend or 0 if not. Default is 0.
0 Optional

Result

Returns number or error.

Description

Creates radial sharing.
Radial shadings define a color blend or gradient that varies between two circles. The shading may optionally be extended beyond the starting or ending circles by continuing the boundary colors indefinitely. Shadings of this type are commonly used to depict three-dimensional spheres and cones.
The shading center defines the point from where the first color will blend into the other. A value of 1 determines the exact center between the start and end point of the shading. Smaller values shift the shading center in direction to the start circle, greater values to the end circle.
Radial shadings can be drawn into a clipping path to restrict painting into this path. If the shading is drawn outside of a clipping path it is applied to the entire page. Not that extended shadings are opaque, objects behind the shading become invisible if they are overprinted by the shading.
Shadings are drawn by using the current coordinate system. It is recommended to understand that shadings have its own dimension like a normal shape. The parameters Extend1 and Extend2 extend the shading beyond its dimension. If the shading is extended it must normally be drawn into a clipping path to avoid overprinting of other objects.
Shadings support any device, ICCBased, and special color spaces like DeviceN or Separation. The color values of the start and end color must be defined in the current color space. See also DynaPDF.SetColorSpace, DynaPDF.SetExtColorSpace.
This function creates a shading object but it doesn't draw it on the page. The shading can be drawn with DynaPDF.ApplyShading.
If the function succeeds the return value is the shading handle, a value greater or equal zero. If the function fails, it returns an error.

See also CreateRadialShading function in DynaPDF manual.

Examples

Create a radial shading:

Set Variable [ $r ; Value: MBS( "DynaPDF.SaveGraphicState"; $PDF) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Rectangle"; $PDF; 100; 100; 200; 100; "NoFill") ]
Set Variable [ $r ; Value: MBS( "DynaPDF.ClipPath"; $PDF; "Winding"; "NoFill") ]
Set Variable [ $sh ; Value: MBS( "DynaPDF.CreateRadialShading"; /* Creates radial sharing. */
$PDF; /* The PDF reference returned from DynaPDF.New. */
165; /* X-Coordinate of the inner circle */
170; /* Y-Coordinate of the inner circle */
5; /* Radius of the inner circle */
150; /* X-Coordinate of the outer circle */
185; /* Y-Coordinate of the outer circle */
100; /* Radius of the outer circle */
,7; /* Shading center */
MBS("DynaPDF.RGB"; 255; 255; 255) /* white */; /* Start colore.g. MBS("DynaPDF.RGB"; 120; 120; 220) */
MBS("DynaPDF.RGB"; 120; 120; 220); /* End colore.g. MBS("DynaPDF.RGB"; 255; 255; 255) /* white */ */
1; /* Optional; Extend the shading beyond the start point.
Pass 1 to extend or 0 if not. Default is 0.e.g. 0 */
1) /* Optional; Extend the shading beyond the end point.
Pass 1 to extend or 0 if not. Default is 0.e.g. 0 */ ]
Set Variable [ $r ; Value: MBS( "DynaPDF.ApplyShading"; $PDF; $sh) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.RestoreGraphicState"; $PDF) ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 20th April 2020, last changed 15th January 2021


DynaPDF.CreateOCG - DynaPDF.CreateRadioButton