diff options
Diffstat (limited to 'source/blender/blenlib/BLI_math_color.hh')
-rw-r--r-- | source/blender/blenlib/BLI_math_color.hh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_math_color.hh b/source/blender/blenlib/BLI_math_color.hh index 5195cfb6238..b16053509cf 100644 --- a/source/blender/blenlib/BLI_math_color.hh +++ b/source/blender/blenlib/BLI_math_color.hh @@ -15,9 +15,22 @@ namespace blender::math { -inline ColorGeometry4f interpolate(const ColorGeometry4f &a, - const ColorGeometry4f &b, - const float t) +template<eAlpha Alpha> +inline ColorSceneLinear4f<Alpha> interpolate(const ColorSceneLinear4f<Alpha> &a, + const ColorSceneLinear4f<Alpha> &b, + const float t) +{ + return {math::interpolate(a.r, b.r, t), + math::interpolate(a.g, b.g, t), + math::interpolate(a.b, b.b, t), + math::interpolate(a.a, b.a, t)}; +} + +template<eAlpha Alpha> +inline ColorSceneLinearByteEncoded4b<Alpha> interpolate( + const ColorSceneLinearByteEncoded4b<Alpha> &a, + const ColorSceneLinearByteEncoded4b<Alpha> &b, + const float t) { return {math::interpolate(a.r, b.r, t), math::interpolate(a.g, b.g, t), |