Blender V5.0
BLI_math_color.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include "BLI_color_types.hh"
12#include "BLI_math_base.hh"
14
15namespace blender::math {
16
17template<eAlpha Alpha>
20 const float t)
21{
22 return {math::interpolate(a.r, b.r, t),
23 math::interpolate(a.g, b.g, t),
24 math::interpolate(a.b, b.b, t),
25 math::interpolate(a.a, b.a, t)};
26}
27
28template<eAlpha Alpha>
32 const float t)
33{
34 return {math::interpolate(a.r, b.r, t),
35 math::interpolate(a.g, b.g, t),
36 math::interpolate(a.b, b.b, t),
37 math::interpolate(a.a, b.a, t)};
38}
39
40float3 whitepoint_from_temp_tint(float temperature, float tint);
41
42bool whitepoint_to_temp_tint(const float3 &white, float &temperature, float &tint);
43
44/* Computes a matrix to perform chromatic adaption from a source white point (given in the form of
45 * temperature and tint) to a target white point (given as its XYZ values).
46 * The resulting matrix operates on XYZ values, the caller is responsible for RGB conversion. */
47float3x3 chromatic_adaption_matrix(const float3 &from_XYZ, const float3 &to_XYZ);
48
49} // namespace blender::math
ChannelStorageType r
ChannelStorageType g
ChannelStorageType b
ChannelStorageType a
float3 whitepoint_from_temp_tint(float temperature, float tint)
bool whitepoint_to_temp_tint(const float3 &white, float &temperature, float &tint)
T interpolate(const T &a, const T &b, const FactorT &t)
float3x3 chromatic_adaption_matrix(const float3 &from_XYZ, const float3 &to_XYZ)
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3