TransferFunction Class
A function that gives a new value to a component of each pixel: a feFuncR, feFuncG, feFuncB or feFuncA element of SVG.
public sealed class TransferFunctionRemarks
The function takes the value C of a straight color or of the alpha, as a fraction of one, and its result is clamped to the range from 0 to 1. With n values v0 to v(n-1): a table gives vk + (C - k / (n - 1)) (n - 1) (v(k+1) - vk) with k = floor(C (n - 1)) (v(n-1) for C = 1); a discrete table gives vk with k = floor(C n) (v(n-1) for C = 1); a linear function gives slope C + intercept; a gamma function gives amplitude C^exponent + offset, with Math.Pow. A table without values is the identity. Transfer functions are immutable and thread-safe.
Properties
| Name | Description |
|---|---|
| Amplitude | Gets the amplitude of a gamma function. |
| Exponent | Gets the exponent of a gamma function. |
| Identity | Gets the function that changes nothing. |
| Intercept | Gets the intercept of a linear function. |
| Kind | Gets the kind of the function. |
| Offset | Gets the offset of a gamma function. |
| Slope | Gets the slope of a linear function. |
| Values | Gets the values of a table: tableValues. |
Amplitude
TransferFunction.csExponent
TransferFunction.csIdentity
TransferFunction.csGets the function that changes nothing.
public static TransferFunction Identity { get; }Property value
Intercept
TransferFunction.csOffset
TransferFunction.csSlope
TransferFunction.csValues
TransferFunction.csMethods
| Name | Description |
|---|---|
| CreateDiscrete(ReadOnlySpan<double>) | Creates a function of steps: type="discrete". |
| CreateGamma(double, double, double) | Creates a gamma function: type="gamma". |
| CreateLinear(double, double) | Creates a linear function: type="linear". |
| CreateTable(ReadOnlySpan<double>) | Creates a function that interpolates in a table: type="table". |
CreateDiscrete(ReadOnlySpan<double>)
TransferFunction.csCreates a function of steps: type="discrete".
public static TransferFunction CreateDiscrete(params scoped ReadOnlySpan<double> values)Parameters
valuesReadOnlySpan<double>- The values of the steps, from 0 to 1. They are copied; without values, the function is the identity.
Returns
TransferFunction The function.
Exceptions
ArgumentException- A value is not a finite number.
CreateGamma(double, double, double)
TransferFunction.csCreates a gamma function: type="gamma".
public static TransferFunction CreateGamma(double amplitude, double exponent, double offset)Parameters
Returns
TransferFunction The function.
Exceptions
ArgumentException- A parameter is not a finite number.
CreateLinear(double, double)
TransferFunction.csCreates a linear function: type="linear".
public static TransferFunction CreateLinear(double slope, double intercept)Parameters
Returns
TransferFunction The function.
Exceptions
ArgumentException- A parameter is not a finite number.
CreateTable(ReadOnlySpan<double>)
TransferFunction.csCreates a function that interpolates in a table: type="table".
public static TransferFunction CreateTable(params scoped ReadOnlySpan<double> values)Parameters
valuesReadOnlySpan<double>- The values, spread evenly from 0 to 1. They are copied; without values, the function is the identity.
Returns
TransferFunction The function.
Exceptions
ArgumentException- A value is not a finite number.