Quick actions

cmd+k|ctrl+k

Navigation

Languages

Linear blend

Snippet info

Language

Cpp

Visibility

public

Author

evine

Created

2016-08-01T23:09:56Z

Updated

2016-08-01T23:10:26Z

#include <stdio.h>
#include <math.h>


double get_blend_color(double a, double b, double opacity)
{
    a = pow(a, 2.2);
    b = pow(b, 2.2);
    
    double result = a * opacity + b * (1 - opacity);
    
    result = pow(result, 1/2.2);
    return result;
}

int main()
{
    printf("%f\n", get_blend_color(1,0,0.5));
    return 0;
}
INFO