linearToHybridGamma

Linear to hybrid linear-gamma transfer function. The function and parameters are detailed in the example below.

@safe pure nothrow @nogc
T
linearToHybridGamma
(
double a
double b
double s
double e
T
)
(
T v
)
if (
isFloatingPoint!T
)

Examples

// sRGB parameters
enum a = 1.055;
enum b = 0.0031308;
enum s = 12.92;
enum e = 1/2.4;

double v = 0.5;

// the gamma function
if (v <= b)
    v = v*s;
else
    v = a*v^^e - (a - 1);

assert(abs(v - linearToHybridGamma!(a, b, s, e)(0.5)) < double.epsilon);

Meta