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

DynaPDF.CreateAxialShading

Creates an axial sharing.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 10.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.CreateAxialShading"; PDF; sX; sY; eX; eY; 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 start point 0
sY Y-Coordinate of the start point 0
eX X-Coordinate of the end point 0
eY Y-Coordinate of the end point 78
SCenter Shading center 2
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 an axial sharing.
Axial shadings define a color blend or gradient that varies along a linear axis between two endpoints and extends indefinitely perpendicular to that axis. The shading may optionally be extended beyond either or both endpoints by continuing the boundary colors indefinitely.
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 starting and ending point of the shading. Smaller values shift the shading center in direction to the start point, greater values in the direction to the end point.
Axial 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 becomes 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 the color spaces DeviceGray, DeviceRGB, and DeviceCMYK. The color values of the start and end color must be defined in the current color space. See also DynaPDF.SetColorSpace.
Shadings are invisible as long they are not drawn by using the function DynaPDF.ApplyShading. DynaPDF.ApplyShading requires a shading handle that was returned by this function.
If the function succeeds the return value is the handle of the shading, a value greater or equal zero. If the function fails it returns an error.

See also CreateAxialShading function in DynaPDF manual.

Examples

Draw rectangle with shading:

# save state before, so you can restore
Set Variable [ $r; Value:MBS( "DynaPDF.SaveGraphicState"; $PDF) ]
# draw something for a path
Set Variable [ $r; Value:MBS( "DynaPDF.Rectangle"; $PDF; 0; 0; 200; 80; "NoFill") ]
# to clip here by this path
Set Variable [ $r; Value:MBS( "DynaPDF.ClipPath"; $PDF; "Winding"; "NoFill") ]
# and now create a shading and apply it
Set Variable [ $sh; Value:MBS( "DynaPDF.CreateAxialShading"; $PDF; 0; 0; 200; 0; ,5; MBS("DynaPDF.RGB"; 255; 255; 255) /* white */; MBS("DynaPDF.RGB"; 120; 120; 220); 1; 1) ]
Set Variable [ $r; Value:MBS( "DynaPDF.ApplyShading"; $PDF; $sh) ]
# restore
Set Variable [ $r; Value:MBS( "DynaPDF.RestoreGraphicState"; $PDF) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 20th April 2020, last changed 28th December 2020


DynaPDF.CreateAnnotAP - DynaPDF.CreateButton