:right-sidebar: True ComponentTransfer =================================================================== .. currentmodule:: gi.repository.Gsk .. versionadded:: 4.20 .. class:: ComponentTransfer(*args, **kwargs) :no-contents-entry: 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 ------------ .. rst-class:: interim-class .. class:: ComponentTransfer :no-index: .. classmethod:: new_discrete(values: list[float]) -> ~gi.repository.Gsk.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 .. image:: https://docs.gtk.org/gsk4/discrete-light.png .. versionadded:: 4.20 :param values: Values .. classmethod:: new_gamma(amp: float, exp: float, ofs: float) -> ~gi.repository.Gsk.ComponentTransfer Creates a new component transfer that applies a gamma transform. The new value is computed as C' = amp \* pow (C, exp) + ofs .. image:: https://docs.gtk.org/gsk4/gamma-light.png .. versionadded:: 4.20 :param amp: Amplitude :param exp: Exponent :param ofs: Offset .. classmethod:: new_identity() -> ~gi.repository.Gsk.ComponentTransfer Creates a new component transfer that doesn't change the component value. .. image:: https://docs.gtk.org/gsk4/identity-light.png .. versionadded:: 4.20 .. classmethod:: new_levels(n: float) -> ~gi.repository.Gsk.ComponentTransfer Creates a new component transfer that limits the values of the component to ``n`` levels. The new value is computed as C' = (floor (C \* n) + 0.5) / n .. image:: https://docs.gtk.org/gsk4/levels-light.png .. versionadded:: 4.20 :param n: Number of levels .. classmethod:: new_linear(m: float, b: float) -> ~gi.repository.Gsk.ComponentTransfer Creates a new component transfer that applies a linear transform. The new value is computed as C' = C \* m + b .. image:: https://docs.gtk.org/gsk4/linear-light.png .. versionadded:: 4.20 :param m: Slope :param b: Offset .. classmethod:: new_table(values: list[float]) -> ~gi.repository.Gsk.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) .. image:: https://docs.gtk.org/gsk4/table-light.png .. versionadded:: 4.20 :param values: Values Methods ------- .. rst-class:: interim-class .. class:: ComponentTransfer :no-index: .. classmethod:: equal(other: ~typing.Any) -> bool Compares two component transfers for equality. .. versionadded:: 4.20 :param other: another component transfer .. method:: free() -> None Frees a component transfer. .. versionadded:: 4.20