PdfShading Class
A smooth shading (ISO 32000-2, 8.7.4.5): a gradient painted with PdfContentBuilder.PaintShading or used by a PdfShadingPattern. A shading does not belong to a document: each document that uses it gets its own object. The instances are immutable.
public abstract class PdfShadingProperties
| Name | Description |
|---|---|
| AntiAlias | Gets or initializes whether the shading is antialiased. |
| Background | Gets or initializes the background color, painted outside the shading when it is used by a pattern; null for none. |
| ColorSpace | Gets the color space of the colors of the shading. |
AntiAlias
PdfShading.csBackground
PdfShading.csColorSpace
PdfShading.csGets the color space of the colors of the shading.
public PdfDeviceColorSpace ColorSpace { get; }Property value
Methods
| Name | Description |
|---|---|
| Axial(PdfDeviceColorSpace, double, double, double, double, PdfFunction, bool, bool) | Creates an axial shading (type 2, 8.7.4.5.3): the colors vary along the line from the start point to the end point. |
| CoonsPatchMesh(PdfDeviceColorSpace, IReadOnlyList<PdfPatch>) | Creates a Coons patch mesh (type 6, 8.7.4.5.7): patches bounded by four cubic Bézier curves, with a color at each corner. |
| FunctionBased(PdfDeviceColorSpace, PdfFunction, double[]?, PdfMatrix?) | Creates a function-based shading (type 1, 8.7.4.5.2): the color of each point of the domain is the output of a function of two inputs. |
| LatticeMesh(PdfDeviceColorSpace, int, IReadOnlyList<PdfMeshVertex>) | Creates a lattice-form Gouraud-shaded triangle mesh (type 5, 8.7.4.5.6): rows of vertices, each two consecutive rows forming the triangles of a strip. |
| Radial(PdfDeviceColorSpace, double, double, double, double, double, double, PdfFunction, bool, bool) | Creates a radial shading (type 3, 8.7.4.5.4): the colors vary between two circles. |
| TensorPatchMesh(PdfDeviceColorSpace, IReadOnlyList<PdfPatch>) | Creates a tensor-product patch mesh (type 7, 8.7.4.5.8): the patches of PdfShading.CoonsPatchMesh with four more control points inside each one (PdfPatch.InnerPoints). |
| TriangleMesh(PdfDeviceColorSpace, IReadOnlyList<(PdfMeshVertex A, PdfMeshVertex B, PdfMeshVertex C)>) | Creates a free-form Gouraud-shaded triangle mesh (type 4, 8.7.4.5.5). |
Axial(PdfDeviceColorSpace, double, double, double, double, PdfFunction, bool, bool)
PdfShading.csCreates an axial shading (type 2, 8.7.4.5.3): the colors vary along the line from the start point to the end point.
public static PdfShading Axial(PdfDeviceColorSpace colorSpace, double x0, double y0, double x1, double y1, PdfFunction function, bool extendStart = false, bool extendEnd = false)Parameters
colorSpacePdfDeviceColorSpace- The color space.
x0double- The x coordinate of the start point.
y0double- The y coordinate of the start point.
x1double- The x coordinate of the end point.
y1double- The y coordinate of the end point.
functionPdfFunction- The function from the position on the line (0 to 1) to the components of the color.
extendStartbool- Whether the shading extends beyond the start point.
extendEndbool- Whether the shading extends beyond the end point.
Returns
PdfShading The shading.
CoonsPatchMesh(PdfDeviceColorSpace, IReadOnlyList<PdfPatch>)
PdfShading.csCreates a Coons patch mesh (type 6, 8.7.4.5.7): patches bounded by four cubic Bézier curves, with a color at each corner.
public static PdfShading CoonsPatchMesh(PdfDeviceColorSpace colorSpace, IReadOnlyList<PdfPatch> patches)Parameters
colorSpacePdfDeviceColorSpace- The color space.
patchesIReadOnlyList<PdfPatch>- The patches.
Returns
PdfShading The shading.
FunctionBased(PdfDeviceColorSpace, PdfFunction, double[]?, PdfMatrix?)
PdfShading.csCreates a function-based shading (type 1, 8.7.4.5.2): the color of each point of the domain is the output of a function of two inputs.
public static PdfShading FunctionBased(PdfDeviceColorSpace colorSpace, PdfFunction function, double[]? domain = null, PdfMatrix? matrix = null)Parameters
colorSpacePdfDeviceColorSpace- The color space.
functionPdfFunction- The function: two inputs, one output per component of the color space.
domaindouble[]?- The rectangle of the inputs
[xmin xmax ymin ymax];nullfor[0 1 0 1]. matrixPdfMatrix?- The matrix that maps the domain to the shading space;
nullfor the identity.
Returns
PdfShading The shading.
LatticeMesh(PdfDeviceColorSpace, int, IReadOnlyList<PdfMeshVertex>)
PdfShading.csCreates a lattice-form Gouraud-shaded triangle mesh (type 5, 8.7.4.5.6): rows of vertices, each two consecutive rows forming the triangles of a strip.
public static PdfShading LatticeMesh(PdfDeviceColorSpace colorSpace, int verticesPerRow, IReadOnlyList<PdfMeshVertex> vertices)Parameters
colorSpacePdfDeviceColorSpace- The color space.
verticesPerRowint- The number of vertices of each row, at least 2.
verticesIReadOnlyList<PdfMeshVertex>- The vertices, row by row; at least two rows.
Returns
PdfShading The shading.
Radial(PdfDeviceColorSpace, double, double, double, double, double, double, PdfFunction, bool, bool)
PdfShading.csCreates a radial shading (type 3, 8.7.4.5.4): the colors vary between two circles.
public static PdfShading Radial(PdfDeviceColorSpace colorSpace, double x0, double y0, double r0, double x1, double y1, double r1, PdfFunction function, bool extendStart = false, bool extendEnd = false)Parameters
colorSpacePdfDeviceColorSpace- The color space.
x0double- The x coordinate of the center of the start circle.
y0double- The y coordinate of the center of the start circle.
r0double- The radius of the start circle.
x1double- The x coordinate of the center of the end circle.
y1double- The y coordinate of the center of the end circle.
r1double- The radius of the end circle.
functionPdfFunction- The function from the position between the circles (0 to 1) to the components of the color.
extendStartbool- Whether the shading extends beyond the start circle.
extendEndbool- Whether the shading extends beyond the end circle.
Returns
PdfShading The shading.
TensorPatchMesh(PdfDeviceColorSpace, IReadOnlyList<PdfPatch>)
PdfShading.csCreates a tensor-product patch mesh (type 7, 8.7.4.5.8): the patches of PdfShading.CoonsPatchMesh with four more control points inside each one (PdfPatch.InnerPoints).
public static PdfShading TensorPatchMesh(PdfDeviceColorSpace colorSpace, IReadOnlyList<PdfPatch> patches)Parameters
colorSpacePdfDeviceColorSpace- The color space.
patchesIReadOnlyList<PdfPatch>- The patches.
Returns
PdfShading The shading.
TriangleMesh(PdfDeviceColorSpace, IReadOnlyList<(PdfMeshVertex A, PdfMeshVertex B, PdfMeshVertex C)>)
PdfShading.csCreates a free-form Gouraud-shaded triangle mesh (type 4, 8.7.4.5.5).
public static PdfShading TriangleMesh(PdfDeviceColorSpace colorSpace, IReadOnlyList<(PdfMeshVertex A, PdfMeshVertex B, PdfMeshVertex C)> triangles)Parameters
colorSpacePdfDeviceColorSpace- The color space.
trianglesIReadOnlyList<(PdfMeshVertex A, PdfMeshVertex B, PdfMeshVertex C)>- The triangles: three vertices each, whose colors are interpolated inside the triangle.
Returns
PdfShading The shading.