Gsk.ComponentTransfer¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
Details¶
- class Gsk.ComponentTransfer¶
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.
New in version 4.20.
- classmethod equal(self, other)¶
- Parameters:
- Returns:
true if self and other are equal
- Return type:
Compares two component transfers for equality.
New in version 4.20.
- classmethod new_discrete(values)¶
- Parameters:
values ([
float]) – Values- Returns:
a new
GskComponentTransfer- Return type:
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
<figure> <picture> <source srcset=”discrete-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”Component transfer: discrete” src=”discrete-light.png”> </picture> </figure>
New in version 4.20.
- classmethod new_gamma(amp, exp, ofs)¶
- Parameters:
- Returns:
a new
GskComponentTransfer- Return type:
Creates a new component transfer that applies a gamma transform.
The new value is computed as
C’ = amp * pow (C, exp) + ofs
<figure> <picture> <source srcset=”gamma-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”Component transfer: gamma” src=”gamma-light.png”> </picture> </figure>
New in version 4.20.
- classmethod new_identity()¶
- Returns:
a new
GskComponentTransfer- Return type:
Creates a new component transfer that doesn’t change the component value.
<figure> <picture> <source srcset=”identity-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”Component transfer: identity” src=”identity-light.png”> </picture> </figure>
New in version 4.20.
- classmethod new_levels(n)¶
- Parameters:
n (
float) – Number of levels- Returns:
a new
GskComponentTransfer- Return type:
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
<figure> <picture> <source srcset=”levels-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”Component transfer: levels” src=”levels-light.png”> </picture> </figure>
New in version 4.20.
- classmethod new_linear(m, b)¶
- Parameters:
- Returns:
a new
GskComponentTransfer- Return type:
Creates a new component transfer that applies a linear transform.
The new value is computed as
C’ = C * m + b
<figure> <picture> <source srcset=”linear-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”Component transfer: linear” src=”linear-light.png”> </picture> </figure>
New in version 4.20.
- classmethod new_table(values)¶
- Parameters:
values ([
float]) – Values- Returns:
a new
GskComponentTransfer- Return type:
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)
<figure> <picture> <source srcset=”table-dark.png” media=”(prefers-color-scheme: dark)”> <img alt=”Component transfer: table” src=”table-light.png”> </picture> </figure>
New in version 4.20.
- copy()¶
- Returns:
a newly allocated copy of self
- Return type:
Creates a copy of self.
New in version 4.20.
- free()¶
Frees a component transfer.
New in version 4.20.