gi-gsk-4.0.9: Gsk bindings

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

Contents

- Exported types
- Methods
  - copy
  - equal
  - free
  - newDiscrete
  - newGamma
  - newIdentity
  - newLevels
  - newLinear
  - newTable

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

Instances details

Eq ComponentTransfer Source # |
Instance details Defined in GI.Gsk.Structs.ComponentTransfer Methods (==) :: ComponentTransfer -> ComponentTransfer -> Bool Source # (/=) :: ComponentTransfer -> ComponentTransfer -> Bool Source #
GBoxed ComponentTransfer Source # |
Instance details Defined in GI.Gsk.Structs.ComponentTransfer
ManagedPtrNewtype ComponentTransfer Source # |
Instance details Defined in GI.Gsk.Structs.ComponentTransfer Methods toManagedPtr :: ComponentTransfer -> ManagedPtr ComponentTransfer Source #
TypedObject ComponentTransfer Source # |
Instance details Defined in GI.Gsk.Structs.ComponentTransfer Methods glibType :: IO GType Source #
HasParentTypes ComponentTransfer Source # |
Instance details Defined in GI.Gsk.Structs.ComponentTransfer
IsGValue (Maybe ComponentTransfer) Source # | Convert `ComponentTransfer` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gsk.Structs.ComponentTransfer Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe ComponentTransfer -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe ComponentTransfer) Source #
type ParentTypes ComponentTransfer Source # |
Instance details Defined in GI.Gsk.Structs.ComponentTransfer type ParentTypes ComponentTransfer = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

copy, free.

#### Getters

None.

#### Setters

None.

## copy

componentTransferCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ComponentTransfer | `other`: a component transfer
-> m ComponentTransfer | Returns: a newly allocated copy of `other`

Creates a copy of `other`.

Since: 4.20

## equal

componentTransferEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ptr () | `self`: a component transfer
-> Ptr () | `other`: another component transfer
-> m Bool | Returns: true if `self` and `other` are equal

Compares two component transfers for equality.

Since: 4.20

## free

componentTransferFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ComponentTransfer | `self`: a component transfer
-> m () |

Frees a component transfer.

Since: 4.20

## newDiscrete

componentTransferNewDiscrete Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> [Float] | `values`: Values
-> m ComponentTransfer | Returns: a new `GskComponentTransfer`

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 | `amp`: Amplitude
-> Float | `exp`: Exponent
-> Float | `ofs`: Offset
-> m ComponentTransfer | Returns: a new `GskComponentTransfer`

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 `GskComponentTransfer`

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 | `n`: Number of levels
-> m ComponentTransfer | Returns: a new `GskComponentTransfer`

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 | `m`: Slope
-> Float | `b`: Offset
-> m ComponentTransfer | Returns: a new `GskComponentTransfer`

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] | `values`: Values
-> m ComponentTransfer | Returns: a new `GskComponentTransfer`

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