| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gsk.Structs.ComponentTransfer
Description
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.
Since: 4.20
Synopsis
- newtype ComponentTransfer = ComponentTransfer (ManagedPtr ComponentTransfer)
- componentTransferCopy :: (HasCallStack, MonadIO m) => ComponentTransfer -> m ComponentTransfer
- componentTransferEqual :: (HasCallStack, MonadIO m) => Ptr () -> Ptr () -> m Bool
- componentTransferFree :: (HasCallStack, MonadIO m) => ComponentTransfer -> m ()
- componentTransferNewDiscrete :: (HasCallStack, MonadIO m) => [Float] -> m ComponentTransfer
- componentTransferNewGamma :: (HasCallStack, MonadIO m) => Float -> Float -> Float -> m ComponentTransfer
- componentTransferNewIdentity :: (HasCallStack, MonadIO m) => m ComponentTransfer
- componentTransferNewLevels :: (HasCallStack, MonadIO m) => Float -> m ComponentTransfer
- componentTransferNewLinear :: (HasCallStack, MonadIO m) => Float -> Float -> m ComponentTransfer
- componentTransferNewTable :: (HasCallStack, MonadIO m) => [Float] -> m ComponentTransfer
Exported types
newtype ComponentTransfer Source #
Memory-managed wrapper type.
Constructors
| ComponentTransfer (ManagedPtr ComponentTransfer) |
Instances
Methods
Click to display all available methods, including inherited ones
copy
componentTransferCopy Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => ComponentTransfer |
|
| -> m ComponentTransfer | Returns: a newly allocated copy of |
Creates a copy of other.
Since: 4.20
equal
componentTransferEqual Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Ptr () |
|
| -> Ptr () |
|
| -> m Bool | Returns: true if |
Compares two component transfers for equality.
Since: 4.20
free
componentTransferFree Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => ComponentTransfer |
|
| -> m () |
Frees a component transfer.
Since: 4.20
newDiscrete
componentTransferNewDiscrete Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [Float] |
|
| -> m ComponentTransfer | Returns: a new |
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>
Since: 4.20
newGamma
componentTransferNewGamma Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Float |
|
| -> Float |
|
| -> Float |
|
| -> m ComponentTransfer | Returns: a new |
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>
Since: 4.20
newIdentity
componentTransferNewIdentity Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m ComponentTransfer | Returns: a new |
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>
Since: 4.20
newLevels
componentTransferNewLevels Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Float |
|
| -> m ComponentTransfer | Returns: a new |
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
<figure> <picture> <source srcset="levels-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Component transfer: levels" src="levels-light.png"> </picture> </figure>
Since: 4.20
newLinear
componentTransferNewLinear Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Float |
|
| -> Float |
|
| -> m ComponentTransfer | Returns: a new |
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>
Since: 4.20
newTable
componentTransferNewTable Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => [Float] |
|
| -> m ComponentTransfer | Returns: a new |
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>
Since: 4.20