gi-gsk-4.0.9: Gsk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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

Exported types

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