pub enum TransferFunction {
Identity,
Table {
values: Vec<f32>,
},
Discrete {
values: Vec<f32>,
},
Linear {
slope: f32,
intercept: f32,
},
Gamma {
amplitude: f32,
exponent: f32,
offset: f32,
},
}Expand description
Transfer functions for component transfer operations.
These functions map input color channel values to output values, enabling gamma correction, color grading, and custom color curves. Input and output values are typically in the range [0, 1].
Variants§
Identity
Identity function (output = input, no change).
Table
Table lookup with linear interpolation.
Maps input values using a lookup table with linear interpolation between entries. Input 0.0 maps to values[0], 1.0 maps to values[n-1], intermediate values interpolate.
Fields
Discrete
Discrete step function (posterization).
Maps input to discrete output values without interpolation, creating step/banding effects. Each segment gets a constant output value from the table.
Fields
Linear
Linear function: output = slope × input + intercept.
Simple linear transformation of the input value.
Fields
Gamma
Gamma correction: output = amplitude × input^exponent + offset.
Applies power-law transformation, commonly used for gamma correction and adjusting midtone brightness without affecting blacks or whites.
Trait Implementations§
Source§impl Clone for TransferFunction
impl Clone for TransferFunction
Source§fn clone(&self) -> TransferFunction
fn clone(&self) -> TransferFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransferFunction
impl Debug for TransferFunction
Source§impl PartialEq for TransferFunction
impl PartialEq for TransferFunction
Source§fn eq(&self, other: &TransferFunction) -> bool
fn eq(&self, other: &TransferFunction) -> bool
self and other values to be equal, and is used by ==.