2.2 <GskComponentTransfer>

Structure: <GskComponentTransfer>

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.

Procedures

Method: component-transfer:copy self ⇒ %return
Method: copy self ⇒ %return

Creates a copy of self.

self

Passed: a <GskComponentTransfer>.

a component transfer

%return

Returned: a <GskComponentTransfer>.

a newly allocated copy of self

Procedure: component-transfer:equal? self other ⇒ %return

Compares two component transfers for equality.

self

Passed: a foreign pointer, or a bytevector.

a component transfer

other

Passed: a foreign pointer, or a bytevector.

another component transfer

%return

Returned: a boolean.

true if self and other are equal

Method: component-transfer:free self
Method: free self

Frees a component transfer.

self

Passed: a <GskComponentTransfer>.

a component transfer

Procedure: component-transfer:new-discrete values ⇒ %return

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

values

Passed: a f32vector, or a list or vector, each a real number.

Values

%return

Returned: a <GskComponentTransfer>.

a new <GskComponentTransfer>

n

Not passed: guile-gi gives the length of values.

Number of values

Procedure: component-transfer:new-gamma amp exp ofs ⇒ %return

Creates a new component transfer that applies a gamma transform.

The new value is computed as

C’ = amp * pow (C, exp) + ofs

amp

Passed: a real number.

Amplitude

exp

Passed: a real number.

Exponent

ofs

Passed: a real number.

Offset

%return

Returned: a <GskComponentTransfer>.

a new <GskComponentTransfer>

Procedure: component-transfer:new-identity ⇒ %return

Creates a new component transfer that doesn’t change the component value.

%return

Returned: a <GskComponentTransfer>.

a new <GskComponentTransfer>

Procedure: component-transfer:new-levels n ⇒ %return

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

n

Passed: a real number.

Number of levels

%return

Returned: a <GskComponentTransfer>.

a new <GskComponentTransfer>

Procedure: component-transfer:new-linear m b ⇒ %return

Creates a new component transfer that applies a linear transform.

The new value is computed as

C’ = C * m + b

m

Passed: a real number.

Slope

b

Passed: a real number.

Offset

%return

Returned: a <GskComponentTransfer>.

a new <GskComponentTransfer>

Procedure: component-transfer:new-table values ⇒ %return

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)

values

Passed: a f32vector, or a list or vector, each a real number.

Values

%return

Returned: a <GskComponentTransfer>.

a new <GskComponentTransfer>

n

Not passed: guile-gi gives the length of values.

Number of values