ComponentTransfer#
Added in version 4.20.
- class ComponentTransfer(*args, **kwargs)#
Specifies a transfer function for a color component to be applied while rendering.
The available functions include linear, piecewise-linear, gamma and step functions.
Note that the transfer function is applied to un-premultiplied values, and all results are clamped to the [0, 1] range.
Constructors#
- class ComponentTransfer
- classmethod new_discrete(values: list[float]) ComponentTransfer#
Creates a new component transfer that applies a step function.
The new value is computed as
C’ = values[k]
where k is the smallest value such that
k / n <= C < (k + 1) / n
Added in version 4.20.
- Parameters:
values – Values
- classmethod new_gamma(amp: float, exp: float, ofs: float) ComponentTransfer#
Creates a new component transfer that applies a gamma transform.
The new value is computed as
C’ = amp * pow (C, exp) + ofs
Added in version 4.20.
- Parameters:
amp – Amplitude
exp – Exponent
ofs – Offset
- classmethod new_identity() ComponentTransfer#
Creates a new component transfer that doesn’t change the component value.
Added in version 4.20.
- classmethod new_levels(n: float) ComponentTransfer#
Creates a new component transfer that limits the values of the component to
nlevels.The new value is computed as
C’ = (floor (C * n) + 0.5) / n
Added in version 4.20.
- Parameters:
n – Number of levels
- classmethod new_linear(m: float, b: float) ComponentTransfer#
Creates a new component transfer that applies a linear transform.
The new value is computed as
C’ = C * m + b
Added in version 4.20.
- Parameters:
m – Slope
b – Offset
- classmethod new_table(values: list[float]) ComponentTransfer#
Creates a new component transfer that applies a piecewise linear function.
The new value is computed as
C’ = values[k] + (C - k / (n - 1)) * n * (values[k + 1] - values[k])
where k is the smallest value such that
k / (n - 1) <= C < (k + 1) / (n - 1)
Added in version 4.20.
- Parameters:
values – Values